]> git.lyx.org Git - features.git/commitdiff
Add FontSizeFormat textclass option
authorJuergen Spitzmueller <spitz@lyx.org>
Tue, 6 Aug 2019 17:27:49 +0000 (19:27 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:42 +0000 (15:48 +0200)
This allows to customize the way fontsizes are passed to the class (e.g.,
"fontsize=12", as used by KOMA, rather than "12pt").

lib/doc/Customization.lyx
lib/doc/de/Customization.lyx
lib/scripts/layout2layout.py
src/BufferParams.cpp
src/TextClass.cpp
src/TextClass.h

index b51fe1451ed9e9272da20aa99104965364990f05..952535801e736812555577a4269f5a5b3ccc0517 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 584
+\lyxformat 585
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -11536,8 +11536,65 @@ status collapsed
 
 .
 
-\change_inserted -712698321 1565102054
+\change_inserted -712698321 1565110196
  Any number is possible.
+\end_layout
+
+\begin_layout Description
+
+\change_inserted -712698321 1565110259
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1565110199
+FontSizeFormat
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1565110196
+string
+\end_layout
+
+\end_inset
+
+] The format for the font size option.
+ Default: 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1565110238
+$$spt
+\change_unchanged
+
+\end_layout
+
+\end_inset
+
+.
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+
+\change_inserted -712698321 1565110248
+$$s
+\end_layout
+
+\end_inset
+
+ is a placeholder for the font size.
 \change_unchanged
 
 \end_layout
index 9557599097102575fe94a325c6082c29047666d9..27ad41f6056ef318d85c9f9a6a57b0f583371162 100644 (file)
@@ -1,5 +1,5 @@
 #LyX 2.4 created this file. For more info see https://www.lyx.org/
-\lyxformat 584
+\lyxformat 585
 \begin_document
 \begin_header
 \save_transient_properties true
@@ -9677,6 +9677,51 @@ status collapsed
 \begin_inset Flex Code
 status collapsed
 
+\begin_layout Plain Layout
+FontSizeFormat
+\end_layout
+
+\end_inset
+
+ [
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+string
+\end_layout
+
+\end_inset
+
+] Das Format der Schriftgrößen-Option.
+ Voreinstellung: 
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+$$spt
+\end_layout
+
+\end_inset
+
+.
+\begin_inset Flex Code
+status collapsed
+
+\begin_layout Plain Layout
+$$s
+\end_layout
+
+\end_inset
+
+ ist ein Platzhalter für die Schriftgröße.
+\end_layout
+
+\begin_layout Description
+\begin_inset Flex Code
+status collapsed
+
 \begin_layout Plain Layout
 Header
 \end_layout
index 4c9679f33592ad1471b0a7d236d0cff526eba76d..0009c54c92c5d761b45a277867a35f8374d403f2 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 = 77
+currentFormat = 78
 
 
 # Incremented to format 4, 6 April 2007, lasgouttes
@@ -259,6 +259,9 @@ currentFormat = 77
 # New textclass tag PageSize (= default page size) 
 # and textclass option PageSize (= list of available page sizes)
 
+# Incremented to format 78, 6 August 2019 by spitz
+# New textclass tag FontsizeFormat
+
 # Do not forget to document format change in Customization
 # Manual (section "Declaring a new text class").
 
@@ -508,7 +511,7 @@ def convert(lines, end_format):
                 i += 1
             continue
 
-        if format >= 65 and format <= 76:
+        if format >= 65 and format <= 77:
             # nothing to do.
             i += 1
             continue
index 40d59f920aca0bfd047d06a615a69c9a4654947e..f964c8027baff4ca20bb758376957a633a12d492 100644 (file)
@@ -1617,7 +1617,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        if (tokenPos(tclass.opt_fontsize(),
                     '|', fontsize) >= 0) {
                // only write if existing in list (and not default)
-               clsoptions << fontsize << "pt,";
+               clsoptions << subst(tclass.fontsizeformat(), "$$s", fontsize) << ",";
        }
 
        // paper sizes not supported by the class itself need the
index 5a36fce1fc45b7ded02678a87c59457efe26b6f5..8b54a4cded2d81794f545968eea8039bd9cca94a 100644 (file)
@@ -62,7 +62,7 @@ namespace lyx {
 // You should also run the development/tools/updatelayouts.py script,
 // to update the format of all of our layout files.
 //
-int const LAYOUT_FORMAT = 77; // spitz: pagesize
+int const LAYOUT_FORMAT = 78; // spitz: FontsizeFormat
 
 
 // Layout format for the current lyx file format. Controls which format is
@@ -151,8 +151,8 @@ TextClass::TextClass()
        : loaded_(false), tex_class_avail_(false),
          opt_enginetype_("authoryear|numerical"), opt_fontsize_("10|11|12"),
          opt_pagesize_("default|a4paper|a5paper|b5paper|letterpaper|legalpaper|executivepaper"),
-         opt_pagestyle_("empty|plain|headings|fancy"), pagesize_("default"), pagestyle_("default"),
-         tablestyle_("default"), columns_(1), sides_(OneSide), secnumdepth_(3),
+         opt_pagestyle_("empty|plain|headings|fancy"), fontsize_format_("$$spt"), pagesize_("default"),
+         pagestyle_("default"), tablestyle_("default"), columns_(1), sides_(OneSide), secnumdepth_(3),
          tocdepth_(3), outputType_(LATEX), outputFormat_("latex"),
          has_output_format_(false), defaultfont_(sane_font), 
          titletype_(TITLE_COMMAND_AFTER), titlename_("maketitle"),
@@ -1004,6 +1004,7 @@ void TextClass::readClassOptions(Lexer & lexrc)
 {
        enum {
                CO_FONTSIZE = 1,
+               CO_FONTSIZE_FORMAT,
                CO_PAGESIZE,
                CO_PAGESTYLE,
                CO_OTHER,
@@ -1014,6 +1015,7 @@ void TextClass::readClassOptions(Lexer & lexrc)
        LexerKeyword classOptionsTags[] = {
                {"end",       CO_END },
                {"fontsize",  CO_FONTSIZE },
+               {"fontsizeformat", CO_FONTSIZE_FORMAT },
                {"header",    CO_HEADER },
                {"other",     CO_OTHER },
                {"pagesize",  CO_PAGESIZE },
@@ -1036,6 +1038,10 @@ void TextClass::readClassOptions(Lexer & lexrc)
                        lexrc.next();
                        opt_fontsize_ = rtrim(lexrc.getString());
                        break;
+               case CO_FONTSIZE_FORMAT:
+                       lexrc.next();
+                       fontsize_format_ = rtrim(lexrc.getString());
+                       break;
                case CO_PAGESIZE:
                        lexrc.next();
                        opt_pagesize_ = rtrim(lexrc.getString());
index f42b270326e173c6f4aa335c8c6e8fe34a8b0969..1e8582b1f0575c953b00d78145c7609fa4457398 100644 (file)
@@ -276,6 +276,8 @@ protected:
        std::string opt_pagestyle_;
        /// Specific class options
        std::string options_;
+       /// Format of the fontsize option
+       std::string fontsize_format_;
        /// Default page size
        std::string pagesize_;
        ///
@@ -461,6 +463,8 @@ public:
        ///
        std::string const & class_header() const { return class_header_; }
        ///
+       std::string const & fontsizeformat() const { return fontsize_format_; }
+       ///
        std::string const & pagesize() const { return pagesize_; }
        ///
        std::string const & pagestyle() const { return pagestyle_; }