commit 26788fdd9f92a07d7f1d8953d82d4de4b2f4ba58
Author: Kornel Benko <kor...@lyx.org>
Date:   Sat May 30 14:29:39 2020 +0200

    Tools(listFontWithLang.pl): Remove padmaa from sans-list, it is serif font
    
    Also display intervalls of character sets (unicode points)
---
 development/tools/GetOptions.pm       |   25 ++++++++++++++--------
 development/tools/listFontWithLang.pl |   37 +++++++++++++++++++++-----------
 2 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/development/tools/GetOptions.pm b/development/tools/GetOptions.pm
index 193e570..42e29ff 100644
--- a/development/tools/GetOptions.pm
+++ b/development/tools/GetOptions.pm
@@ -47,7 +47,7 @@ sub makeHelp();            # Create help-string to describe 
options
 
 my %optionsDef = ();
 #option|param|type|aliases|comment
-my $helpFormat = "  %-8s|%-9s|%-7s|%-17s|%s\n";
+my $helpFormat = "  %-8.8s|%-9.9s|%-7.7s|%-17.17s|%s\n";
 
 sub handleOptions($)
 {
@@ -66,6 +66,7 @@ sub handleOptions($)
   $optionsDef{h}->{Sort} = 0;
   $optionsDef{v}->{fieldname} = "verbose";
   $optionsDef{v}->{alias} = ["verbose"];
+  $optionsDef{v}->{comment} = "Display recognized params";
   $optionsDef{v}->{Sort} = 1;
 
   my %options = ("help" => 0);
@@ -75,15 +76,17 @@ sub handleOptions($)
   while( my( $option, $value, $pretty ) = Getopt::Mixed::nextOption()) {
     if (defined($optionsDef{$option})) {
       my $fieldname = $optionsDef{$option}->{fieldname};
-      if (exists($options{$fieldname})) {
+      if (exists($options{$fieldname}) && ($option ne "h")) {
        print "Option $option already set\n";
-       print "Value \"$value\" would overwrite ";
-       if (ref($options{$fieldname}) eq "ARRAY") {
-         print "\"" . join(',', @{$options{$fieldname}}) . "\"\n";
-       }
-       else {
-         print "\"$options{$fieldname}\"\n";
-       }
+        if (defined($options{$fieldname})) {
+          print "Value \"$value\" would overwrite ";
+          if (ref($options{$fieldname}) eq "ARRAY") {
+            print "\"" . join(',', @{$options{$fieldname}}) . "\"\n";
+          }
+          else {
+            print "\"$options{$fieldname}\"\n";
+          }
+        }
        $option = "h";
        $fieldname = "help";
       }
@@ -213,6 +216,10 @@ sub makeHelp()
       $comment = $e->{comment};
     }
     $opts .= sprintf($helpFormat, $ex, $needed, $partype, $aliases, $comment);
+    if (defined($e->{comment2})) {
+      my $fill = "_" x 20;
+      $opts .= sprintf($helpFormat, $fill, $fill, $fill, $fill, 
$e->{comment2});
+    }
   }
   return($opts);
 }
diff --git a/development/tools/listFontWithLang.pl 
b/development/tools/listFontWithLang.pl
index 5e19728..3fe4d2e 100644
--- a/development/tools/listFontWithLang.pl
+++ b/development/tools/listFontWithLang.pl
@@ -44,6 +44,7 @@ sub ismathfont($$);
 sub correctstyle($);
 sub decimalUnicode($);
 sub contains($$);
+sub sprintIntervalls($);
 
 # Following fields for a parameter can be defined:
 # fieldname:         Name of entry in %options
@@ -81,9 +82,10 @@ my @optionsDef = (
    {fieldname => "Math",
     comment => "Select fonts probably containing math glyphs"},],
   ["c",
-   {fieldname => "Contains",
+   {fieldname => "Contains",  alias => ["contains"],
     type => "=s", listsep => ',',
-    comment => "Select fonts containing all these (possibly comma separated) 
glyphs",}],
+    comment => "Select fonts containing all these (possibly comma separated) 
glyphs",
+    comment2 => "____example: -c=\"0-9,u+32-u+x7f\"",}],
   ["l",
    {fieldname => "Lang",
     type => "=s", alias=>["lang"],
@@ -148,6 +150,9 @@ if (defined($options{Contains})) {
   if (defined($last)) {
     push(@{$options{Contains}}, [$first, $last]);
   }
+  if (exists($options{verbose})) {
+    print "Checking for unicode-points: " . 
&sprintIntervalls($options{Contains}) . "\n";
+  }
 }
 
 my $cmd = "fc-list";
@@ -275,7 +280,7 @@ my %sansFonts = (
   "m" => qr/^m(\+ 
|anchu|anjari|arcellus|ashq|eera|etal|igmix|igu|ikachan|intspirit|ona|onlam|ono(fonto|id|isome|noki)|ontserrat|otoyal|ukti|usica)/i,
   "n" => qr/^(nachlieli|nada|nafees|nagham|nanum(barunpen|square)|nice)/i,
   "o" => qr/^(ocr|okolaks|opendyslexic|ostorah|ouhud|over|oxygen)/i,
-  "p" => 
qr/^(padauk|padmaa|pagul|paktype|pakenham|palladio|petra|phetsarath|play\b|poiret|port\b|primer\b|prociono|pt\b|purisa)/i,
+  "p" => 
qr/^(padauk|pagul|paktype|pakenham|palladio|petra|phetsarath|play\b|poiret|port\b|primer\b|prociono|pt\b|purisa)/i,
   "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,
@@ -440,16 +445,7 @@ if (open(FI,  "$cmd |")) {
       $props .= '(' . join(',', sort keys %usedlangs) . ')';
     }
     if (exists($options{PrintCharset})) {
-      my @out = ();
-      for my $rE (@charlist) {
-        if ($rE->[0] != $rE->[1]) {
-          push(@out, $rE->[0] . '-' . $rE->[1]);
-        }
-        else {
-          push(@out, $rE->[0]);
-        }
-      }
-      $props .= '(' . join(',', @out) . ')';
+      $props .= '(' . &sprintIntervalls(\@charlist) . ')';
     }
     if (exists($options{PrintScripts}) || defined($options{Scripts}) || 
defined($options{NScripts}) || exists($options{Math})) {
       my @scripts = ();
@@ -947,3 +943,18 @@ sub contains($$)
   }
   return 0;
 }
+
+sub sprintIntervalls($)
+{
+  my ($rList) = @_;
+  my @out = ();
+  for my $rE (@{$rList}) {
+    if ($rE->[0] != $rE->[1]) {
+      push(@out, $rE->[0] . '-' . $rE->[1]);
+    }
+    else {
+      push(@out, $rE->[0]);
+    }
+  }
+  return join(',', @out);
+}
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to