[LyX/master] Amend 3dccce14: Tools(listFontWithLang.pl): Ignore white space while checking font name

Kornel Benko kornel at lyx.org
Sun Aug 23 06:00:24 UTC 2020


commit be4f5c8084019bfdd7d067a8c18c960b823df3f7
Author: Kornel Benko <kornel at lyx.org>
Date:   Sun Aug 23 08:21:53 2020 +0200

    Amend 3dccce14: Tools(listFontWithLang.pl): Ignore white space while checking font name
    
    Do not manipulate search strings which already contain regex elements.
---
 development/tools/listFontWithLang.pl |   21 +++++++++++----------
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/development/tools/listFontWithLang.pl b/development/tools/listFontWithLang.pl
index 64beba8..2ae732c 100644
--- a/development/tools/listFontWithLang.pl
+++ b/development/tools/listFontWithLang.pl
@@ -244,17 +244,18 @@ for my $fn ("FontName", "NFontName") {
     # split each entry and make a compiled regex
     # Allow space between all characters
     for my $e (@{$options{$fn}}) {
-      my $u = decode('utf-8', $e);
-      my $fill = decode('utf-8', "\\s?");
-      my @u = split(//, $u);
-      my @ud = ();
-      for my $c (@u) {
-        push(@ud, $c, $fill);
+      if ($e =~ /(\^|\\|\||\[|\]|\(|\)|\*|\+|\?)/) {
+        # already regex, don't manipulate
+        $e = qr/$e/i;
+      }
+      else {
+        my $u = decode('utf-8', $e);
+        my $fill = decode('utf-8', "\\s?");
+        my @u = split(//, $u);
+        my $ud = join($fill, @u);
+        my $e1 = encode('utf-8', $ud);
+        $e = qr/$e1/i;
       }
-      my $ud = join('', @ud);
-      my $e1 = encode('utf-8', $ud);
-      $e1 =~ s/\\s\?$//;
-      $e = qr/$e1/i;
     }
   }
 }


More information about the lyx-cvs mailing list