diff --git a/development/FORMAT b/development/FORMAT index 8104cac63f..9d8e4865c9 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -1,6 +1,10 @@ LyX file-format changes ----------------------- +2007-05-04 Jürgen Spitzmüller + + * format incremented to 267: add plain utf8 encoding (for XeTeX). + 2007-04-29 Uwe Stöhr * format incremented to 266: diff --git a/lib/encodings b/lib/encodings index 866d5cb732..b67b330999 100644 --- a/lib/encodings +++ b/lib/encodings @@ -16,6 +16,11 @@ End Encoding utf8x utf8x UTF-8 End +# A plain utf8 encoding that does not use the inputenc package. +# Such an encoding is required for XeTeX. +Encoding utf8-plain utf8-plain UTF-8 +End + # This encoding is used to typeset Armenian using the armtex package Encoding armscii8 armscii8 ARMSCII-8 End diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 8914029d57..d25b681cc4 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -74,7 +74,7 @@ format_relation = [("0_06", [200], generate_minor_versions("0.6" , 4)), ("1_2", [220], generate_minor_versions("1.2" , 4)), ("1_3", [221], generate_minor_versions("1.3" , 7)), ("1_4", range(222,246), generate_minor_versions("1.4" , 4)), - ("1_5", range(246,267), generate_minor_versions("1.5" , 0))] + ("1_5", range(246,268), generate_minor_versions("1.5" , 0))] def formats_list(): diff --git a/lib/lyx2lyx/lyx_1_5.py b/lib/lyx2lyx/lyx_1_5.py index bc7988cfc6..ec4a125e94 100644 --- a/lib/lyx2lyx/lyx_1_5.py +++ b/lib/lyx2lyx/lyx_1_5.py @@ -1198,6 +1198,18 @@ def revert_utf8x(document): document.inputencoding = get_value(document.header, "\\inputencoding", 0) +def revert_utf8plain(document): + " Set utf8plain encoding to utf8. " + i = find_token(document.header, "\\inputencoding", 0) + if i == -1: + document.header.append("\\inputencoding auto") + else: + inputenc = get_value(document.header, "\\inputencoding", i) + if inputenc == "utf8-plain": + document.header[i] = "\\inputencoding utf8" + document.inputencoding = get_value(document.header, "\\inputencoding", 0) + + def convert_changes(document): " Switch output_changes off if tracking_changes is off. " i = find_token(document.header, '\\tracking_changes', 0) @@ -1338,9 +1350,11 @@ convert = [[246, []], [263, [normalize_language_name]], [264, [convert_cv_textclass]], [265, [convert_tableborder]], - [266, []]] + [266, []], + [267, []]] -revert = [[265, [revert_armenian]], +revert = [[266, [revert_utf8plain]], + [265, [revert_armenian]], [264, [revert_tableborder]], [263, [revert_cv_textclass]], [262, [revert_language_name]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 850882d958..e7a5d41bd7 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -141,7 +141,7 @@ using std::string; namespace { -int const LYX_FORMAT = 266; +int const LYX_FORMAT = 267; } // namespace anon diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 3ba80c50aa..052da14fd4 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -898,7 +898,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, // thailatex does not use the inputenc package, but sets up // babel directly for tis620-0 encoding, therefore we must // not request inputenc for tis620-0 encoding - if (!encodings.empty() || doc_encoding != "tis620-0") { + if (!encodings.empty() && doc_encoding != "tis620-0") { os << "\\usepackage["; std::set::const_iterator it = encodings.begin(); std::set::const_iterator const end = encodings.end(); @@ -916,8 +916,9 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features, os << "]{inputenc}\n"; texrow.newline(); } + // utf8-plain is for XeTeX users (inputenc not desired) } else if (inputenc != "default" && inputenc != "tis620-0" && - inputenc != "ascii") { + inputenc != "ascii" && inputenc != "utf8-plain") { os << "\\usepackage[" << from_ascii(inputenc) << "]{inputenc}\n"; texrow.newline();