Tools: recognize math font in listFontWithLang.pl

This commit is contained in:
Kornel Benko 2020-05-09 13:19:12 +02:00
parent b1a0f7ac54
commit 3eb56006b5

View File

@ -39,6 +39,7 @@ sub extractlist($$$); # my ($l, $islang, $txt, $rres) = @_;
sub getIndex($$);
sub getVal($$$); # my ($l, $txtval, $txtlang) = @_;
sub getproperties($$$$);
sub ismathfont($$);
sub correctstyle($);
# Following fields for a parameter can be defined:
@ -52,6 +53,8 @@ my %optionsDef = (
"l" => {fieldname => "Lang",
type => "=s", alias=>["lang"],
comment => "Comma separated list of desired languages"},
"math" => {fieldname => "Math",
comment => "Select fonts probably containing math glyphs"},
"n" => {fieldname => "FontName", listsep => ',',
type => "=s", alias => ["name"],
comment => "Select font-names matching these (comma separated) regexes"},
@ -99,7 +102,7 @@ if (defined($langs[0])) {
my $format = "foundry=\"%{foundry}\" postscriptname=\"%{postscriptname}\" fn=\"%{fullname}\" fnl=\"%{fullnamelang}\" family=\"%{family}\" flang=\"%{familylang}\" style=\"%{style}\" stylelang=\"%{stylelang}\"";
if (exists($options{PrintScripts}) || defined($options{Scripts}) || defined($options{NSpripts})) {
if (exists($options{PrintScripts}) || defined($options{Scripts}) || defined($options{NSpripts}) || exists($options{Math})) {
$format .= " script=\"%{capability}\"";
}
if (exists($options{PrintLangs}) || defined($langs[0])) {
@ -275,7 +278,7 @@ if (open(FI, "$cmd |")) {
if (exists($options{PrintLangs})) {
$props .= '(' . join(',', sort keys %usedlangs) . ')';
}
if (exists($options{PrintScripts}) || defined($options{Scripts}) || defined($options{NScripts})) {
if (exists($options{PrintScripts}) || defined($options{Scripts}) || defined($options{NScripts}) || exists($options{Math})) {
my @scripts = ();
my $scripts = "";
if ($l =~ / script=\"([^\"]+)\"/) {
@ -286,6 +289,9 @@ if (open(FI, "$cmd |")) {
}
$scripts = join(',', @scripts);
}
if (exists($options{Math})) {
next NXTLINE if (! &ismathfont($family,\@scripts));
}
if (exists($options{PrintScripts})) {
$props .= "($scripts)";
}
@ -551,6 +557,17 @@ sub getspacing($$)
}
}
sub ismathfont($$)
{
my ($family, $rCapability) = @_;
return 1 if ($family =~ /math/i);
for my $cap (@{$rCapability}) {
return 1 if ($cap eq "math");
}
return 0;
}
sub getproperties($$$$)
{
my ($l, $family, $style, $rerrors) = @_;