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

cherry-picked from 9982651fd6
This commit is contained in:
Juergen Spitzmueller 2019-01-12 17:40:19 +01:00
parent 434842563a
commit e27870db7a
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

@ -3283,7 +3283,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

@ -299,7 +299,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());
@ -977,7 +977,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());
@ -1384,8 +1384,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());
@ -1583,7 +1585,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);
@ -1655,7 +1657,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());