]> git.lyx.org Git - features.git/commitdiff
Better support for (Lua|Xe)TeX files in tex2lyx
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 26 Mar 2012 14:04:09 +0000 (16:04 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 26 Mar 2012 14:10:31 +0000 (16:10 +0200)
When one of the packages specific to these engines are used in the TeX file:
* set default encoding to utf-8
* set \use_non_tex_fonts to true

This is a hand-made backport of svn commit r40765.

src/tex2lyx/Preamble.cpp
src/tex2lyx/Preamble.h
status.20x

index faa7667ad586a2b8c14cd223b09a757ade5111cc..891817b4a254d0d0572e8edffb096568f234d391 100644 (file)
@@ -401,6 +401,7 @@ Preamble::Preamble() : one_language(true)
        h_font_sans               = "default";
        h_font_typewriter         = "default";
        h_font_default_family     = "default";
+       h_use_non_tex_fonts       = "false";
        h_font_sc                 = "false";
        h_font_osf                = "false";
        h_font_sf_scale           = "100";
@@ -581,8 +582,12 @@ void Preamble::handle_package(Parser &p, string const & name,
        add_package(name, options);
        string scale;
 
-       if (is_known(name, known_xetex_packages))
+       if (is_known(name, known_xetex_packages)) {
                xetex = true;
+               h_use_non_tex_fonts = "true";
+               if (h_inputencoding == "auto")
+                       p.setEncoding("utf8");
+       }
 
        // roman fonts
        if (is_known(name, known_roman_fonts)) {
@@ -903,6 +908,7 @@ bool Preamble::writeLyXHeader(ostream & os, bool subdoc)
           << "\\font_sans " << h_font_sans << "\n"
           << "\\font_typewriter " << h_font_typewriter << "\n"
           << "\\font_default_family " << h_font_default_family << "\n"
+          << "\\use_non_tex_fonts " << h_use_non_tex_fonts << "\n"
           << "\\font_sc " << h_font_sc << "\n"
           << "\\font_osf " << h_font_osf << "\n"
           << "\\font_sf_scale " << h_font_sf_scale << "\n"
index a4af4db931ae49f48bd0094bbd8d59c4f1ae30f3..c2739a08e9f3cca581891b9e6b1658d8e305a1b3 100644 (file)
@@ -90,6 +90,7 @@ private:
        std::string h_font_sans;
        std::string h_font_typewriter;
        std::string h_font_default_family;
+       std::string h_use_non_tex_fonts;
        std::string h_font_sc;
        std::string h_font_osf;
        std::string h_font_sf_scale;
index 2ac34bf98412171401824914dfd1e82e58eb939a..7c82ee21f2de5e82f844d3f6ab3d60ef671c5996 100644 (file)
@@ -30,6 +30,8 @@ What's new
 * TEX2LYX IMPROVEMENTS
 
 - Support for the LaTeX-command \sindex (for split indexes).
+- Better support for XeTeX and LuaTeX documents: automatically set default
+  encoding to utf-8 and select support for non-TeX fonts.
 
 
 * USER INTERFACE