mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Tools(listFontWithLang.pl): Handle also fonts provided by lyx
These fonts are normally not handled by fontconfig
This commit is contained in:
parent
5c83c5c410
commit
a45f539bb5
@ -30,6 +30,11 @@ BEGIN {
|
||||
unshift(@INC, $p);
|
||||
}
|
||||
|
||||
my $lyxfontsdir = $INC[0];
|
||||
$lyxfontsdir =~ s/[\/\\]?[^\/\\]+$//;
|
||||
$lyxfontsdir =~ s/[\/\\]?[^\/\\]+$//;
|
||||
$lyxfontsdir .= "/lib/fonts";
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Encode;
|
||||
@ -260,32 +265,48 @@ for my $fn ("FontName", "NFontName") {
|
||||
}
|
||||
}
|
||||
|
||||
my $cmd = "fc-list";
|
||||
if (defined($langs[0])) {
|
||||
$cmd .= " :lang=" . join(',', @langs);
|
||||
}
|
||||
my @cmds = ();
|
||||
{
|
||||
my $cmd = "fc-list";
|
||||
my $langs = "";
|
||||
if (defined($langs[0])) {
|
||||
$langs = " :lang=" . join(',', @langs) . " ";
|
||||
}
|
||||
|
||||
my $format = "foundry=\"%{foundry}\"" .
|
||||
my $format = "foundry=\"%{foundry}\"" .
|
||||
" postscriptname=\"%{postscriptname}\"" .
|
||||
" fn=\"%{fullname}\" fnl=\"%{fullnamelang}\"" .
|
||||
" family=\"%{family}\" flang=\"%{familylang}\" " .
|
||||
" style=\"%{style}\" stylelang=\"%{stylelang}\"";
|
||||
|
||||
if ($iscript) {
|
||||
if ($iscript) {
|
||||
$format .= " script=\"%{capability}\"";
|
||||
}
|
||||
if (exists($options{PrintLangs}) || defined($langs[0])) {
|
||||
}
|
||||
if (exists($options{PrintLangs}) || defined($langs[0])) {
|
||||
$format .= " lang=\"%{lang}\"";
|
||||
}
|
||||
if ($iproperty) {
|
||||
}
|
||||
if ($iproperty) {
|
||||
$format .= " weight=%{weight} slant=%{slant} width=%{width} spacing=%{spacing}";
|
||||
}
|
||||
if ($icontains) {
|
||||
}
|
||||
if ($icontains) {
|
||||
$format .= " charset=\"%{charset}\"";
|
||||
}
|
||||
$format .= " file=\"%{file}\" abcd\\n";
|
||||
$cmd .= $langs . " -f '$format'";
|
||||
push(@cmds, $cmd);
|
||||
|
||||
# Now Add also lyx fonts to be examinated
|
||||
if (opendir(DI, "$lyxfontsdir")) {
|
||||
while (my $l = readdir(DI)) {
|
||||
chomp($l);
|
||||
if ($l =~ /\.ttf$/) {
|
||||
my $file = "$lyxfontsdir/$l";
|
||||
push(@cmds, "fc-query$langs -f '$format' '$file'");
|
||||
}
|
||||
}
|
||||
closedir(DI);
|
||||
}
|
||||
}
|
||||
$format .= " file=\"%{file}\" abcd\\n";
|
||||
$cmd .= " -f '$format'";
|
||||
#print "$cmd\n";
|
||||
|
||||
|
||||
my %ftypes = (
|
||||
@ -496,7 +517,8 @@ my %smallcapFonts = (
|
||||
"v" => qr/^vn ?cccsc\d/i,
|
||||
);
|
||||
|
||||
if (open(FI, "$cmd |")) {
|
||||
for my $cmd (@cmds) {
|
||||
if (open(FI, "$cmd |")) {
|
||||
NXTLINE: while (my $l = <FI>) {
|
||||
chomp($l);
|
||||
while ($l !~ /abcd$/) {
|
||||
@ -666,6 +688,7 @@ if (open(FI, "$cmd |")) {
|
||||
$collectedfonts{$fontname}->{$foundry}->{fonttype} = $fonttype;
|
||||
}
|
||||
close(FI);
|
||||
}
|
||||
}
|
||||
|
||||
for my $fontname (sort keys %collectedfonts) {
|
||||
|
Loading…
Reference in New Issue
Block a user