summaryrefslogtreecommitdiff
path: root/support/utf2any/test/maketest
blob: 5e9434184a17800950cfa26b99c07f75aca083f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/local/bin/perl

use vars qw($opt_7 $opt_8 $opt_L);
use Getopt::Std;

@range = (
#    [ 0, 127, 'Controls and Basic Latin' ],
    [ 128, 255, 'Controls and Latin-1 Supplement' ],
    [ 0x100, 0x17F, 'Latin Extended-A' ],
    [ 0x180, 0x24F, 'Latin Extended-B' ],
    [ 0x250, 0x2AF, 'IPA Extensions' ],
    [ 0x2B0, 0x2FF, 'Spacing Modifier Letters' ],
    [ 0x2000, 0x206F, 'General Punctuation' ],
    [ 0x20A0, 0x20CF, 'Currency Symbols' ],
    [ 0x2100, 0x214F, 'Letterlike Symbols' ],
    [ 0x2150, 0x218F, 'Number Forms' ],
    [ 0xFB00, 0xFB4F, 'Alphabetic Presentation Forms' ],
);

$progname = $0;
$progname =~ s!.*/!!;

getopts('78L');

$enc = '-7' if ($opt_7);
$enc = '-8' if ($opt_8);

if ($enc eq '') {
    die <<"EOT";

Usage: $progname -7|-8 [-L]

  -7 : Use UTF-7 encoding
  -8 : Use UTF-8 encoding
  -L : Generate LaTeX file

EOT
}

if ($opt_L) {
    $format = "\\noindent U+%04X: %s\n";
} else {
    $format = "U+%04X: %s";
}
$format =~ s/\+/+-/ if ($opt_7);

if ($opt_L) {
    print <<'EOT';
\documentclass[a4paper,12pt,twocolumn]{article}
\usepackage{textcomp}
\usepackage{eurofont}
\usepackage[T1,tone,safe]{tipa}
\begin{document}
EOT
}

for $ref (@range) {
    $from = $ref->[0];
    $to = $ref->[1];
    $txt = $ref->[2];
    $txt =~ s/\+/+-/g if ($opt_7);
    print ($opt_L ? "\\subsubsection*{$txt}\n\n" : "$txt\n\n");
    for ($i = $from; $i <= $to; $i++) {
        $utf = `utfcode $enc 120 $i 120`;
        printf ($format, $i, $utf);
    }
    print "\n" unless ($opt_L);
}

print "\\end{document}\n" if ($opt_L);