chiark / gitweb /
mkrules: Handle multiple files with the same metrics.
[xfonts-traditional] / update-xfonts-traditional
index 839cc1827cf678d595e3a43d1b8e7d6f6ad8c365..65d1d086c333112bdeb5f0727f2e7a687fd49197 100755 (executable)
@@ -21,6 +21,7 @@ our %foundrymap;
 our $verbose=0;
 our $reportfh;
 our $foundryinfo;
+our %props;
 
 sub reportloaded {
     return unless $verbose;
@@ -55,6 +56,7 @@ sub processbdf ($$$$) {
     my ($foundry,$font);
     my ($w,$h,$xo,$yo,$y,$bitmap,$glyph);
     my $modified=0;
+    %props = ();
     while (<$inbdf>) {
        if ($state eq 'bitmap' && $y==$h) {
            $glyph = uc $glyph;
@@ -97,6 +99,10 @@ sub processbdf ($$$$) {
            $state='startchar';
            $w=undef;
        }
+       if (($state eq 'idle' || $state eq 'startchar') &&
+           m/^([A-Z_]+)\s+(.*\S)\s+$/) {
+           $props{$1}=$2;
+       }
        if ($state eq 'startchar') {
            if (m/^BBX\s+(\+?\d+)\s+(\+?\d+)\s+([-+]?\d+)\s+([-+]?\d+)\s+$/) {
                ($w,$h,$xo,$yo) = ($1,$2,$3,$4);
@@ -106,6 +112,9 @@ sub processbdf ($$$$) {
                $y=0;
                $glyph='';
                $state='bitmap';
+               $props{' 7bit'}=
+                   ($props{'CHARSET_REGISTRY'} =~ m/iso8859|utf|iso10646/i &&
+                    $props{'ENCODING'} <= 127);
            }
        }
        print $outbdf $_ or die $!;
@@ -156,13 +165,13 @@ sub loadfoundries () {
 
 sub processpcfgz ($$$$) {
     my ($inpcfgz,$outpcfgz,$logfile,$what) = @_;
-
+    print $reportfh "processing $inpcfgz to $outpcfgz\n" if $verbose>=2;
     my $current = new IO::File $inpcfgz, '<' or die "$inpcfgz $!";
     my ($usread,$uswrite);
     my ($reader,$writer);
     my @children;
     foreach my $proc (['gunzip'], ['pcf2bdf'], [],
-                     ['bdftopcf'],['',qw(gzip -1)]) {
+                     ['bdftopcf'],['',qw(gzip -1 -n)]) {
        my $isfinal = (@$proc && $proc->[0] eq '');
        if (!$isfinal) {
            $reader = new IO::Handle or die $!;
@@ -231,8 +240,7 @@ sub processfontdir ($) {
     my $olddone = do "$fontdir/$donefile";
     if (!$olddone) {
        die "$fontdir $! $@ " unless $!==&ENOENT;
-    }
-    if ($olddone && $olddone->{''} ne $foundryinfo) {
+    } elsif ($olddone->{''} ne $foundryinfo) {
        our $repro_reported;
        print $reportfh "reprocessing fonts (rules updated)\n" or die $!
            unless $repro_reported++;