]> git.lyx.org Git - features.git/commitdiff
Output "textbaltic" definitions only if needed.
authorJuergen Spitzmueller <spitz@lyx.org>
Sun, 22 Apr 2018 08:08:07 +0000 (10:08 +0200)
committerJuergen Spitzmueller <spitz@lyx.org>
Sun, 22 Apr 2018 08:08:07 +0000 (10:08 +0200)
src/Encoding.cpp
src/LaTeXFeatures.cpp
src/Paragraph.cpp

index 0947c148c1e7f0dbd8b7c2c741a538c3179602f8..f6197af13d6ddd822e2b2036ea623e9c1c476e26 100644 (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;
        }
index e8d138707008b0586646517b05560a21990429dc..d3b8a50844a82c4985578db8ba8d1a3783ba928a 100644 (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
index 574a830690452919cb210b1510210c81ba5fa967..8cd8357b8b110f4217e8980c2fb7e72cba6af9b2 100644 (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);