summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/fonts/gnu-freefont/tools/test/MES-Conformance/mes-list-expand.pl
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/fonts/gnu-freefont/tools/test/MES-Conformance/mes-list-expand.pl')
-rwxr-xr-xMaster/texmf-dist/doc/fonts/gnu-freefont/tools/test/MES-Conformance/mes-list-expand.pl45
1 files changed, 45 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/fonts/gnu-freefont/tools/test/MES-Conformance/mes-list-expand.pl b/Master/texmf-dist/doc/fonts/gnu-freefont/tools/test/MES-Conformance/mes-list-expand.pl
new file mode 100755
index 00000000000..16b37369479
--- /dev/null
+++ b/Master/texmf-dist/doc/fonts/gnu-freefont/tools/test/MES-Conformance/mes-list-expand.pl
@@ -0,0 +1,45 @@
+#!/usr/bin/perl
+# $Id: mes-list-expand.pl,v 1.1 2009-12-27 16:25:15 Stevan_White Exp $
+#
+# Expand MES ranges, as available in CEN documents, into simple list
+# of character codes.
+
+# Unicode table
+$tblfile = "/usr/local/share/unicode/UnicodeData-Latest.txt";
+# Array size
+$#table = 65535;
+
+# Read in complete Unicode table for the named entities
+open(TABLE, "<$tblfile") || die "Cannot find $tblfile\n";
+while (<TABLE>) {
+ ($code,$name) = split(/[;\n]/, $_, 9999);
+ $table[hex($code)] = $name;
+}
+close(TABLE);
+
+if ($#ARGV >= 0) {
+ open(RANGE, $ARGV[0]);
+} else {
+ open(RANGE, "<stdin");
+}
+while (<RANGE>) {
+ if (/^\#.*/) {
+ next;
+ } else {
+ ($page,$codes) = split(/[\t]/, $_, 9999);
+ chomp $codes;
+ @range = split(/ /, $codes, 9999);
+ for ($i = 0; $i <= $#range; $i++) {
+ if (length($range[$i]) == 2) {
+ $code = 256*hex($page) + hex($range[$i]);
+ printf("%04X:%s\n", $code, $table[$code]);
+ } else {
+ ($lower,$upper) = split(/-/, $range[$i], 9999);
+ for ($j = hex($lower); $j <= hex($upper); $j++) {
+ $code = 256*hex($page) + $j;
+ printf("%04X:%s\n", $code, $table[$code]);
+ }
+ }
+ }
+ }
+}