CJKutf8 is only to be used with the dedicated utf8-cjk encoding

This commit is contained in:
Juergen Spitzmueller 2019-01-09 08:29:41 +01:00
parent b9b9759776
commit 9982651fd6
3 changed files with 10 additions and 8 deletions

View File

@ -9,7 +9,7 @@
\maintain_unincluded_children false
\language korean
\language_package default
\inputencoding utf8
\inputencoding utf8-cjk
\fontencoding OT1
\font_roman "default" "NanumMyeongjo"
\font_sans "default" "NanumGothic"

View File

@ -3276,7 +3276,7 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
// 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 (encoding().iconvName() == "UTF-8"
if (language->encoding()->name() == "utf8-cjk"
&& LaTeXFeatures::isAvailable("CJKutf8"))
os << "\\usepackage{CJKutf8}\n";
else

View File

@ -307,7 +307,7 @@ static TeXEnvironmentData prepareEnvironment(Buffer const & buf,
if (data.par_language->encoding()->package() == Encoding::CJK &&
state->open_encoding_ != CJK && pit->isMultiLingual(bparams)) {
if (prev_par_language->encoding()->package() == Encoding::CJK) {
docstring const cjkenc = (bparams.encoding().iconvName() == "UTF-8"
docstring const cjkenc = (bparams.encoding().name() == "utf8-cjk"
&& LaTeXFeatures::isAvailable("CJKutf8")) ?
from_ascii("UTF8")
: from_ascii(data.par_language->encoding()->latexName());
@ -999,7 +999,7 @@ void TeXOnePar(Buffer const & buf,
// context (nesting issue).
if (par_language->encoding()->package() == Encoding::CJK
&& state->open_encoding_ != CJK && state->cjk_inherited_ == 0) {
docstring const cjkenc = (bparams.encoding().iconvName() == "UTF-8"
docstring const cjkenc = (bparams.encoding().name() == "utf8-cjk"
&& LaTeXFeatures::isAvailable("CJKutf8")) ?
from_ascii("UTF8")
: from_ascii(par_language->encoding()->latexName());
@ -1406,8 +1406,10 @@ void latexParagraphs(Buffer const & buf,
// (but not in child documents)
OutputState * state = getOutputState();
if (maintext && !is_child && !bparams.useNonTeXFonts
&& bparams.language->encoding()->package() == Encoding::CJK) {
docstring const cjkenc = (bparams.encoding().iconvName() == "UTF-8"
&& bparams.language->encoding()->package() == Encoding::CJK
&& (bparams.encoding().name() == "utf8-cjk"
|| bparams.encoding().iconvName() != "UTF-8")) {
docstring const cjkenc = (bparams.encoding().name() == "utf8-cjk"
&& LaTeXFeatures::isAvailable("CJKutf8")) ?
from_ascii("UTF8")
: from_ascii(bparams.encoding().latexName());
@ -1605,7 +1607,7 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
bool const from_to_cjk =
((oldEnc.package() == Encoding::CJK && newEnc.package() != Encoding::CJK)
|| (oldEnc.package() != Encoding::CJK && newEnc.package() == Encoding::CJK))
&& (bparams.inputenc != "utf8" && LaTeXFeatures::isAvailable("CJKutf8"));
&& (bparams.encoding().name() != "utf8-cjk" || !LaTeXFeatures::isAvailable("CJKutf8"));
if (!force && !from_to_cjk
&& ((bparams.inputenc != "auto" && bparams.inputenc != "default") || moving_arg))
return make_pair(false, 0);
@ -1677,7 +1679,7 @@ pair<bool, int> switchEncoding(odocstream & os, BufferParams const & bparams,
os << "\\egroup";
count += 7;
}
docstring const cjkenc = (bparams.encoding().iconvName() == "UTF-8"
docstring const cjkenc = (bparams.encoding().name() == "utf8-cjk"
&& LaTeXFeatures::isAvailable("CJKutf8")) ?
from_ascii("UTF8")
: from_ascii(bparams.encoding().latexName());