Blame view
sources/3rdparty/phpdocx/pdf/lib/ttf2ufm/src/other/showdf
1.1 KB
|
31b7f2792
|
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 |
#!/usr/bin/perl
if (@ARGV != 3) {
print STDERR "Use:
";
print STDERR " showdf <showg-script> <old-file> <new-file>
";
print STDERR "to create a showg diagram of glyphs differing in two files
";
exit 1;
}
$cmd = shift @ARGV;
$oldf = shift @ARGV;
$newf = shift @ARGV;
open(O, "<$oldf") or die "Unable to open '$oldf'
";
open(N, "<$newf") or die "Unable to open '$newf'
";
while(<O>) {
last if(/CharStrings/);
}
while(<N>) {
last if(/CharStrings/);
}
undef @symlist;
$sym = '';
$inlist = 0;
$nstop = 0;
while($so = <O>) {
if($so =~ m|^(/\S+)\s+\{|) {
$sym = $1;
$inlist = 0;
#printf STDERR "found sym $sym
";
if (!$nstop || $sn !~ m|^$sym\s+\{|) {
while($sn = <N>) {
#print STDERR "+$sn";
last if($sn =~ m|^${sym}\s+\{|);
}
}
$nstop = 0;
} elsif(!$nstop) {
$sn = <N>;
#print STDERR "<$so>$sn
";
if($so ne $sn) {
if(!$inlist) {
$inlist = 1;
push(@symlist, $sym);
}
if($sn =~ m|^(/\S+)\s+\{|) {
$nstop = 1;
#printf STDERR "stop at $1
";
}
}
}
}
unshift(@symlist, $cmd, '-c', $oldf, $newf);
#printf("%s
", join(' ', @symlist));
exec @symlist;
|