]> git.lyx.org Git - features.git/commitdiff
Fix Hebrew quotation marks
authorJuergen Spitzmueller <spitz@lyx.org>
Mon, 12 Dec 2016 17:08:20 +0000 (18:08 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Mon, 12 Dec 2016 17:08:20 +0000 (18:08 +0100)
All typographic quotation marks are supported, if the proper
LaTeX macros (as opposed to ligatures) are used.

So no need for forcing straight quotes.

This is in line with what babel-hebrew suggests.

src/insets/InsetQuotes.cpp

index 75486d97ddc84de7183cac16c2d0860754fff39a..db1de0fd324a5758b34b18bae903a9cc2dba872e 100644 (file)
@@ -85,6 +85,13 @@ char const * const latex_quote_ot1[2][5] = {
     "\\guillemotleft", "\\guillemotright" }
 };
 
+char const * const latex_quote_noligatures[2][5] = {
+       { "\\quotesinglbase",  "\\textquoteleft", "\\textquoteright",
+    "\\guilsinglleft", "\\guilsinglright" },
+  { "\\quotedblbase", "\\textquotedblleft", "\\textquotedblright",
+    "\\guillemotleft", "\\guillemotright" }
+};
+
 char const * const latex_quote_babel[2][5] = {
        { "\\glq",  "'", "`", "\\flq", "\\frq" },
   { "\\glqq", "''", "``", "\\flqq", "\\frqq" }
@@ -192,8 +199,8 @@ void InsetQuotes::parseString(string const & s)
 
 docstring InsetQuotes::displayString() const
 {
-       // In PassThru and Hebrew, we use straight quotes
-       if (pass_thru_ || context_lang_ == "he_IL")
+       // In PassThru, we use straight quotes
+       if (pass_thru_)
                return (times_ == DoubleQuotes) ? from_ascii("\"") : from_ascii("'");
 
        int const index = quote_index[side_][language_];
@@ -257,11 +264,8 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
        const int quoteind = quote_index[side_][language_];
        string qstr;
 
-       // In some context, we output plain quotes
-       bool const force_plain = 
-               runparams.pass_thru
-               || runparams.local_font->language()->lang() == "hebrew";
-       if (force_plain)
+       // In pass-thru context, we output plain quotes
+       if (runparams.pass_thru)
                qstr = (times_ == DoubleQuotes) ? "\"" : "'";
        else if (language_ == FrenchQuotes && times_ == DoubleQuotes
            && prefixIs(runparams.local_font->language()->code(), "fr")
@@ -275,10 +279,16 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
                        // FIXME: really? (doesn't make a difference
                        //        with recent babel-french)
                        qstr = " \\fg";
-       } else if (fontenc_ == "T1" && !runparams.use_polyglossia) {
+       } else if (fontenc_ == "T1"
+                  && !runparams.local_font->language()->internalFontEncoding()
+                  && !runparams.use_polyglossia) {
                // Quotation marks for T1 font encoding
                // (using ligatures)
                qstr = latex_quote_t1[times_][quoteind];
+       } else if (runparams.local_font->language()->internalFontEncoding()) {
+               // Quotation marks for internal font encodings
+               // (ligatures not featured)
+               qstr = latex_quote_noligatures[times_][quoteind];
 #ifdef DO_USE_DEFAULT_LANGUAGE
        } else if (doclang == "default") {
 #else
@@ -293,7 +303,7 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
                qstr = latex_quote_babel[times_][quoteind];
        }
 
-       if (!force_plain) {
+       if (!runparams.pass_thru) {
                // Always guard against unfortunate ligatures (!` ?` `` '' ,, << >>)
                char_type const lastchar = os.lastChar();
                if (prefixIs(qstr, "`")) {