Cmake export tests: Set inputencoding to ascii if test with xetex and tex fonts.

This commit is contained in:
Kornel Benko 2015-11-10 13:01:49 +01:00
parent a8c1161d7b
commit c4ae71ceb2
3 changed files with 27 additions and 4 deletions

View File

@ -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);
}

View File

@ -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.

View File

@ -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 = <FI>) {
chomp($l);