[LyX/master] Tools(listFontWithLang.pl): Ignore white space while checking font name
Kornel Benko
kornel at lyx.org
Sat Aug 22 13:57:04 UTC 2020
commit 3dccce1411f644a67393d5805ade0c34c7fc0041
Author: Kornel Benko <kornel at lyx.org>
Date: Sat Aug 22 16:20:22 2020 +0200
Tools(listFontWithLang.pl): Ignore white space while checking font name
This allows for instance to find 'Deja Vu' also if searching for 'dejavu'
---
development/tools/listFontWithLang.pl | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/development/tools/listFontWithLang.pl b/development/tools/listFontWithLang.pl
index de27c1b..64beba8 100644
--- a/development/tools/listFontWithLang.pl
+++ b/development/tools/listFontWithLang.pl
@@ -239,6 +239,26 @@ for my $charFld ("Contains", "NContains") {
}
}
+for my $fn ("FontName", "NFontName") {
+ if (defined($options{$fn})) {
+ # 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);
+ }
+ my $ud = join('', @ud);
+ my $e1 = encode('utf-8', $ud);
+ $e1 =~ s/\\s\?$//;
+ $e = qr/$e1/i;
+ }
+ }
+}
+
my $cmd = "fc-list";
if (defined($langs[0])) {
$cmd .= " :lang=" . join(',', @langs);
@@ -522,12 +542,12 @@ if (open(FI, "$cmd |")) {
($fontname, $style) = &buildFontName($family, $style);
if (defined($options{NFontName})) {
for my $fn (@{$options{NFontName}}) {
- next NXTLINE if ($fontname =~ /$fn/i);
+ next NXTLINE if ($fontname =~ $fn);
}
}
if (defined($options{FontName})) {
for my $fn (@{$options{FontName}}) {
- next NXTLINE if ($fontname !~ /$fn/i);
+ next NXTLINE if ($fontname !~ $fn);
}
}
my @charlist = ();
More information about the lyx-cvs
mailing list