[LyX/master] Fix font substitutions of Thai documents
commit 008e1cc963b5ca54f1e71fa501ecb4b2306349ff Author: Scott Kostyshak Date: Thu Aug 17 22:02:09 2023 -0400 Fix font substitutions of Thai documents The substitutefont package is obsoleted now on TL because the required functionality is in the kernel. See here: https://ctan.org/pkg/substitutefont --- lib/languages | 20 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/languages b/lib/languages index 3101ee3..760a1ff 100644 --- a/lib/languages +++ b/lib/languages @@ -1522,11 +1522,23 @@ Language thai \DeclareRobustCommand{\copyright}{% \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi} \DeclareTextSymbol{\textcopyright}{LTH}{8} + % % set up Thai fonts as substitue for the default families - \usepackage{substitutefont} - \substitutefont{LTH}{\rmdefault}{norasi} - \substitutefont{LTH}{\sfdefault}{garuda} - \substitutefont{LTH}{\ttdefault}{ttypist} + % The 'substitutefont' package is obsolete now, since commands + % from the LaTeX kernel can be used instead. See here: + % https://ctan.org/pkg/substitutefont + % https://www.latex-project.org/news/latex2e-news/ltnews31.pdf + \providecommand\IfFormatAtLeastTF{\@ifl@t@r\fmtversion} + \IfFormatAtLeastTF{2020/02/01}{% + \DeclareFontFamilySubstitution{LTH}{\rmdefault}{norasi} + \DeclareFontFamilySubstitution{LTH}{\sfdefault}{garuda} + \DeclareFontFamilySubstitution{LTH}{\ttdefault}{ttypist} + }{% + \usepackage{substitutefont} + \substitutefont{LTH}{\rmdefault}{norasi} + \substitutefont{LTH}{\sfdefault}{garuda} + \substitutefont{LTH}{\ttdefault}{ttypist} + } EndPostBabelPreamble End -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] * lyxpaperview.py - non-waiting process call for all cases.
commit 1e4f91384776250ba3e5335c336bdad2ce3e0934 Author: Pavel Sanda Date: Thu Aug 17 23:36:18 2023 +0200 * lyxpaperview.py - non-waiting process call for all cases. --- lib/scripts/lyxpaperview.py |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/lib/scripts/lyxpaperview.py b/lib/scripts/lyxpaperview.py index 32f83ea..1eb867a 100755 --- a/lib/scripts/lyxpaperview.py +++ b/lib/scripts/lyxpaperview.py @@ -141,7 +141,7 @@ def main(argv): cmdline = viewer.split(" -", 1) if len(cmdline) == 1: -subprocess.call([viewer, result]) +subprocess.Popen([viewer, result], stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL) elif len(cmdline) == 2: subprocess.Popen([cmdline[0], "-" + cmdline[1] , result], stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL) -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Add direction switch with Babel/bidi (#12864)
commit 5d084c86c9b09e9181de9116fe1eface289722f7 Author: Juergen Spitzmueller Date: Thu Aug 17 14:29:23 2023 +0200 Add direction switch with Babel/bidi (#12864) Patch by Udi Fogiel --- src/Paragraph.cpp | 13 + 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 30a5e5e..641f8b1 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1098,11 +1098,12 @@ void Paragraph::Private::latexInset(BufferParams const & bparams, odocstream::pos_type const len = os.os().tellp(); if (inset->forceLTR(runparams) - // babel with Xe/LuaTeX does not need a switch + // babel with LuaTeX does not need a switch + // babel with XeTeX needs a switch only if bidi is used // and \L is not defined there. - && (!runparams.isFullUnicode() || !runparams.use_babel) + && (!runparams.isFullUnicode() || bparams.useBidiPackage(runparams) || runparams.use_polyglossia) && running_font.isRightToLeft()) { - if (runparams.use_polyglossia) { + if (bparams.useBidiPackage(runparams) || runparams.use_polyglossia) { // (lua)bidi // Displayed environments go in an LTR environment if (disp_env) { @@ -2070,12 +2071,16 @@ char_type Paragraph::getUChar(BufferParams const & bparams, // => checked for Hebrew! // * In arabic_arabi, brackets are transformed to Arabic // Ornate Parentheses. Is this is really wanted? + // => Yes, in file ararabeyes.enc from the arabi bundle + // the slot of the left bracket (slot 91) is encoded as + // "ornaterightparenthesis". This is also the reason + // brackets don't need to be mirrored with arabi string const & lang = getFontSettings(bparams, pos).language()->lang(); char_type uc = c; // 1. In the following languages, parentheses need to be reversed. - //Also with polyglodia/luabidi + //Also with polyglossia/luabidi bool const reverseparens = (lang == "hebrew" || rp.use_polyglossia); // 2. In the following languages, brackets don't need to be reversed. -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs
[LyX/master] Account for babel's bidi option (#12866)
commit 315c2f132ad79c1ac40a101681365a4150b0496f Author: Juergen Spitzmueller Date: Thu Aug 17 14:25:33 2023 +0200 Account for babel's bidi option (#12866) bidi=bidi-{r,l} load the bidi package --- src/BufferParams.cpp | 27 +++ src/BufferParams.h |5 + src/Font.cpp |4 ++-- src/OutputParams.cpp |6 -- src/OutputParams.h |2 -- src/Paragraph.cpp|6 +++--- src/insets/InsetCitation.cpp |2 +- src/insets/InsetRef.cpp |2 +- src/insets/InsetTabular.cpp |4 ++-- 9 files changed, 41 insertions(+), 17 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 875b8d0..3dad8c6 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -2948,6 +2948,33 @@ bool BufferParams::isLiterate() const } +bool BufferParams::hasPackageOption(string const package, string const opt) const +{ + for (auto const & p : documentClass().packageOptions()) + if (package == p.first && opt == p.second) + return true; + return false; +} + + +bool BufferParams::useBidiPackage(OutputParams const & rp) const +{ + return (rp.use_polyglossia + // as of babel 3.29, bidi=bidi-* is supported by babel + // So we check whether we use a respective version and + // whethert bidi-r or bidi-l have been requested either via class + // or package options + || (rp.use_babel + && LaTeXFeatures::isAvailableAtLeastFrom("babel", 2019, 4, 3) + && (hasPackageOption("babel", "bidi-r") + || hasPackageOption("babel", "bidi-l") + || contains(options, "bidi-r") + || contains(options, "bidi-l"))) + ) + && rp.flavor == Flavor::XeTeX; +} + + void BufferParams::readPreamble(Lexer & lex) { if (lex.getString() != "\\begin_preamble") diff --git a/src/BufferParams.h b/src/BufferParams.h index 77b4856..2a2e0f3 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -49,6 +49,7 @@ class LayoutFile; class LayoutFileIndex; class Length; class Lexer; +class OutputParams; class otexstream; class PDFOptions; class Spacing; @@ -194,6 +195,10 @@ public: bool isLatex() const; /// returns \c true if the buffer contains a Wed document bool isLiterate() const; + /// Is this package option requested? + bool hasPackageOption(std::string const package, std::string const opt) const; + /// Do we use the bidi package (which does some reordering and stuff)? + bool useBidiPackage(OutputParams const & rp) const; /// return the format of the buffer on a string std::string bufferFormat() const; diff --git a/src/Font.cpp b/src/Font.cpp index aa8c235..8c73e91 100644 --- a/src/Font.cpp +++ b/src/Font.cpp @@ -426,7 +426,7 @@ int Font::latexWriteStartChanges(otexstream & os, BufferParams const & bparams, // the numbers are written Left-to-Right. ArabTeX package // and bidi (polyglossia with XeTeX) reorder the number automatically // but the packages used for Hebrew and Farsi (Arabi) do not. - if (!runparams.useBidiPackage() + if (!bparams.useBidiPackage(runparams) && !runparams.pass_thru && bits_.number() == FONT_ON && prev.fontInfo().number() != FONT_ON @@ -604,7 +604,7 @@ int Font::latexWriteEndChanges(otexstream & os, BufferParams const & bparams, // the numbers are written Left-to-Right. ArabTeX package // and bidi (polyglossia with XeTeX) reorder the number automatically // but the packages used for Hebrew and Farsi (Arabi) do not. - if (!runparams.useBidiPackage() + if (!bparams.useBidiPackage(runparams) && !runparams.pass_thru && bits_.number() == FONT_ON && next.fontInfo().number() != FONT_ON diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index dd98c52..7c22cb1 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -51,10 +51,4 @@ bool OutputParams::isFullUnicode() const || flavor == Flavor::XeTeX; } - -bool OutputParams::useBidiPackage() const -{ - return use_polyglossia && flavor == Flavor::XeTeX; -} - } // namespace lyx diff --git a/src/OutputParams.h b/src/OutputParams.h index 40a7a47..9d9a7ae 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -83,8 +83,6 @@ public: bool isLaTeX() const; /// does this flavour support full unicode? bool isFullUnicode() const; - /// Do we use the bidi package (which does some reordering and stuff)? - bool useBidiPackage() const; /// Same, but for math output, which only matter is XHTML output. MathFlavor math_flavor = NotApplicable; diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp
[LyX/2.3.x] Fix a comparison of arrays to compare *contents*
commit 79507c98af1758f4edb5e3bf6f760fce003816b1 Author: Scott Kostyshak Date: Thu Dec 31 13:15:14 2020 -0500 Fix a comparison of arrays to compare *contents* The previous code was mistakenly comparing addresses of the arrays. This issue was caught by a warning when compiling with Clang in C++20 mode, since comparing array addresses in this way is deprecated. This commit should prevent some unnecessary dispatches of LFUN_SCREEN_FONT_UPDATE. (cherry picked from commit eaebe404ae6c8305161bd5f41496f36cf6a2ab78) --- src/LyXRC.cpp |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/src/LyXRC.cpp b/src/LyXRC.cpp index 0753534..96a1c09 100644 --- a/src/LyXRC.cpp +++ b/src/LyXRC.cpp @@ -3074,7 +3074,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new) || lyxrc_orig.roman_font_foundry != lyxrc_new.roman_font_foundry || lyxrc_orig.sans_font_foundry != lyxrc_new.sans_font_foundry || lyxrc_orig.use_scalable_fonts != lyxrc_new.use_scalable_fonts - || lyxrc_orig.font_sizes != lyxrc_new.font_sizes + || !std::equal(std::begin(lyxrc_orig.font_sizes), std::end(lyxrc_orig.font_sizes), + std::begin(lyxrc_new.font_sizes)) || lyxrc_orig.typewriter_font_foundry != lyxrc_new.typewriter_font_foundry || lyxrc_orig.defaultZoom != lyxrc_new.defaultZoom) { dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE)); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs