blob: f3d5706220ce6a3b3dd2fe7cf43c6ef0bd59a097 (
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
|
#!/usr/bin/perl -w
# read a psftools .txt font, for any glyph that has multiple Unicode
# codepoints, output that glyph multiple times (one per codepoint).
# result is suitable for conversion to a BDF.
$glyphcount = 0;
sub dup {
my $orig = shift;
my $new;
my $ret;
my @cps = ($orig =~ /\[(\w+)\];/g);
for my $cp (@cps) {
#warn ">> $cp <<\n";
$glyphcount++;
($new = $orig) =~ s,(Unicode: ).*,$1\[$cp\];,;
$ret .= $new;
}
return $ret;
}
$/ = '%';
<>;
$header = '%' . <>;
while(<>) {
next if /\[0000\];/;
if(/Unicode:.*;.*;/) {
$_ = dup($_);
} else {
$glyphcount++;
}
$output .= $_;
}
$header =~ s/(Length:\s+)\d+/$1$glyphcount/;
print $header . $output;
|