X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=development%2Ftools%2FlistFontWithLang.pl;h=2ae732c4fe3ae55e3907844d46ee733e0ffa21ec;hb=be4f5c8084019bfdd7d067a8c18c960b823df3f7;hp=de27c1b064281001e0724ac7ee9b692c0ada7936;hpb=a1713d9d35b5efcda9d144b89d63d43cb6639b86;p=lyx.git diff --git a/development/tools/listFontWithLang.pl b/development/tools/listFontWithLang.pl index de27c1b064..2ae732c4fe 100644 --- a/development/tools/listFontWithLang.pl +++ b/development/tools/listFontWithLang.pl @@ -239,6 +239,27 @@ 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}}) { + 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 $cmd = "fc-list"; if (defined($langs[0])) { $cmd .= " :lang=" . join(',', @langs); @@ -522,12 +543,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 = ();