commit 8ceaef656f73a0761a1e352919e623988bbc3aca Author: Juergen Spitzmueller <sp...@lyx.org> Date: Sat May 24 10:41:46 2025 +0200
Add InheritFont argument tag (#12959) --- lib/doc/Customization.lyx | 52 ++++++++++++++++++ lib/doc/de/Customization.lyx | 124 +++++++++++++++++++++++++++++++++++++++++++ lib/scripts/layout2layout.py | 1 + src/Layout.cpp | 5 ++ src/Layout.h | 1 + src/insets/InsetArgument.cpp | 5 +- src/insets/InsetArgument.h | 4 ++ src/insets/InsetLayout.cpp | 4 ++ 8 files changed, 194 insertions(+), 2 deletions(-) diff --git a/lib/doc/Customization.lyx b/lib/doc/Customization.lyx index 5b7987a06a..839940938e 100644 --- a/lib/doc/Customization.lyx +++ b/lib/doc/Customization.lyx @@ -23828,6 +23828,58 @@ that should be output in raw form, this needs to be explicitly defined for arguments. That is, arguments do not inherit PassThruChars from their parent inset or layout. +\change_inserted -712698321 1748075210 + +\end_layout + +\begin_layout Itemize + +\change_inserted -712698321 1748075463 +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1748075210 +InheritFont +\end_layout + +\end_inset + + [ +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1748075210 +0 +\end_layout + +\end_inset + +, +\begin_inset space \thinspace{} +\end_inset + + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\change_inserted -712698321 1748075210 + +\emph on +1 +\end_layout + +\end_inset + +] The font inside the argument is inherited from the surrounding text on screen if this parameter is 1 (which is the default). + Otherwise the document default font is used. +\change_unchanged + \end_layout \begin_layout Itemize diff --git a/lib/doc/de/Customization.lyx b/lib/doc/de/Customization.lyx index 8beb7054df..dfbdfba07a 100644 --- a/lib/doc/de/Customization.lyx +++ b/lib/doc/de/Customization.lyx @@ -19475,6 +19475,69 @@ nolink "false" \begin_inset Flex Code status collapsed +\begin_layout Plain Layout +InheritFont +\end_layout + +\end_inset + + [ +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +, +\begin_inset space \thinspace{} +\end_inset + + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\emph on +1 +\end_layout + +\end_inset + +] Die Schrifteinstellungen innerhalb der Einfügung werden von der unmittelbaren Umgebung übernommen, + wenn dieser Parameter auf +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + gesetzt ist. + Das gilt sowohl für die \SpecialChar LaTeX +-Ausgabe als auch für die Darstellung auf dem Bildschirm. + Im Fall des Werts +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + werden sie auf die Standard-Schrifteinstellungen des Dokuments zurückgesetzt. +\end_layout + +\begin_layout Description +\begin_inset Flex Code +status collapsed + \begin_layout Plain Layout InsertCotext \end_layout @@ -22475,6 +22538,67 @@ PassThruChars \begin_inset Flex Code status collapsed +\begin_layout Plain Layout +InheritFont +\end_layout + +\end_inset + + [ +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + +, +\begin_inset space \thinspace{} +\end_inset + + +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout + +\emph on +1 +\end_layout + +\end_inset + +] Die Bildschirm-Schrifteinstellungen innerhalb des Arguments werden von der unmittelbaren Umgebung übernommen, + wenn dieser Parameter auf +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +1 +\end_layout + +\end_inset + + gesetzt ist (was die Voreinstellung ist). + Im Fall des Werts +\begin_inset Flex Code +status collapsed + +\begin_layout Plain Layout +0 +\end_layout + +\end_inset + + werden sie auf die Standard-Schrifteinstellungen des Dokuments zurückgesetzt. +\end_layout + +\begin_layout Itemize +\begin_inset Flex Code +status collapsed + \begin_layout Plain Layout IsTocCaption \end_layout diff --git a/lib/scripts/layout2layout.py b/lib/scripts/layout2layout.py index dd124eb7a6..35ece16bb4 100644 --- a/lib/scripts/layout2layout.py +++ b/lib/scripts/layout2layout.py @@ -363,6 +363,7 @@ currentFormat = 109 # New Layout tags "TheoremName", "TheoremZRefName", # "TheoremCounter", "TheoremParentCounter", "TheoremStyle", # "TheoremCrossRefName", "TheoremCrossRefPluralName" +# New InsetArgument tag "InheritFont" # Incremented to format 109, 15 May 2025 by spitz # New Layout tag "MultiPar" diff --git a/src/Layout.cpp b/src/Layout.cpp index 0c14c79d61..aafd177249 100644 --- a/src/Layout.cpp +++ b/src/Layout.cpp @@ -1375,6 +1375,9 @@ void Layout::readArgument(Lexer & lex, bool validating) } else if (tok == "freespacing") { lex.next(); arg.free_spacing = lex.getBool(); + } else if (tok == "inheritfont") { + lex.next(); + arg.inh_font = lex.getBool(); } else if (tok == "docbooktag") { lex.next(); arg.docbooktag = lex.getDocString(); @@ -1440,6 +1443,8 @@ void writeArgument(ostream & os, string const & id, Layout::latexarg const & arg lyxWrite(os, arg.font, "Font", 2); if (arg.labelfont != inherit_font) lyxWrite(os, arg.labelfont, "LabelFont", 2); + if (!arg.inh_font) + os << "\t\tInheritFont " << arg.inh_font << "\n"; switch (arg.passthru) { case PT_TRUE: os << "\t\tPassThru true\n"; diff --git a/src/Layout.h b/src/Layout.h index af179f6533..40e5b74d8d 100644 --- a/src/Layout.h +++ b/src/Layout.h @@ -112,6 +112,7 @@ public: docstring pass_thru_chars; bool is_toc_caption = false; bool free_spacing = false; + bool inh_font = true; std::string newlinecmd; /// The DocBook tag corresponding to this argument. docstring docbooktag; diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index 90886e43d3..0c1afec0b7 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -45,8 +45,8 @@ InsetArgument::InsetArgument(Buffer * buf, string const & name) : InsetCollapsible(buf), name_(name), labelstring_(docstring()), font_(inherit_font), labelfont_(inherit_font), decoration_(string()), pass_thru_context_(false), pass_thru_local_(false), pass_thru_(false), - free_spacing_(false), escape_chars_(docstring()), pass_thru_chars_(docstring()), - is_toc_caption_(false), newline_cmd_(string()) + inherit_font_(true), free_spacing_(false), escape_chars_(docstring()), + pass_thru_chars_(docstring()), is_toc_caption_(false), newline_cmd_(string()) {} @@ -124,6 +124,7 @@ void InsetArgument::init(Paragraph const & par) pass_thru_chars_ = (*lait).second.pass_thru_chars; newline_cmd_ = (*lait).second.newlinecmd; free_spacing_ = (*lait).second.free_spacing; + inherit_font_ = (*lait).second.inh_font; docbooktag_ = (*lait).second.docbooktag; docbooktagtype_ = (*lait).second.docbooktagtype; docbookattr_ = (*lait).second.docbookattr; diff --git a/src/insets/InsetArgument.h b/src/insets/InsetArgument.h index 0bf1887662..1e6b4a43c9 100644 --- a/src/insets/InsetArgument.h +++ b/src/insets/InsetArgument.h @@ -76,6 +76,8 @@ public: /// bool isPassThru() const override { return pass_thru_; } /// + bool inheritFont() const override { return inherit_font_; } + /// bool isFreeSpacing() const override { return free_spacing_; } /// bool isTocCaption() const { return is_toc_caption_; } @@ -123,6 +125,8 @@ private: /// Effective pass-thru setting (inherited or local) bool pass_thru_; /// + bool inherit_font_; + /// bool free_spacing_; /// docstring escape_chars_; diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp index 4b0ef41ae0..988fef6781 100644 --- a/src/insets/InsetLayout.cpp +++ b/src/insets/InsetLayout.cpp @@ -871,6 +871,7 @@ void InsetLayout::readArgument(Lexer & lex) arg.labelfont = inherit_font; arg.is_toc_caption = false; arg.free_spacing = false; + arg.inh_font = true; arg.passthru = PT_INHERITED; arg.nodelims = false; string nr; @@ -955,6 +956,9 @@ void InsetLayout::readArgument(Lexer & lex) } else if (tok == "freespacing") { lex.next(); arg.free_spacing = lex.getBool(); + } else if (tok == "inheritfont") { + lex.next(); + arg.inh_font = lex.getBool(); } else if (tok == "docbooktag") { lex.next(); arg.docbooktag = lex.getDocString(); -- lyx-cvs mailing list lyx-cvs@lists.lyx.org https://lists.lyx.org/mailman/listinfo/lyx-cvs