]> git.lyx.org Git - lyx.git/blobdiff - development/autotests/lyxStatus.pm
Cmake export tests: Set inputencoding to ascii if test with xetex and tex fonts.
[lyx.git] / development / autotests / lyxStatus.pm
index 8a031840e9d070299638c8f7cb13397f39ebd36f..ef18c897bb2854ada818ed5eedcd5075d71f1f5b 100644 (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"};
 }
@@ -196,16 +198,31 @@ sub checkForHeader($)
                           "result" => ["\\master ", ""]);
     if (keys %{$rFont}) {
       for my $ff ( keys %{$rFont}) {
-       my $elem = newMatch("search" => '^\\\\font_' . $ff . '\s+',
+       # fontentry of type '\font_roman default'
+       my $elem = newMatch("search" => '^\\\\font_' . $ff . '\s+[^"]*\s*$',
                             "filetype" => "replace_only",
                             "result" => ["\\font_$ff ", $rFont->{$ff}]);
-       push(@rElems, $elem);
+       # fontentry of type '\font_roman "default"'
+       my $elem1 = newMatch("search" => '^\\\\font_' . $ff . '\s+"[^"]*"\s*$',
+                            "filetype" => "replace_only",
+                            "result" => ["\\font_$ff \"", $rFont->{$ff}, '"']);
+       # fontentry of type '\font_roman "default" "default"'
+       my $elem2 = newMatch("search" => '^\\\\font_' . $ff . '\s+"(.*)"\s+"(.*)"\s*$',
+                            "filetype" => "replace_only",
+                            "result" => ["\\font_$ff ", '"', "1", '" "', $rFont->{$ff}, '"']);
+       push(@rElems, $elem, $elem1, $elem2);
       }
     }
     my $elemntf = newMatch("search" => '^\\\\use_non_tex_fonts\s+(false|true)',
                            "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);
   }