From c4ae71ceb2cfbc3e8fb52cfbc8396a6309af5dbc Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Tue, 10 Nov 2015 13:01:49 +0100 Subject: [PATCH] Cmake export tests: Set inputencoding to ascii if test with xetex and tex fonts. --- development/autotests/lyxStatus.pm | 12 ++++++++++-- development/autotests/revertedTests | 2 +- development/autotests/useSystemFonts.pl | 17 ++++++++++++++++- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/development/autotests/lyxStatus.pm b/development/autotests/lyxStatus.pm index c9a45830d6..ef18c897bb 100644 --- a/development/autotests/lyxStatus.pm +++ b/development/autotests/lyxStatus.pm @@ -14,7 +14,7 @@ BEGIN { } # Prototypes -sub initLyxStack($$); +sub initLyxStack($$$); sub diestack($); sub closeLyxStack(); sub setMatching($); @@ -36,6 +36,7 @@ sub checkLyxLine($); my @stack = (); # list of HASH-Arrays my $rFont = {}; my $useNonTexFont = "true"; +my $inputEncoding = undef; # The elements are: # type (layout, inset, header, preamble, ...) @@ -49,7 +50,7 @@ my $useNonTexFont = "true"; # but first set the modified value into $result->[$fileidx] # numerical value will be replaced with appropriate matching group value -sub initLyxStack($$) +sub initLyxStack($$$) { $rFont = $_[0]; if ($_[1] eq "systemF") { @@ -57,6 +58,7 @@ sub initLyxStack($$) } else { $useNonTexFont = "false"; + $inputEncoding = $_[2]; } $stack[0] = { type => "Starting"}; } @@ -215,6 +217,12 @@ sub checkForHeader($) "filetype" => "replace_only", "result" => ["\\use_non_tex_fonts $useNonTexFont"]); push(@rElems, $elemntf); + if (defined($inputEncoding)) { + my $inputenc = newMatch("search" => '^\\\\inputencoding\s+(' . $inputEncoding->{search} . ')', + "filetype" => "replace_only", + "result" => ["\\inputencoding " . $inputEncoding->{out}]); + push(@rElems, $inputenc); + } setMatching(\@rElems); return(1); } diff --git a/development/autotests/revertedTests b/development/autotests/revertedTests index 5bb5a47fe7..18e482c589 100644 --- a/development/autotests/revertedTests +++ b/development/autotests/revertedTests @@ -76,7 +76,7 @@ export/examples/ko/splash_(dvi||pdf[23]?) export/templates/DocBook_article_(dvi3_|pdf2|pdf[45]_).* export/templates/JSS-article_(dvi|dvi3_.*|pdf3?) export/templates/attic/latex8_(dvi|dvi3_.*) -export/templates/ctex_pdf[23]? +export/templates/ctex_(pdf[23]?|pdf4_texF) export/templates/ja_.*(pdf[245]|dvi3).* # # The following exports worked with TeX Live 2013, but not in 2014. diff --git a/development/autotests/useSystemFonts.pl b/development/autotests/useSystemFonts.pl index ebd057ce10..01b8b05dd1 100644 --- a/development/autotests/useSystemFonts.pl +++ b/development/autotests/useSystemFonts.pl @@ -79,6 +79,7 @@ if ($source =~ /\/([a-z][a-z](_[A-Z][A-Z])?)[\/_]/) { $lang = $1; } +my $inputEncoding = undef; if ($fontT eq "systemF") { if ($lang =~ /^(ru|uk|sk)$/) { $font{roman} = "DejaVu Serif"; @@ -120,6 +121,20 @@ if ($fontT eq "systemF") { } else { # use tex font here + if ($format =~ /^(pdf4)$/) { # xelatex + # set input encoding to 'ascii' always + $inputEncoding = { + "search" => '.*', # this will be substituted from '\inputencoding'-line + "out" => "ascii", + }; + } + 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", + #}; + } } my $sourcedir = dirname($source); @@ -176,7 +191,7 @@ sub interpretedCopy($$$$) diestack("could not read \"$source\"") if (!open(FI, $source)); diestack("could not write \"$dest\"") if (! open(FO, '>', $dest)); - initLyxStack(\%font, $fontT); + initLyxStack(\%font, $fontT, $inputEncoding); while (my $l = ) { chomp($l); -- 2.39.2