]> git.lyx.org Git - lyx.git/commitdiff
Introduce new InsetLayout tag InheritFont
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sun, 16 Jul 2023 17:05:55 +0000 (19:05 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Sat, 22 Jul 2023 13:53:14 +0000 (15:53 +0200)
The font inside the inset is inherited from the parent for LaTeX
export if this parameter is true, as well as on screen. Otherwise
the document default font is used.

The default value is true.

Update tufte layouts to use this tag for sidenote and marginnote flex
insets.

Increase layout format to 101.

Fixes bug #12238.

lib/doc/Customization.lyx
lib/layouts/tufte-book.layout
lib/scripts/layout2layout.py
src/insets/Inset.h
src/insets/InsetLayout.cpp
src/insets/InsetLayout.h

index dea9d98161898e72a2178ad8e21182a85e914cf2..411c74fba8dc99484c0a5cc1e38fcd770e0c5601 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 615
+\lyxformat 616
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -144,6 +144,7 @@ logicalmkup
 \author 177693 "x"
 \author 5863208 "ab"
 \author 34634807 "Jean-Pierre"
+\author 47243155 "Jean-Marc"
 \author 232239728 "Owner"
 \author 731793113 "Richard Kimberly Heck" rikiheck@lyx.org
 \author 1075283030 "Thibaut"
@@ -21833,6 +21834,60 @@ nolink "false"
 \end_inset
 
 .
+\change_inserted 47243155 1689528605
+
+\end_layout
+
+\begin_layout Description
+
+\change_inserted 47243155 1689528735
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 47243155 1689528630
+InheritFont
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 47243155 1689528607
+0
+\end_layout
+
+\end_inset
+
+,
+\begin_inset space \thinspace{}
+\end_inset
+
+
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted 47243155 1689528607
+
+\emph on
+1
+\end_layout
+
+\end_inset
+
+] The font inside the inset is inherited from the parent for \SpecialChar LaTeX
+ export if this parameter is 1,
+ as well as on screen.
+ Otherwise the document default font is used.
+\change_unchanged
+
 \end_layout
 
 \begin_layout Description
index 5d8ab6821233bdeff7e51cbeae9f6e2c6cffa15e..03d33389048b6a805326a19cd336333c4cb69a47 100644 (file)
@@ -162,6 +162,8 @@ InsetLayout Flex:Sidenote
        LatexName               sidenote
        Decoration              classic
        LabelString             "sidenote"
+       ResetsFont              true
+       InheritFont             false
        Font
          Color                 foreground
          Size                  Small
@@ -177,7 +179,6 @@ InsetLayout Flex:Sidenote
     DocBookAttr     role='sidenote'
        DocBookItemTag  para
     DocBookTagType  inline
-       ResetsFont              true
 End
 
 InsetLayout Flex:Marginnote
@@ -185,11 +186,6 @@ InsetLayout Flex:Marginnote
        LatexName               marginnote
        Decoration              classic
        LabelString             "marginnote"
-       Font
-         Family                Roman
-         Shape                 Up
-         Series                Medium
-       EndFont
     DocBookAttr     role='marginnote'
        MultiPar                true
 End
@@ -199,6 +195,7 @@ InsetLayout Flex:NewThought
        LatexType               Command
        LatexName               newthought
        LabelString             "new thought"
+       ResetsFont              true
        Font
          Shape                 SmallCaps
        EndFont
@@ -206,7 +203,6 @@ InsetLayout Flex:NewThought
          Family                Roman
          Color                 textlabel3
        EndFont
-       ResetsFont              true
        DocBookTag      emphasis
        DocBookAttr     role='newthought'
     DocBookTagType  inline
index e718017cbeda8346cb138416578be10a8c94ae31..46a433cc229c21b36d5b3e5852c92e3976df3a39 100644 (file)
@@ -11,7 +11,7 @@
 # This script will update a .layout file to current format
 
 # The latest layout format is also defined in src/TextClass.cpp
-currentFormat = 100
+currentFormat = 101
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -337,6 +337,9 @@ currentFormat = 100
 # Incremented to format 100, 9 May 2023 by forenr
 # Add inset label color
 
+# Incremented to format 101, 22 July 2023 by lasgouttes
+# add InsetLayout tag InheritFont
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -583,7 +586,7 @@ def convert(lines, end_format):
                 i += 1
             continue
 
-        if 87 <= format <= 100:
+        if 87 <= format <= 101:
             # nothing to do.
             i += 1
             continue
index 0ee6b12685d8356035476a8cda732d5b1fbd92f6..1b7adb5e8986d3fae050cbf057f9431734eaafe3 100644 (file)
@@ -579,7 +579,7 @@ public:
         * LaTeX export if this method returns true, as well as on screen.
         * Otherwise the document default font is used.
         */
-       virtual bool inheritFont() const { return true; }
+       virtual bool inheritFont() const { return getLayout().inheritFont(); }
        /**
         * If this method returns true all explicitly set font attributes
         * are reset during editing operations.
index 9636e100429f8126a386e5867ce6616c0c3eca1d..ab6108a060d1e0a42fe2889e898f4496e5c8dab6 100644 (file)
@@ -113,6 +113,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
                IL_DOCBOOKINNERATTR,
         IL_DOCBOOKNOFONTINSIDE,
         IL_DOCBOOKRENDERASIMAGE,
+               IL_INHERITFONT,
                IL_INTOC,
                IL_ISTOCCAPTION,
                IL_LABELFONT,
@@ -198,6 +199,7 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
                { "htmlpreamble", IL_HTMLPREAMBLE },
                { "htmlstyle", IL_HTMLSTYLE },
                { "htmltag", IL_HTMLTAG },
+               { "inheritfont", IL_INHERITFONT },
                { "intoc", IL_INTOC },
                { "istoccaption", IL_ISTOCCAPTION },
                { "keepempty", IL_KEEPEMPTY },
@@ -339,6 +341,9 @@ bool InsetLayout::read(Lexer & lex, TextClass const & tclass,
                case IL_FORCEOWNLINES:
                        lex >> forceownlines_;
                        break;
+               case IL_INHERITFONT:
+                       lex >> inheritfont_;
+                       break;
                case IL_INTOC:
                        lex >> intoc_;
                        break;
index 4bf84c64a5b1ed3fe7999bea7d31a7554adb0c50..2342543396b10c6a9368995c6683fc4b5bd08eeb 100644 (file)
@@ -84,6 +84,8 @@ public:
        ///
        docstring rightdelim() const { return rightdelim_; }
        ///
+       bool inheritFont() const { return inheritfont_; }
+       ///
        FontInfo font() const { return font_; }
        ///
        FontInfo labelfont() const { return labelfont_; }
@@ -288,6 +290,8 @@ private:
        ///
        FontInfo labelfont_ = sane_font;
        ///
+       bool inheritfont_ = true;
+       ///
        ColorCode bgcolor_ = Color_error;
        ///
        docstring counter_;