Tools(listFontWithLang.pl): Polishing

This commit is contained in:
Kornel Benko 2020-05-21 11:50:42 +02:00
parent f7ad823cb8
commit 580057bef7
2 changed files with 29 additions and 16 deletions

View File

@ -102,7 +102,14 @@ sub handleOptions($)
print " " . "-" x 32 . "\n";
for my $k (sort keys %options) {
if (defined($options{$k})) {
printf(" %-16s%s\n", $k, $options{$k});
my $val;
if (ref($options{$k}) eq "ARRAY") {
$val = join(',', @{$options{$k}});
}
else {
$val = $options{$k};
}
printf(" %-16s%s\n", $k, $val);
}
else {
print " $k\n";

View File

@ -719,20 +719,15 @@ sub getweight($$)
{
my ($fontname, $style) = @_;
my $result = undef;
for my $info ($style, $fontname) {
for my $key (keys %weights) {
next if ($key !~ /^\d+$/);
my $val = $weights{$key};
for my $info ($style, $fontname) {
if ($info =~ /\b$val\b/i) {
if ($val eq "Regular") {
$result = $val; # It may refer to width
}
else {
return($val);
}
}
}
}
return($result);
}
@ -777,7 +772,7 @@ sub getspacing($$)
return($spacings{$key});
}
}
if ("$fontname $style" =~ /(mono|typewriter|cursor|fixed)\b/i) {
if ("$fontname $style" =~ /(\bmono\b|luximono|typewriter|cursor|fixed)\b/i) {
return($spacings{100}); # Mono
}
else {
@ -811,9 +806,20 @@ sub getproperties($$$$)
my $val1 = $rget->($newfam, $newstyle);
my $val;
if (defined($val2) && defined($val1) && ($val2 ne $val1)) {
push(@{$rerrors}, "Fontname($fontname),Style($style): Values for $txt ($val1 != $val2) differ, selecting internal $txt($val2)");
if (($txt =~/^(weight|slant)$/) && ($newstyle =~ /$val1/)){
# style overrides weight and slant
push(@{$rerrors}, "Fontname($fontname),Style($style): Values for $txt ($val1 != $val2) differ, pick $val1 from style");
$val = $val1;
}
elsif ($newfam =~ /$val1/) {
push(@{$rerrors}, "Fontname($fontname),Style($style): Values for $txt ($val1 != $val2) differ, pick $val1 from fontname");
$val = $val1;
}
else {
push(@{$rerrors}, "Fontname($fontname),Style($style): Values for $txt ($val1 != $val2) differ, pick $val2 from $txt-property");
$val = $val2;
}
}
elsif (! defined($val2)) {
$val = $val1;
}
@ -869,6 +875,7 @@ sub correctstyle($)
$style =~ s/\b(SC|Small(caps(alt)?)?)\b/SmallCaps/i;
$style =~ s/w3 mono/Dual/i;
$style =~ s/Regul[ea]r/Regular/i;
$style =~ s/Megablack/ExtraBlack/i;
$style =~ s/ +/ /g;
return($style);
}
@ -921,9 +928,8 @@ sub decimalUnicode($)
}
# check if the glyph-value $d is contained
# check if the glyph-values in interval @{$ri} are contained
# in one of the (sorted) intervals
# Inputs as intervals
sub contains($$)
{
# ok if