our $foundryinfo;
our %props;
our $tolerate_bad_fonts=1;
+our $always_reprocess;
our $wanted_parallel;
sub reportloaded {
}
sub processbdf ($$$$) {
- my ($inbdf,$outbdf,$logfile,$what) = @_;
+ my ($inbdf,$outbdf,$logfh,$what) = @_;
my $state='idle';
my ($foundry,$font);
my ($w,$h,$xo,$yo,$y,$bitmap,$glyph);
return 'no bdf data' # also special cased in processpcfgz
if !$anyinput;
if ($modified) {
- printf $logfile "%s: %d glyphs changed\n", $what, $modified
+ printf $logfh "%s: %d glyphs changed\n", $what, $modified
or die $!;
} else {
- printf $logfile "%s: unchanged - no rules matched\n", $what
+ printf $logfh "%s: unchanged - no rules matched\n", $what
or die $!;
}
return $modified;
while (<$f>) {
s/^\s*//; s/\s+$//;
next if m/^\#/;
- m/^(\w+)\s+(\w+)$/ or die;
+ m/^([.0-9A-Za-z]+)\s+([.0-9A-Za-z]+)$/ or die;
my $k = lc $1;
next if exists $foundrymap{$k};
$foundrymap{$k}=$2;
die "no foundry maps\n" unless %foundrymap;
}
+sub filter_st_isok ($) {
+ my ($ch) = @_;
+ my $st = $ch->{St};
+ return !$st || $ch->{SigOK}{($st & ~128)};
+}
+
sub processpcfgz ($$$$) {
- my ($inpcfgz,$outpcfgz,$logfile,$what) = @_;
+ my ($inpcfgz,$outpcfgz,$logfh,$what) = @_;
print $reportfh "processing $inpcfgz to $outpcfgz\n" if $verbose>=2;
my $current = new IO::File $inpcfgz, '<' or die "$inpcfgz $!";
my ($usread,$uswrite);
$current = $reader;
}
}
- my $r = processbdf($usread,$uswrite,$logfile,$what);
+ my $r = processbdf($usread,$uswrite,$logfh,$what);
my $none = $r !~ m/^\d/;
$ch{'gunzip'}{SigOK}{13} = 1;
$ch->{St} = $?;
}
- my $st_isok = sub {
- my ($ch) = @_;
- my $st = $ch->{St};
- return !$st || $ch->{SigOK}{($st & ~128)};
- };
-
if ($tolerate_bad_fonts &&
$r eq 'no bdf data' &&
- $st_isok->($ch{'gunzip'}) &&
+ filter_st_isok($ch{'gunzip'}) &&
($ch{'pcf2bdf'}{St} & ~128) == 6)
{
$r = "pcf2bdf failed ($ch{'pcf2bdf'}{St})";
$ch{'pcf2bdf'}{SigOK}{6} = 1;
}
foreach my $ch (@children) {
- if (!$st_isok->($ch)) {
+ if (!filter_st_isok($ch)) {
die "update-xfonts-traditional:".
" $ch->{Exe} [$ch->{Pid}] for $inpcfgz".
" failed $ch->{St}".
return;
}
my $changed = 0;
- my $olddone = do "$fontdir/$donefile";
- if (!$olddone) {
- die "$fontdir $! $@ " unless $!==&ENOENT;
- } elsif ($olddone->{''} ne $foundryinfo) {
- our $repro_reported;
- print $reportfh "reprocessing fonts (rules updated)\n" or die $!
- unless $repro_reported++;
- $olddone = undef;
+ my $olddone;
+ if (!$always_reprocess) {
+ $olddone = do "$fontdir/$donefile";
+ if (!$olddone) {
+ die "$fontdir $! $@ " unless $!==&ENOENT;
+ } elsif ($olddone->{''} ne $foundryinfo) {
+ our $repro_reported;
+ print $reportfh "reprocessing fonts (rules updated)\n" or die $!
+ unless $repro_reported++;
+ $olddone = undef;
+ }
}
if (!$olddone) {
$olddone = { };
my $logpath = "$fontdir/$logfile";
unlink "$logpath" or $!==&ENOENT or die "$logpath $!";
- my $log = new IO::File $logpath, ">>" or die "$logpath $!";
+ my $logfh = new IO::File $logpath, ">>" or die "$logpath $!";
if (!$wanted_parallel) {
$wanted_parallel = Sys::CPU::cpu_count();
if (!$child) {
my $r = processpcfgz("$fontdir/$dent",
"$fontdir/$outdent.new",
- $log, $dent);
+ $logfh, $dent);
my $rc;
if ($r !~ m/^\d/) {
- printf $log "%s: unchanged - %s\n", $dent, $r;
+ printf $logfh "%s: unchanged - %s\n", $dent, $r;
unlink "$fontdir/$outdent.new" or die "$fontdir $outdent $!";
$rc = 2;
} else {
or die "$fontdir $outdent $!";
$rc = 0;
}
- $log->flush or die "$logpath $!";
+ $logfh->flush or die "$logpath $!";
exit $rc;
}
$inprogress{$child} = {
'share-dir=s' => \$sharedir,
'verbose|v+' => \$verbose,
'j|parallel=i' => \$wanted_parallel,
+ 'always-reprocess!' => \$always_reprocess,
'tolerate-bad-fonts!' => \$tolerate_bad_fonts,
);