Am 08.06.2012 05:16, schrieb Richard Heck:
I think the changes are quite straight forward. If possible I would like to
have it in for LyX
2.0.4. I'll now be away for about 2 weeks and cannot commit. So please commit
it if you agree with
the patch.
Hmm, the support for polyglossia is half-baked because the support for the variants are missing. So
the only really ready-for-2.0.4 part is the one I attached.
I'll work on the remaining polyglossia tex2lyx issues later.
regards Uwe
src/tex2lyx/Preamble.cpp | 27 +++++++++++++++++++++++++++
src/tex2lyx/Preamble.h | 1 +
2 files changed, 28 insertions(+)
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 8d2a111..4b9f1bc 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -407,6 +407,7 @@ Preamble::Preamble() : one_language(true), title_layout_found(false)
h_font_sf_scale = "100";
h_font_tt_scale = "100";
h_graphics = "default";
+ h_default_output_format = "default";
h_html_be_strict = "false";
h_html_css_as_file = "0";
h_html_math_output = "0";
@@ -680,6 +681,14 @@ void Preamble::handle_package(Parser &p, string const & name,
h_preamble << "\\usepackage{babel}\n";
}
+ else if (name == "polyglossia") {
+ h_language_package = "default";
+ h_use_non_tex_fonts = "true";
+ xetex = true;
+ if (h_inputencoding == "auto")
+ p.setEncoding("utf8");
+ }
+
else if (name == "fontenc") {
h_fontencoding = getStringFromVector(options, ",");
/* We could do the following for better round trip support,
@@ -1064,6 +1073,24 @@ void Preamble::parse(Parser & p, string const & forceclass,
else if (t.cs() == "pagestyle")
h_paperpagestyle = p.verbatim_item();
+ else if (t.cs() == "setmainfont") {
+ // we don't care about the option
+ p.hasOpt() ? p.getOpt() : string();
+ h_font_roman = p.getArg('{', '}');
+ }
+
+ else if (t.cs() == "setsansfont") {
+ // we don't care about the option
+ p.hasOpt() ? p.getOpt() : string();
+ h_font_sans = p.getArg('{', '}');
+ }
+
+ else if (t.cs() == "setmonofont") {
+ // we don't care about the option
+ p.hasOpt() ? p.getOpt() : string();
+ h_font_typewriter = p.getArg('{', '}');
+ }
+
else if (t.cs() == "date") {
string argument = p.getArg('{', '}');
if (argument.empty())
diff --git a/src/tex2lyx/Preamble.h b/src/tex2lyx/Preamble.h
index c116250..9b15a3f 100644
--- a/src/tex2lyx/Preamble.h
+++ b/src/tex2lyx/Preamble.h
@@ -103,6 +103,7 @@ private:
std::string h_font_sf_scale;
std::string h_font_tt_scale;
std::string h_graphics;
+ std::string h_default_output_format;
std::string h_html_be_strict;
std::string h_html_css_as_file;
std::string h_html_math_output;