Output "textbaltic" definitions only if needed.

This commit is contained in:
Juergen Spitzmueller 2018-04-22 10:08:07 +02:00
parent 2ed1012ead
commit 3457d9d25f
3 changed files with 18 additions and 15 deletions

View File

@ -589,10 +589,11 @@ bool Encodings::isKnownScriptChar(char_type const c, string & preamble)
return false;
if (it->second.textpreamble() != "textgreek"
&& it->second.textpreamble() != "textcyrillic")
&& it->second.textpreamble() != "textcyrillic"
&& it->second.textpreamble() != "textbaltic")
return false;
if (preamble.empty()) {
if (preamble.empty() && it->second.textpreamble() != "textbaltic") {
preamble = it->second.textpreamble();
return true;
}

View File

@ -620,10 +620,6 @@ bool LaTeXFeatures::isProvided(string const & name) const
if (provides_.find(name) != provides_.end())
return true;
// FIXME: the "textbaltic" definitions are only needed if the context
// font encoding of the respective char is not l7x.
// We cannot check this here as we have no context information.
if (params_.useNonTeXFonts)
return params_.documentClass().provides(name);
@ -1393,19 +1389,19 @@ TexString LaTeXFeatures::getMacros() const
// non-standard text accents:
if (mustProvide("textcommaabove") || mustProvide("textcommaaboveright") ||
mustProvide("textcommabelow") || mustProvide("textbaltic"))
mustProvide("textcommabelow") || mustProvide("textbalticdefs"))
macros << lyxaccent_def;
if (mustProvide("textcommabelow") || mustProvide("textbaltic"))
if (mustProvide("textcommabelow") || mustProvide("textbalticdefs"))
macros << textcommabelow_def << '\n';
if (mustProvide("textcommaabove") || mustProvide("textbaltic"))
if (mustProvide("textcommaabove") || mustProvide("textbalticdefs"))
macros << textcommaabove_def << '\n';
if (mustProvide("textcommaaboveright"))
macros << textcommaaboveright_def << '\n';
if (mustProvide("textbaltic"))
if (mustProvide("textbalticdefs"))
macros << textbaltic_def << '\n';
// split-level fractions

View File

@ -1547,6 +1547,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
// then the contents
BufferParams const bp = features.runparams().is_child
? features.buffer().masterParams() : features.buffer().params();
string bscript = "textbaltic";
for (pos_type i = 0; i < int(text_.size()) ; ++i) {
char_type c = text_[i];
if (c == 0x0022) {
@ -1555,11 +1556,16 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const
else if (bp.main_font_encoding() != "T1"
|| ((&owner_->getFontSettings(bp, i))->language()->internalFontEncoding()))
features.require("textquotedbl");
}
if (!bp.use_dash_ligatures
&& (c == 0x2013 || c == 0x2014)
&& bp.useNonTeXFonts
&& features.runparams().flavor == OutputParams::XETEX)
} else if (Encodings::isKnownScriptChar(c, bscript)){
string fontenc = (&owner_->getFontSettings(bp, i))->language()->fontenc();
if (fontenc.empty())
fontenc = features.runparams().main_fontenc;
if (Encodings::needsScriptWrapper("textbaltic", fontenc))
features.require("textbalticdefs");
} else if (!bp.use_dash_ligatures
&& (c == 0x2013 || c == 0x2014)
&& bp.useNonTeXFonts
&& features.runparams().flavor == OutputParams::XETEX)
// XeTeX's dash behaviour is determined via a global setting
features.require("xetexdashbreakstate");
BufferEncodings::validate(c, features);