Use CJKutf8 package if input encoding is "utf8" and a used language requires CJK.

CJKutf8 now used also if a secondary language requires CJK.
This commit is contained in:
Günter Milde 2019-03-13 11:31:25 +01:00
parent 0f265a5ab6
commit 4a481975b6
5 changed files with 13 additions and 13 deletions

View File

@ -69,11 +69,6 @@ export/examples/(|es/)modernCV_lyx(16|20)
export/export/latex/fa-OT1_pdf2
# CJK for multilingual documents:
#
# input-encoding "utf8" should work for documents using a CJK language
# also if the main language does not require CJK:
export/export/latex/CJK/en-de-el-ru-.*_utf8_pdf2
#
# some "language default" legacy encodings fail (missing fonts)
export/export/latex/CJK/ko_default_pdf2

View File

@ -1851,8 +1851,10 @@ Buffer::ExportStatus Buffer::writeLaTeXSource(otexstream & os,
LaTeXFeatures features(*this, params(), runparams);
validate(features);
// This is only set once per document (in master)
if (!runparams.is_child)
if (!runparams.is_child) {
runparams.use_polyglossia = features.usePolyglossia();
runparams.use_CJK = features.mustProvide("CJK");
}
LYXERR(Debug::LATEX, " Buffer validation done.");
bool const output_preamble =

View File

@ -20,8 +20,9 @@ namespace lyx {
OutputParams::OutputParams(Encoding const * enc)
: flavor(LATEX), math_flavor(NotApplicable), nice(false), is_child(false),
moving_arg(false), intitle(false), inulemcmd(0), local_font(0), master_language(0),
encoding(enc), free_spacing(false), use_babel(false), use_polyglossia(false),
moving_arg(false), intitle(false), inulemcmd(0), local_font(0),
master_language(0), encoding(enc), free_spacing(false),
use_babel(false), use_polyglossia(false), use_CJK(false),
use_indices(false), use_japanese(false), linelen(0), depth(0),
exportdata(new ExportData), inDisplayMath(false), wasDisplayMath(false),
inComment(false), openbtUnit(false), only_childbibs(false),
@ -38,6 +39,8 @@ OutputParams::OutputParams(Encoding const * enc)
// OutputParams runparams(0);
if (enc && enc->package() == Encoding::japanese)
use_japanese = true;
if (enc && enc->package() == Encoding::CJK)
use_CJK = true;
}

View File

@ -159,6 +159,9 @@ public:
*/
bool use_polyglossia;
/// Do we use the CJK package?
bool use_CJK;
/** Are we generating multiple indices?
*/
bool use_indices;

View File

@ -1417,11 +1417,8 @@ void latexParagraphs(Buffer const & buf,
if (maintext && !is_child && !bparams.useNonTeXFonts
&& (bparams.encoding().package() == Encoding::CJK
|| (bparams.encoding().name() == "utf8"
&& bparams.language->encoding()->package() == Encoding::CJK)
// FIXME: should test if any language requires CJK
// && LaTeXFeatures::mustProvide("CJK"))
// error: cannot call member function bool lyx::LaTeXFeatures::mustProvide(const string&) const without object
)) {
&& runparams.use_CJK))
) {
docstring const cjkenc = bparams.encoding().iconvName() == "UTF-8"
? from_ascii("UTF8") : from_ascii(bparams.encoding().latexName());
os << "\\begin{CJK}{" << cjkenc