Load CJK support package before font selection.

This commit is contained in:
Günter Milde 2019-01-28 17:26:52 +01:00
parent 964c15f80b
commit 7da76b1b9f
3 changed files with 12 additions and 53 deletions

View 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.*

View 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

View 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";
}
}
}