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; return false;
if (it->second.textpreamble() != "textgreek" if (it->second.textpreamble() != "textgreek"
&& it->second.textpreamble() != "textcyrillic") && it->second.textpreamble() != "textcyrillic"
&& it->second.textpreamble() != "textbaltic")
return false; return false;
if (preamble.empty()) { if (preamble.empty() && it->second.textpreamble() != "textbaltic") {
preamble = it->second.textpreamble(); preamble = it->second.textpreamble();
return true; return true;
} }

View File

@ -620,10 +620,6 @@ bool LaTeXFeatures::isProvided(string const & name) const
if (provides_.find(name) != provides_.end()) if (provides_.find(name) != provides_.end())
return true; 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) if (params_.useNonTeXFonts)
return params_.documentClass().provides(name); return params_.documentClass().provides(name);
@ -1393,19 +1389,19 @@ TexString LaTeXFeatures::getMacros() const
// non-standard text accents: // non-standard text accents:
if (mustProvide("textcommaabove") || mustProvide("textcommaaboveright") || if (mustProvide("textcommaabove") || mustProvide("textcommaaboveright") ||
mustProvide("textcommabelow") || mustProvide("textbaltic")) mustProvide("textcommabelow") || mustProvide("textbalticdefs"))
macros << lyxaccent_def; macros << lyxaccent_def;
if (mustProvide("textcommabelow") || mustProvide("textbaltic")) if (mustProvide("textcommabelow") || mustProvide("textbalticdefs"))
macros << textcommabelow_def << '\n'; macros << textcommabelow_def << '\n';
if (mustProvide("textcommaabove") || mustProvide("textbaltic")) if (mustProvide("textcommaabove") || mustProvide("textbalticdefs"))
macros << textcommaabove_def << '\n'; macros << textcommaabove_def << '\n';
if (mustProvide("textcommaaboveright")) if (mustProvide("textcommaaboveright"))
macros << textcommaaboveright_def << '\n'; macros << textcommaaboveright_def << '\n';
if (mustProvide("textbaltic")) if (mustProvide("textbalticdefs"))
macros << textbaltic_def << '\n'; macros << textbaltic_def << '\n';
// split-level fractions // split-level fractions

View File

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