[LyX/master] Tools(listFontWithLang.pl): Polishing the display of font names.

2020-08-24 Thread Kornel Benko
commit 99508630586181cafafd597788312cf1d6672c4d
Author: Kornel Benko 
Date:   Mon Aug 24 13:45:42 2020 +0200

Tools(listFontWithLang.pl): Polishing the display of font names.

Also always display the foundry
---
 development/tools/listFontWithLang.pl |   15 +--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/development/tools/listFontWithLang.pl 
b/development/tools/listFontWithLang.pl
index 2ae732c..34c36c9 100644
--- a/development/tools/listFontWithLang.pl
+++ b/development/tools/listFontWithLang.pl
@@ -400,7 +400,7 @@ my %sansFonts = (
   "q" => 
qr/^(qt(ancient|helvet|avanti|doghaus|eratype|eurotype|floraline|frank|fritz|future|greece|howard|letter|optimum)|quercus)/i,
   "r" => qr/^(rachana|radio\b|raleway|ricty|roboto|rosario)/i,
   "s" => 
qr/^(salem|samanata|sawasdee|shado|sharja|simple|sophia|soul|source|switzera)/i,
-  "t" => 
qr/^(tarablus|teen|texgyre(adventor|heros)|tiresias|trebuchet|tscu|tuffy)/i,
+  "t" => qr/^(tarablus|teen|tex ?gyre 
?(adventor|heros)|tiresias|trebuchet|tscu|tuffy)/i,
   "u" => qr/^u(buntu|kij 
(bom|chechek|cjk|diwani|ekran|elipbe|inchike|jelliy|kufi|mejnuntal|qara|qolyazma|teng|title|tor|tuz
 ?(neqish|tom))|mpush|n 
?(dinaru|jamo|graphic|taza|vada|yetgul)|ni(kurd|space|versalis)|roob|rw 
?classico)/i,
   "v" => qr/^(veranda|vn ?urwclassico)/i,
   "w" => qr/^(waree)/i,
@@ -670,7 +670,7 @@ if (open(FI,  "$cmd |")) {
 
 for my $fontname (sort keys %collectedfonts) {
   my @foundries = sort keys %{$collectedfonts{$fontname}};
-  my $printfoundries = 0;
+  my $printfoundries = 1;
   if (defined($foundries[1])) {
 $printfoundries = 1;
   }
@@ -1208,11 +1208,22 @@ sub buildFontName($$)
   $family =~ s/\bextbd\b/ExtraBold/i;
   $family =~ s/\bextlt\b/ExtraLight/i;
   $family =~ s/\bmed\b/Medium/i;
+  my $prefix = "";
+  # Split the family name at the border lowercase <-> uppercase characters
+  # except if family starts with "TeX" or "DejaVu", etc
+  if ($family =~ s/^((La|cw|PL)?TeX|DejaVu|MarVoSym|PL)//) {
+$prefix = $1;
+if ($family =~ /^[A-Z]/) {
+  $prefix .= " ";
+}
+  }
+
   if ($family =~ /^([A-Z]*[a-z]+)([A-Z]\w+)\b(.*)$/) {
 $family = $1 . splitatlU($2) . $3;
   }
   $family =~ s/^Ant Polt\b/Antykwa Poltawskiego/;
   $family =~ s/\b(Semi|Extra) (Bold|Condensed|Expanded|Light)\b/$1$2/;
+  $family = $prefix . $family;
   my @style = ($style);
   for my $st (@style) {
 $st = ucfirst($st);
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs


[LyX/master] Tools(listFontWithLang.pl): Polishing

2020-05-21 Thread Kornel Benko
commit 580057bef710ec62a8c1f77380f90c312891bddf
Author: Kornel Benko 
Date:   Thu May 21 11:50:42 2020 +0200

Tools(listFontWithLang.pl): Polishing
---
 development/tools/GetOptions.pm   |9 +++-
 development/tools/listFontWithLang.pl |   36 +++-
 2 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/development/tools/GetOptions.pm b/development/tools/GetOptions.pm
index 0b69f79..5660b02 100644
--- a/development/tools/GetOptions.pm
+++ b/development/tools/GetOptions.pm
@@ -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";
diff --git a/development/tools/listFontWithLang.pl 
b/development/tools/listFontWithLang.pl
index 342e70e..5e19728 100644
--- a/development/tools/listFontWithLang.pl
+++ b/development/tools/listFontWithLang.pl
@@ -719,17 +719,12 @@ sub getweight($$)
 {
   my ($fontname, $style) = @_;
   my $result = undef;
-  for my $key (keys %weights) {
-next if ($key !~ /^\d+$/);
-my $val = $weights{$key};
-for my $info ($style, $fontname) {
+  for my $info ($style, $fontname) {
+for my $key (keys %weights) {
+  next if ($key !~ /^\d+$/);
+  my $val = $weights{$key};
   if ($info =~ /\b$val\b/i) {
-if ($val eq "Regular") {
-  $result = $val;# It may refer to width
-}
-else {
-  return($val);
-}
+return($val);
   }
 }
   }
@@ -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,8 +806,19 @@ 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)");
-  $val = $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
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs