]> git.lyx.org Git - lyx.git/commitdiff
Load CJK support package before font selection.
authorGünter Milde <milde@lyx.org>
Mon, 28 Jan 2019 16:26:52 +0000 (17:26 +0100)
committerGünter Milde <milde@lyx.org>
Mon, 28 Jan 2019 16:26:52 +0000 (17:26 +0100)
development/autotests/unreliableTests
lib/examples/ja/multilingual.lyx
src/BufferParams.cpp

index c5b8e6e38520d0213d769db0f2ddf90e86750837..189a0182c7ccdcd12dc370b58dfdd4675238e4fb 100644 (file)
@@ -121,10 +121,6 @@ export/templates/acmart_pdf
 # the name of the day in English instead of Japanese.
 export/examples/ja/multilingual_lyx.*
 
-# CJKutf8 uses $\mu$ for \textmu unless overwritten by textcomp.
-# libertine loads textcomp and is loaded before CJKutf8
-export/export/latex/CJK/micro-sign_utf8-cjk_libertine.*
-
 # No localization of auto-strings with Chinese language:
 export/export/latex/CJK/zh_CN-toc.*
 
index 4c83cacbe8d09b190adaec5b6160d4adef1be885..072465d25e99002902c8a38393a561786c87d961 100644 (file)
@@ -219,32 +219,6 @@ Then, the following should work:
 \begin_layout Enumerate
 Short texts may be written without setting the language (hyphenation will
  be missing and spell-checking complain): Greetings; Grüße; Приветы; χαιρετισμός
-\lang greek
-
-\begin_inset Foot
-status open
-
-\begin_layout Plain Layout
-
-\lang english
-CJKutf8 (4.8.4) maps the Greek letter 
-\lang greek
-\lang english
- to a mathematical (italic) symbol 
-\begin_inset Formula $\mu$
-\end_inset
-
- unless the package 
-\family typewriter
-textcomp
-\family default
- is loaded.
-\end_layout
-
-\end_inset
-
-
 \end_layout
 
 \begin_layout Enumerate
index 7b2c0886a14e589f670fd7a1ccce62e93333663e..57c75762ede36a71d213fb316476b9a3b6306d22 100644 (file)
@@ -1745,6 +1745,17 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                        os << "\\usepackage{unicode-math}\n";
        }
 
+       // load CJK support package before font selection
+       // (see autotests/export/latex/CJK/micro-sign_utf8-cjk-libertine.lyx)
+       if (!useNonTeXFonts && encoding().package() != Encoding::none
+               && (encoding().package() == Encoding::CJK || features.mustProvide("CJK"))) {
+               if (encoding().iconvName() == "UTF-8"
+                       && LaTeXFeatures::isAvailable("CJKutf8"))
+                       os << "\\usepackage{CJKutf8}\n";
+               else
+                       os << "\\usepackage[encapsulated]{CJK}\n";
+       }
+
        // font selection must be done before loading fontenc.sty
        string const fonts = loadFonts(features);
        if (!fonts.empty())
@@ -3240,16 +3251,10 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                        else
                                os << "]{inputenc}\n";
                }
-               if (package == Encoding::CJK || features.mustProvide("CJK")) {
-                       if (language->encoding()->name() == "utf8-cjk"
-                           && LaTeXFeatures::isAvailable("CJKutf8"))
-                               os << "\\usepackage{CJKutf8}\n";
-                       else
-                               os << "\\usepackage{CJK}\n";
-               }
        } else if (inputenc != "default") {
                switch (encoding().package()) {
                case Encoding::none:
+               case Encoding::CJK:
                case Encoding::japanese:
                        break;
                case Encoding::inputenc:
@@ -3265,22 +3270,6 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                        else
                                os << "]{inputenc}\n";
                        break;
-               case Encoding::CJK:
-                       if (encoding().name() == "utf8-cjk"
-                           && LaTeXFeatures::isAvailable("CJKutf8"))
-                               os << "\\usepackage{CJKutf8}\n";
-                       else
-                               os << "\\usepackage{CJK}\n";
-                       break;
-               }
-               // Load the CJK package if needed by a secondary language.
-               // If the main encoding is some variant of UTF8, use CJKutf8.
-               if (encoding().package() != Encoding::CJK && features.mustProvide("CJK")) {
-                       if (language->encoding()->name() == "utf8-cjk"
-                           && LaTeXFeatures::isAvailable("CJKutf8"))
-                               os << "\\usepackage{CJKutf8}\n";
-                       else
-                               os << "\\usepackage{CJK}\n";
                }
        }
 }