mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
CJK package is never used with non-TeX fonts.
Prepare for languages that use CJK with TeX fonts and Polyglossia with non-TeX fonts. Korean is already supported by Polyglossia, LyX support will follow (file version change).
This commit is contained in:
parent
45c5b39692
commit
c83765163f
@ -526,7 +526,8 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams,
|
|||||||
|
|
||||||
if (closeLanguage
|
if (closeLanguage
|
||||||
&& language() != base.language() && language() != next.language()
|
&& language() != base.language() && language() != next.language()
|
||||||
&& language()->encoding()->package() != Encoding::CJK) {
|
&& (language()->encoding()->package() != Encoding::CJK
|
||||||
|
|| bparams.useNonTeXFonts)) {
|
||||||
os << '}';
|
os << '}';
|
||||||
++count;
|
++count;
|
||||||
bool const using_begin_end =
|
bool const using_begin_end =
|
||||||
|
@ -2542,22 +2542,16 @@ void Paragraph::latex(BufferParams const & bparams,
|
|||||||
open_font = false;
|
open_font = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
string const running_lang = runparams.use_polyglossia ?
|
// if necessary, close language environment before opening CJK
|
||||||
running_font.language()->polyglossia() : running_font.language()->babel();
|
string const running_lang = running_font.language()->babel();
|
||||||
// close babel's font environment before opening CJK.
|
string const lang_end_command = lyxrc.language_command_end;
|
||||||
string const lang_end_command = runparams.use_polyglossia ?
|
if (!lang_end_command.empty() && !bparams.useNonTeXFonts
|
||||||
"\\end{$$lang}" : lyxrc.language_command_end;
|
&& !running_lang.empty()
|
||||||
bool const using_begin_end = runparams.use_polyglossia ||
|
&& running_lang == openLanguageName()
|
||||||
!lang_end_command.empty();
|
&& current_font.language()->encoding()->package() == Encoding::CJK) {
|
||||||
if (!running_lang.empty() &&
|
string end_tag = subst(lang_end_command, "$$lang", running_lang);
|
||||||
(!using_begin_end || running_lang == openLanguageName()) &&
|
|
||||||
current_font.language()->encoding()->package() == Encoding::CJK) {
|
|
||||||
string end_tag = subst(lang_end_command,
|
|
||||||
"$$lang",
|
|
||||||
running_lang);
|
|
||||||
os << from_ascii(end_tag);
|
os << from_ascii(end_tag);
|
||||||
column += end_tag.length();
|
column += end_tag.length();
|
||||||
if (using_begin_end)
|
|
||||||
popLanguageName();
|
popLanguageName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -959,10 +959,10 @@ GuiDocument::GuiDocument(GuiView & lv)
|
|||||||
langModule->languageCO->setModel(language_model);
|
langModule->languageCO->setModel(language_model);
|
||||||
langModule->languageCO->setModelColumn(0);
|
langModule->languageCO->setModelColumn(0);
|
||||||
|
|
||||||
langModule->encodingCO->addItem(qt_("Unicode (utf8) [default]"), toqstr("utf8"));
|
langModule->encodingCO->addItem(qt_("Unicode (utf8)"), toqstr("utf8"));
|
||||||
langModule->encodingCO->addItem(qt_("Traditional (auto-selected)"),
|
langModule->encodingCO->addItem(qt_("Traditional (auto-selected)"),
|
||||||
toqstr("auto-legacy"));
|
toqstr("auto-legacy"));
|
||||||
langModule->encodingCO->addItem(qt_("ASCII"), toqstr("ascii"));
|
// langModule->encodingCO->addItem(qt_("ASCII"), toqstr("ascii"));
|
||||||
langModule->encodingCO->addItem(qt_("Custom"), toqstr("custom"));
|
langModule->encodingCO->addItem(qt_("Custom"), toqstr("custom"));
|
||||||
|
|
||||||
QMap<QString,QString> encodingmap;
|
QMap<QString,QString> encodingmap;
|
||||||
@ -2190,7 +2190,8 @@ void GuiDocument::languageChanged(int i)
|
|||||||
// some languages only work with Polyglossia
|
// some languages only work with Polyglossia
|
||||||
Language const * lang = lyx::languages.getLanguage(
|
Language const * lang = lyx::languages.getLanguage(
|
||||||
fromqstr(langModule->languageCO->itemData(i).toString()));
|
fromqstr(langModule->languageCO->itemData(i).toString()));
|
||||||
if (lang->babel().empty() && !lang->polyglossia().empty()) {
|
if (lang->babel().empty() && !lang->polyglossia().empty()
|
||||||
|
&& lang->requires() != "CJK" && lang->requires() != "japanese") {
|
||||||
// If we force to switch fontspec on, store
|
// If we force to switch fontspec on, store
|
||||||
// current state (#8717)
|
// current state (#8717)
|
||||||
if (fontModule->osFontsCB->isEnabled())
|
if (fontModule->osFontsCB->isEnabled())
|
||||||
@ -4031,7 +4032,8 @@ void GuiDocument::paramsToDialog()
|
|||||||
fromqstr(langModule->languageCO->itemData(
|
fromqstr(langModule->languageCO->itemData(
|
||||||
langModule->languageCO->currentIndex()).toString()));
|
langModule->languageCO->currentIndex()).toString()));
|
||||||
bool const need_fontspec =
|
bool const need_fontspec =
|
||||||
lang->babel().empty() && !lang->polyglossia().empty();
|
lang->babel().empty() && !lang->polyglossia().empty()
|
||||||
|
&& lang->requires() != "CJK" && lang->requires() != "japanese";
|
||||||
bool const os_fonts_available =
|
bool const os_fonts_available =
|
||||||
bp_.baseClass()->outputType() == lyx::LATEX
|
bp_.baseClass()->outputType() == lyx::LATEX
|
||||||
&& LaTeXFeatures::isAvailable("fontspec");
|
&& LaTeXFeatures::isAvailable("fontspec");
|
||||||
|
@ -967,7 +967,9 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
os << "\\L{";
|
os << "\\L{";
|
||||||
}
|
}
|
||||||
// With CJK, the CJK tag has to be closed first (see below)
|
// With CJK, the CJK tag has to be closed first (see below)
|
||||||
if ((runparams.encoding->package() != Encoding::CJK || runparams.for_search)
|
if ((runparams.encoding->package() != Encoding::CJK
|
||||||
|
|| bparams.useNonTeXFonts
|
||||||
|
|| runparams.for_search)
|
||||||
&& (par_lang != openLanguageName(state) || localswitch)
|
&& (par_lang != openLanguageName(state) || localswitch)
|
||||||
&& !par_lang.empty()) {
|
&& !par_lang.empty()) {
|
||||||
string bc = use_polyglossia ?
|
string bc = use_polyglossia ?
|
||||||
@ -1202,7 +1204,9 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
os << '\n';
|
os << '\n';
|
||||||
|
|
||||||
// when the paragraph uses CJK, the language has to be closed earlier
|
// when the paragraph uses CJK, the language has to be closed earlier
|
||||||
if ((font.language()->encoding()->package() != Encoding::CJK) || runparams_in.for_search) {
|
if ((font.language()->encoding()->package() != Encoding::CJK)
|
||||||
|
|| bparams.useNonTeXFonts
|
||||||
|
|| runparams_in.for_search) {
|
||||||
if (lang_end_command.empty()) {
|
if (lang_end_command.empty()) {
|
||||||
// If this is a child, we should restore the
|
// If this is a child, we should restore the
|
||||||
// master language after the last paragraph.
|
// master language after the last paragraph.
|
||||||
@ -1294,9 +1298,9 @@ void TeXOnePar(Buffer const & buf,
|
|||||||
|
|
||||||
// if this is a CJK-paragraph and the next isn't, close CJK
|
// if this is a CJK-paragraph and the next isn't, close CJK
|
||||||
// also if the next paragraph is a multilingual environment (because of nesting)
|
// also if the next paragraph is a multilingual environment (because of nesting)
|
||||||
if (nextpar
|
if (nextpar && state->open_encoding_ == CJK
|
||||||
&& (state->open_encoding_ == CJK && bparams.encoding().iconvName() != "UTF-8"
|
&& bparams.encoding().iconvName() != "UTF-8"
|
||||||
&& bparams.encoding().package() != Encoding::CJK )
|
&& bparams.encoding().package() != Encoding::CJK
|
||||||
&& (nextpar_language->encoding()->package() != Encoding::CJK
|
&& (nextpar_language->encoding()->package() != Encoding::CJK
|
||||||
|| (nextpar->layout().isEnvironment() && nextpar->isMultiLingual(bparams)))
|
|| (nextpar->layout().isEnvironment() && nextpar->isMultiLingual(bparams)))
|
||||||
// inbetween environments, CJK has to be closed later (nesting!)
|
// inbetween environments, CJK has to be closed later (nesting!)
|
||||||
@ -1572,6 +1576,7 @@ void latexParagraphs(Buffer const & buf,
|
|||||||
finishEnvironment(os, runparams, data);
|
finishEnvironment(os, runparams, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: uncomment the content or remove this block
|
||||||
if (pit == runparams.par_end) {
|
if (pit == runparams.par_end) {
|
||||||
// Make sure that the last paragraph is
|
// Make sure that the last paragraph is
|
||||||
// correctly terminated (because TeXOnePar does
|
// correctly terminated (because TeXOnePar does
|
||||||
|
Loading…
Reference in New Issue
Block a user