From 89c4357bf10cced4e8b87bc4b230fb93a2762fb0 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Mon, 12 Dec 2016 18:08:20 +0100 Subject: [PATCH] Fix Hebrew quotation marks 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 | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index 75486d97dd..db1de0fd32 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -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, "`")) { -- 2.39.2