commit 3457d9d25f9aa2b5b11b535d5c40689703c804a4
Author: Juergen Spitzmueller <[email protected]>
Date:   Sun Apr 22 10:08:07 2018 +0200

    Output "textbaltic" definitions only if needed.
---
 src/Encoding.cpp      |    5 +++--
 src/LaTeXFeatures.cpp |   12 ++++--------
 src/Paragraph.cpp     |   16 +++++++++++-----
 3 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/Encoding.cpp b/src/Encoding.cpp
index 0947c14..f6197af 100644
--- a/src/Encoding.cpp
+++ b/src/Encoding.cpp
@@ -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;
        }
diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp
index e8d1387..d3b8a50 100644
--- a/src/LaTeXFeatures.cpp
+++ b/src/LaTeXFeatures.cpp
@@ -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
diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
index 574a830..8cd8357 100644
--- a/src/Paragraph.cpp
+++ b/src/Paragraph.cpp
@@ -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);

Reply via email to