mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
Cmake export tests: Try to use language dependent inputencoding.
This enables some more pdf5_texF und dvi3_texF tests to succeed.
This commit is contained in:
parent
c4ae71ceb2
commit
6dd98a8245
@ -28,6 +28,7 @@
|
||||
#
|
||||
|
||||
set(Perl_Script "${TOP_SRC_DIR}/development/autotests/useSystemFonts.pl")
|
||||
set(LanguageFile "${TOP_SRC_DIR}/lib/languages")
|
||||
set(GetTempDir "${TOP_SRC_DIR}/development/autotests/getTempDir.pl")
|
||||
set(_ft ${fonttype})
|
||||
execute_process(COMMAND ${PERL_EXECUTABLE} "${GetTempDir}" "${WORKDIR}" OUTPUT_VARIABLE TempDir)
|
||||
@ -38,7 +39,7 @@ if(format MATCHES "dvi3|pdf4|pdf5")
|
||||
set(LYX_SOURCE "${TempDir}/${file}_${format}_${_ft}.lyx")
|
||||
message(STATUS "Using source \"${LYX_ROOT}/${file}.lyx\"")
|
||||
message(STATUS "Using dest \"${LYX_SOURCE}\"")
|
||||
execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} ${_ft}
|
||||
execute_process(COMMAND ${PERL_EXECUTABLE} "${Perl_Script}" "${LYX_ROOT}/${file}.lyx" "${LYX_SOURCE}" ${format} ${_ft} ${LanguageFile}
|
||||
RESULT_VARIABLE _err)
|
||||
string(COMPARE EQUAL ${_err} 0 _erg)
|
||||
if(NOT _erg)
|
||||
|
@ -59,10 +59,13 @@ sub copyJobPending($$);
|
||||
sub addNewJob($$$$$);
|
||||
sub addFileCopyJob($$$$);
|
||||
sub getNewNameOf($$);
|
||||
sub getlangs($$);
|
||||
sub getLangEntry();
|
||||
|
||||
# convert lyx file to be compilable with xetex
|
||||
|
||||
my ($source, $dest, $format, $fontT, $rest) = @ARGV;
|
||||
my ($source, $dest, $format, $fontT, $languageFile, $rest) = @ARGV;
|
||||
my %encodings = (); # Encoding with TeX fonts, depending on language tag
|
||||
|
||||
diestack("Too many arguments") if (defined($rest));
|
||||
diestack("Sourcefilename not defined") if (! defined($source));
|
||||
@ -79,6 +82,8 @@ if ($source =~ /\/([a-z][a-z](_[A-Z][A-Z])?)[\/_]/) {
|
||||
$lang = $1;
|
||||
}
|
||||
|
||||
if (defined($languageFile)) {
|
||||
}
|
||||
my $inputEncoding = undef;
|
||||
if ($fontT eq "systemF") {
|
||||
if ($lang =~ /^(ru|uk|sk)$/) {
|
||||
@ -121,6 +126,10 @@ if ($fontT eq "systemF") {
|
||||
}
|
||||
else {
|
||||
# use tex font here
|
||||
my %encoding = ();
|
||||
if (defined($languageFile)) {
|
||||
&getlangs($languageFile, \%encoding);
|
||||
}
|
||||
if ($format =~ /^(pdf4)$/) { # xelatex
|
||||
# set input encoding to 'ascii' always
|
||||
$inputEncoding = {
|
||||
@ -130,10 +139,12 @@ else {
|
||||
}
|
||||
elsif ($format =~ /^(dvi3|pdf5)$/) { # (dvi)?lualatex
|
||||
# when to set input encoding to 'ascii'?
|
||||
#$inputEncoding = {
|
||||
# "search" => 'auto|default', # this will be substituted from '\inputencoding'-line
|
||||
# "out" => "ascii",
|
||||
#};
|
||||
if (defined($encoding{$lang})) {
|
||||
$inputEncoding = {
|
||||
"search" => 'auto|default', # this will be substituted from '\inputencoding'-line
|
||||
"out" => $encoding{$lang},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -396,3 +407,49 @@ sub getNewNameOf($$)
|
||||
}
|
||||
return($resultf);
|
||||
}
|
||||
|
||||
sub getlangs($$)
|
||||
{
|
||||
my ($languagefile, $rencoding) = @_;
|
||||
|
||||
if (open(FI, $languagefile)) {
|
||||
while (my $l = <FI>) {
|
||||
if ($l =~ /^Language/) {
|
||||
my ($lng, $enc) = &getLangEntry();
|
||||
if (defined($lng)) {
|
||||
my @tag = split('_', $lng);
|
||||
if ($tag[0] eq lc($tag[1])) {
|
||||
$lng = $tag[0];
|
||||
}
|
||||
if (! defined($rencoding->{$lng})) {
|
||||
$rencoding->{$lng} = $enc;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
close(FI);
|
||||
}
|
||||
}
|
||||
|
||||
sub getLangEntry()
|
||||
{
|
||||
my ($lng, $enc) = (undef, undef);
|
||||
while (my $l = <FI>) {
|
||||
chomp($l);
|
||||
if ($l =~ /^\s*Encoding\s+([^ ]+)\s*$/) {
|
||||
$enc = $1;
|
||||
}
|
||||
elsif ($l =~ /^\s*LangCode\s+([^ ]+)\s*$/) {
|
||||
$lng = $1;
|
||||
}
|
||||
elsif ($l =~ /^\s*End\s*$/) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
if (defined($lng) && defined($enc)) {
|
||||
return($lng, $enc);
|
||||
}
|
||||
else {
|
||||
return(undef, undef);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user