[LyX/master] Proper logos with RTL
commit e5a9244bef8b7d86ae86fa2d180adbd0c47b70f1 Author: Juergen Spitzmueller Date: Sun Jul 15 20:56:55 2018 +0200 Proper logos with RTL Fixes #10423 --- src/LaTeXFeatures.cpp | 17 + src/LaTeXFeatures.h |2 ++ src/insets/InsetSpecialChar.cpp | 22 +- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index dc961e2..5f83283 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -65,6 +65,10 @@ namespace lyx { static docstring const lyx_def = from_ascii( "\\providecommand{\\LyX}{L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}"); +static docstring const lyx_rtl_def = from_ascii( + "\\let\\@@LyX\\LyX\n" + "\\def\\LyX{\\@ensure@LTR{\\@@LyX}}"); + static docstring const lyx_hyperref_def = from_ascii( "\\providecommand{\\LyX}{\\texorpdfstring%\n" " {L\\kern-.1667em\\lower.25em\\hbox{Y}\\kern-.125emX\\@}\n" @@ -914,6 +918,17 @@ void LaTeXFeatures::getFontEncodings(vector & encs, bool const onlylangs } } + +bool LaTeXFeatures::hasRTLLanguage() const +{ + if (params_.language->rightToLeft()) + return true; + for (auto const & lang : UsedLanguages_) + if (lang->rightToLeft()) + return true; + return false; +} + namespace { char const * simplefeatures[] = { @@ -1363,6 +1378,8 @@ TexString LaTeXFeatures::getMacros() const macros << lyx_hyperref_def << '\n'; else macros << lyx_def << '\n'; + if (runparams_.use_polyglossia && hasRTLLanguage()) + macros << lyx_rtl_def << '\n'; } if (mustProvide("noun")) diff --git a/src/LaTeXFeatures.h b/src/LaTeXFeatures.h index 32a6242..3d984d6 100644 --- a/src/LaTeXFeatures.h +++ b/src/LaTeXFeatures.h @@ -185,6 +185,8 @@ private: /// void useLayout(docstring const &, int); /// + bool hasRTLLanguage() const; + /// std::list usedLayouts_; /// std::list usedInsetLayouts_; diff --git a/src/insets/InsetSpecialChar.cpp b/src/insets/InsetSpecialChar.cpp index 1267a75..e9153cd 100644 --- a/src/insets/InsetSpecialChar.cpp +++ b/src/insets/InsetSpecialChar.cpp @@ -16,6 +16,7 @@ #include "Dimension.h" #include "Font.h" +#include "Language.h" #include "LaTeXFeatures.h" #include "Lexer.h" #include "MetricsInfo.h" @@ -416,6 +417,17 @@ void InsetSpecialChar::read(Lexer & lex) void InsetSpecialChar::latex(otexstream & os, OutputParams const & rp) const { + bool const rtl = rp.local_font->isRightToLeft(); + string lswitch = ""; + string lswitche = ""; + if (rtl && !rp.use_polyglossia) { + lswitch = "\\L{"; + lswitche = "}"; + if (rp.local_font->language()->lang() == "arabic_arabi" + || rp.local_font->language()->lang() == "farsi") + lswitch = "\\textLR{"; + } + switch (kind_) { case HYPHENATION: os << "\\-"; @@ -433,7 +445,7 @@ void InsetSpecialChar::latex(otexstream & os, os << "\\ldots" << termcmd; break; case MENU_SEPARATOR: - if (rp.local_font->isRightToLeft()) + if (rtl) os << "\\lyxarrow*"; else os << "\\lyxarrow"; @@ -450,22 +462,22 @@ void InsetSpecialChar::latex(otexstream & os, case PHRASE_LYX: if (rp.moving_arg) os << "\\protect"; - os << "\\LyX" << termcmd; + os << lswitch << "\\LyX" << termcmd << lswitche; break; case PHRASE_TEX: if (rp.moving_arg) os << "\\protect"; - os << "\\TeX" << termcmd; + os << lswitch << "\\TeX" << termcmd << lswitche; break; case PHRASE_LATEX2E: if (rp.moving_arg) os << "\\protect"; - os << "\\LaTeXe" << termcmd; + os << lswitch << "\\LaTeXe" << termcmd << lswitche; break; case PHRASE_LATEX: if (rp.moving_arg) os << "\\protect"; - os << "\\LaTeX" << termcmd; + os << lswitch << "\\LaTeX" << termcmd << lswitche; break; } }
[LyX/master] Par alignment in floats must be swapped for all RTL langs, not only Hebrew
commit 3bacc3c6e73e87c1fdb3a9af33533c556d1d7274 Author: Juergen Spitzmueller Date: Sun Jul 15 19:23:19 2018 +0200 Par alignment in floats must be swapped for all RTL langs, not only Hebrew Fixes: #11029 --- src/Paragraph.cpp |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 427818a..6410d57 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -2383,13 +2383,13 @@ int Paragraph::Private::startTeXParParams(BufferParams const & bparams, case LYX_ALIGN_DECIMAL: break; case LYX_ALIGN_LEFT: { - if (owner_->getParLanguage(bparams)->babel() != "hebrew") + if (!owner_->getParLanguage(bparams)->rightToLeft()) corrected_env(os, begin_tag, "flushleft", code, lastpar, column); else corrected_env(os, begin_tag, "flushright", code, lastpar, column); break; } case LYX_ALIGN_RIGHT: { - if (owner_->getParLanguage(bparams)->babel() != "hebrew") + if (!owner_->getParLanguage(bparams)->rightToLeft()) corrected_env(os, begin_tag, "flushright", code, lastpar, column); else corrected_env(os, begin_tag, "flushleft", code, lastpar, column); @@ -2441,13 +2441,13 @@ bool Paragraph::Private::endTeXParParams(BufferParams const & bparams, case LYX_ALIGN_DECIMAL: break; case LYX_ALIGN_LEFT: { - if (owner_->getParLanguage(bparams)->babel() != "hebrew") + if (!owner_->getParLanguage(bparams)->rightToLeft()) output = corrected_env(os, end_tag, "flushleft", code, lastpar, col); else output = corrected_env(os, end_tag, "flushright", code, lastpar, col); break; } case LYX_ALIGN_RIGHT: { - if (owner_->getParLanguage(bparams)->babel() != "hebrew") + if (!owner_->getParLanguage(bparams)->rightToLeft()) output = corrected_env(os, end_tag, "flushright", code, lastpar, col); else output = corrected_env(os, end_tag, "flushleft", code, lastpar, col);
[LyX/master] Update sk.po
commit 5a494307299371f422c9bc0f223de6fe4159bf87 Author: Kornel Benko Date: Sun Jul 15 18:13:18 2018 +0200 Update sk.po --- po/sk.po | 289 +- 1 files changed, 155 insertions(+), 134 deletions(-) diff --git a/po/sk.po b/po/sk.po index 0ca4d6b..5908488 100644 --- a/po/sk.po +++ b/po/sk.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: LyX-2.4\n" "Report-Msgid-Bugs-To: lyx-de...@lists.lyx.org\n" -"POT-Creation-Date: 2018-07-08 13:30+0200\n" -"PO-Revision-Date: 2018-07-08 11:40+\n" +"POT-Creation-Date: 2018-07-10 13:08+0200\n" +"PO-Revision-Date: 2018-07-10 11:27+\n" "Last-Translator: Kornel Benko \n" "Language-Team: Slovak \n" "Language: sk\n" @@ -243,10 +243,6 @@ msgstr "Definujte možnosti ako napr. --min-crossrefs (viď dokumentáciu BibTeX msgid "LyX: Add BibTeX Database" msgstr "LyX: Pridať BibTeX databázu" -#: src/frontends/qt4/ui/BibtexAddUi.ui:31 -msgid "&Databases found by LaTeX:" -msgstr "&Databáza nájdená LaTeXom:" - #: src/frontends/qt4/ui/BibtexAddUi.ui:67 msgid "Rescan LaTeX's index for new databases and styles" msgstr "Znovu prehľadať nové LaTeXové databázy a štýle" @@ -262,10 +258,6 @@ msgid "" msgstr "" "Tu môžte vložiť meno lokálnej BibTeX databázy alebo prehľadať váš adresár." -#: src/frontends/qt4/ui/BibtexAddUi.ui:84 -msgid "&Local databases:" -msgstr "&Lokálne databázy:" - #: src/frontends/qt4/ui/BibtexAddUi.ui:102 msgid "Here you can enter a local BibTeX database name" msgstr "Tu môžte vložiť meno lokálnej BibTeX databázy" @@ -391,25 +383,6 @@ msgid "" msgstr "" "Voľby pre príkaz na biblatex-bibliografie. Pre detaily viď biblatex manuál." -#: src/frontends/qt4/ui/BibtexUi.ui:283 src/frontends/qt4/ui/CharacterUi.ui:357 -#: src/frontends/qt4/ui/CitationUi.ui:453 -#: src/frontends/qt4/ui/CompareHistoryUi.ui:183 -#: src/frontends/qt4/ui/CompareUi.ui:153 src/frontends/qt4/ui/DocumentUi.ui:67 -#: src/frontends/qt4/ui/ExternalUi.ui:600 -#: src/frontends/qt4/ui/GraphicsUi.ui:773 src/frontends/qt4/ui/IncludeUi.ui:341 -#: src/frontends/qt4/ui/IndexUi.ui:41 src/frontends/qt4/ui/InsetParamsUi.ui:118 -#: src/frontends/qt4/ui/ListingsUi.ui:539 -#: src/frontends/qt4/ui/MathMatrixUi.ui:263 src/frontends/qt4/ui/NoteUi.ui:38 -#: src/frontends/qt4/ui/ParagraphUi.ui:241 src/frontends/qt4/ui/PhantomUi.ui:38 -#: src/frontends/qt4/ui/PrintindexUi.ui:98 src/frontends/qt4/ui/RefUi.ui:349 -#: src/frontends/qt4/ui/SendtoUi.ui:72 src/frontends/qt4/ui/ShortcutUi.ui:52 -#: src/frontends/qt4/ui/SymbolsUi.ui:49 -#: src/frontends/qt4/ui/TabularCreateUi.ui:127 -#: src/frontends/qt4/ui/ToggleWarningUi.ui:90 -#: src/frontends/qt4/ui/WrapUi.ui:150 -msgid "&OK" -msgstr "&OK" - #: src/frontends/qt4/ui/BoxUi.ui:23 msgid "Type and Size" msgstr "Typ a Veľkosť" @@ -1078,18 +1051,6 @@ msgstr "" msgid "All aut&hors" msgstr "Každý a&utor" -#: src/frontends/qt4/ui/CitationUi.ui:430 src/frontends/qt4/ui/DocumentUi.ui:44 -#: src/frontends/qt4/ui/GraphicsUi.ui:744 -#: src/frontends/qt4/ui/InsetParamsUi.ui:82 -#: src/frontends/qt4/ui/ParagraphUi.ui:218 src/frontends/qt4/ui/PrefsUi.ui:44 -#: src/frontends/qt4/ui/WrapUi.ui:121 -msgid "&Restore" -msgstr "O&bnoviť" - -#: src/frontends/qt4/ui/CitationUi.ui:466 -msgid "App&ly" -msgstr "&Použiť" - #: src/frontends/qt4/ui/ColorUi.ui:27 msgid "Font Colors" msgstr "Farby Písma" @@ -1138,10 +1099,6 @@ msgstr "Tieňované rámiky:" msgid "Compare Revisions" msgstr "Porovnať revízie" -#: src/frontends/qt4/ui/CompareHistoryUi.ui:30 -msgid "&Revisions back" -msgstr "&Revízie naspäť" - #: src/frontends/qt4/ui/FloatPlacementUi.ui:127 msgid "&Right" msgstr "Vp&ravo" @@ -1162,10 +1119,6 @@ msgstr "Nová:" msgid "&New Document:" msgstr "&Nový Dokument:" -#: src/frontends/qt4/ui/CompareUi.ui:60 -msgid "&Old Document:" -msgstr "&Bývalí Dokument:" - #: src/frontends/qt4/ui/CompareUi.ui:83 src/frontends/qt4/ui/PrefUi.ui:50 msgid "Bro&wse..." msgstr "P&rechádzať…" @@ -1174,14 +1127,14 @@ msgstr "P&rechádzať…" msgid "Copy Document Settings from:" msgstr "Nastavenia dokumentu z:" -#: src/frontends/qt4/ui/CompareUi.ui:105 -msgid "N&ew Document" -msgstr "Nový &Dokument" - #: src/frontends/qt4/ui/CompareUi.ui:112 msgid "Ol&d Document" msgstr "Bý&valí Dokument" +#: src/frontends/qt4/ui/CompareUi.ui:79 +msgid "Old Do&cument:" +msgstr "&Bývalí Dokument:" + #: src/frontends/qt4/ui/CompareUi.ui:178 msgid "" "Turns on the change tracking and showing changes in LaTeX output for the " @@ -1194,14 +1147,6 @@ msgstr "" msgid "Enable &change tracking features in the output" msgstr "&Umožni sledovanie zmien vo výstupe" -#: src/frontends/qt4/ui/DelimiterUi.ui:67 src/frontends/qt4/ui/SymbolsUi.ui:56 -msgid "Insert the delimiters" -msgstr "Vložiť oddeľovače" - -#: src/frontends/qt4/ui/DelimiterUi.ui:70 -msgid "&Insert" -msgstr "Vlož&iť" - #: src/frontends/qt4/ui/DelimiterUi.ui:144 #: src/frontends/qt4/GuiDelimiter.cpp:326 msgid "TeX Code: " @@ -1342,10 +1287,6 @@ msgstr "Voľby LaTeX"
[LyX/master] Update it.po
commit 6d14efc3cc8ae75e98cafca9e5e0bc695ab995bc Author: Enrico Forestieri Date: Sun Jul 15 17:15:10 2018 +0200 Update it.po po/it.gmo | Bin 535179 -> 536320 bytes po/it.po | 2973 +++-- 2 files changed, 1512 insertions(+), 1461 deletions(-)
[LyX/master] de.po: update
commit d1de14008bdf78327431122c7715003c99fddb5e Author: Juergen Spitzmueller Date: Sun Jul 15 14:47:29 2018 +0200 de.po: update po/de.gmo | Bin 547226 -> 546847 bytes po/de.po | 1902 ++--- 2 files changed, 931 insertions(+), 971 deletions(-)
[LyX/master] Fix bracket output in RTL languages
commit 195f62ac9322285bf4c6e16ec5081cc4c216e066 Author: Juergen Spitzmueller Date: Sun Jul 15 14:26:29 2018 +0200 Fix bracket output in RTL languages This is a real mess! Fixes: #11187 --- src/Paragraph.cpp| 66 -- src/Paragraph.h |3 +- src/output_plaintext.cpp |2 +- 3 files changed, 49 insertions(+), 22 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 2b07456..427818a 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1234,10 +1234,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, pos_type end_pos, unsigned int & column) { - // With polyglossia, brackets and stuff need not be reversed - // in RTL scripts (see bug #8251) - char_type const c = (runparams.use_polyglossia) ? - owner_->getUChar(bparams, i) : text_[i]; + char_type const c = owner_->getUChar(bparams, runparams, i); if (style.pass_thru || runparams.pass_thru || contains(style.pass_thru_chars, c) @@ -1997,32 +1994,60 @@ Font const Paragraph::getLayoutFont } -char_type Paragraph::getUChar(BufferParams const & bparams, pos_type pos) const +char_type Paragraph::getUChar(BufferParams const & bparams, + OutputParams const & rp, + pos_type pos) const { char_type c = d->text_[pos]; + + // Return unchanged character in LTR languages. if (!getFontSettings(bparams, pos).isRightToLeft()) return c; - // FIXME: The arabic special casing is due to the difference of arabic - // round brackets input introduced in r18599. Check if this should be - // unified with Hebrew or at least if all bracket types should be - // handled the same (file format change in either case). + // FIXME This is a complete mess due to all the language-specific + // special cases. We need to unify this eventually, but this + // requires a file format change and some thought. + // We also need to unify the input of parentheses in different RTL + // languages. Currently, some have their own methods (Arabic: + // 18599/lyxsvn, Hebrew: e5f42f67d/lyxgit), some don't (Urdu, Syriac). + // Also note that the representation in the LyX file is probably wrong + // (see FIXME in TextMetrics::breakRow). + // Most likely, we should simply rely on Qt's unicode handling here. string const & lang = getFontSettings(bparams, pos).language()->lang(); - bool const arabic = lang == "arabic_arabtex" || lang == "arabic_arabi" - || lang == "farsi"; + + // With polyglossia, brackets and stuff need not be reversed in RTL scripts + // FIXME: The special casing for Hebrew parens is due to the special + // handling on input (for Hebrew in e5f42f67d/lyxgit); see #8251. char_type uc = c; + if (rp.use_polyglossia) { + switch (c) { + case '(': + if (lang == "hebrew") + uc = ')'; + break; + case ')': + if (lang == "hebrew") + uc = '('; + break; + } + return uc; + } + + // In the following languages, brackets don't need to be reversed. + // Furthermore, in arabic_arabi, they are transformed to Arabic + // Ornate Parentheses (dunno if this is really wanted) + bool const reversebrackets = lang != "arabic_arabtex" + && lang != "arabic_arabi" + && lang != "farsi"; + switch (c) { - case '(': - uc = arabic ? c : ')'; - break; - case ')': - uc = arabic ? c : '('; - break; case '[': - uc = ']'; + if (reversebrackets) + uc = ']'; break; case ']': - uc = '['; + if (reversebrackets) + uc = '['; break; case '{': uc = '}'; @@ -3387,7 +3412,8 @@ docstring Paragraph::simpleLyXHTMLOnePar(Buffer const & buf, retval += inset->xhtml(xs, np); } } else { - char_type c = getUChar(buf.masterBuffer()->params(), i); + char_type c = getUChar(buf.masterBuffer()->params(), + runparams, i); xs << c; } font_old = font.fontInfo(); diff --git a/src/Paragraph.h b/src/Paragraph.h index b818322..2f61083 100644 --- a/src/Paragraph.h +++ b/src/Paragraph.h @@ -360,7 +360,8 @@ public: ///
[LyX/master] Fix quotation marks in RTL script
commit aa1d9638febccb8d9ac20548f7097dd2be440d63 Author: Juergen Spitzmueller Date: Sun Jul 15 12:11:10 2018 +0200 Fix quotation marks in RTL script Fixes: #11188 --- src/insets/InsetQuotes.cpp | 38 +- src/insets/InsetQuotes.h |7 +-- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index 4992294..515d241 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -199,7 +199,7 @@ InsetQuotesParams::QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s, char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel const & level, - QuoteSide const & side) const + QuoteSide const & side, bool const rtl) const { // main opening quotation mark char_type left_primary; @@ -321,8 +321,12 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c switch (level) { case SecondaryQuotes: + if (rtl) + return (side == ClosingQuote) ? left_secondary : right_secondary; return (side == OpeningQuote) ? left_secondary : right_secondary; case PrimaryQuotes: + if (rtl) + return (side == ClosingQuote) ? left_primary : right_primary; return (side == OpeningQuote) ? left_primary : right_primary; default: break; @@ -333,7 +337,8 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c } -docstring InsetQuotesParams::getLaTeXQuote(char_type c, string const & op) const +docstring InsetQuotesParams::getLaTeXQuote(char_type c, string const & op, + bool const rtl) const { string res; @@ -347,14 +352,16 @@ docstring InsetQuotesParams::getLaTeXQuote(char_type c, string const & op) const } case 0x2019: {// ' if (op == "int") - res = "\\textquoteleft"; + // This macro is redefined in rtl mode + res = rtl ? "\\textquoteright" : "\\textquoteleft"; else res = "'"; break; } case 0x2018: {// ` if (op == "int") - res = "\\textquoteright"; + // This macro is redefined in rtl mode + res = rtl ? "\\textquoteleft" : "\\textquoteright"; else res = "`"; break; @@ -388,14 +395,16 @@ docstring InsetQuotesParams::getLaTeXQuote(char_type c, string const & op) const } case 0x201d: {// '' if (op == "int") - res = "\\textquotedblleft"; + // This macro is redefined in rtl mode + res = rtl ? "\\textquotedblright" : "\\textquotedblleft"; else res = "''"; break; } case 0x201c: {// `` if (op == "int") - res = "\\textquotedblright"; + // This macro is redefined in rtl mode + res = rtl ? "\\textquotedblleft" : "\\textquotedblright"; else res = "``"; break; @@ -603,7 +612,7 @@ docstring const InsetQuotesParams::getShortGuiLabel(docstring const string) InsetQuotes::InsetQuotes(Buffer * buf, string const & str) : Inset(buf), style_(InsetQuotesParams::EnglishQuotes), side_(InsetQuotesParams::OpeningQuote), - pass_thru_(false), internal_fontenc_(false) + pass_thru_(false), internal_fontenc_(false), rtl_(false) { if (buf) { global_style_ = buf->masterBuffer()->params().quotes_style; @@ -620,7 +629,8 @@ InsetQuotes::InsetQuotes(Buffer * buf, string const & str) InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level, string const & side, string const & style) - : Inset(buf), level_(level), pass_thru_(false), fontspec_(false), internal_fontenc_(false) + : Inset(buf), level_(level), pass_thru_(false), fontspec_(false), + internal_fontenc_(false), rtl_(false) { bool dynamic = false; if (buf) { @@ -720,7 +730,7 @@ docstring InsetQuotes::displayString() const InsetQuotesParams::QuoteStyle style = (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_; - docstring retdisp = docstring(1, quoteparams.getQuoteChar(style, level_, side_)); + docstring retdisp = docstring(1, quoteparams.getQuoteChar(style, level_, side_, rtl_)); // in French, thin spaces are added inside double guillemets if (prefixIs(conte