]> git.lyx.org Git - features.git/commitdiff
Add sans serif font "cantarell"
authorKornel Benko <kornel@lyx.org>
Sun, 14 Jul 2019 19:44:58 +0000 (21:44 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:36 +0000 (15:48 +0200)
lib/chkconfig.ltx
lib/latexfonts
lib/lyx2lyx/lyx_2_4.py
src/version.h

index bf357b6daeb5679c202e8dc1254657046911777f..b7643703a6ea97ccedac0cb73d670015bcb9e10b 100644 (file)
 \TestPackage{biolinum}
 \TestPackage{biolinum-type1}
 %\TestFont[glic1000]{cbgreek}% for Greek % suported by LyX but too large to force downloading
+\TestPackage{cantarell}
 \TestPackage{ccfonts}
 \TestFont[ccr10]{concrete} % required by ccfonts
 \TestFont[eorm10]{ecc} % required by ccfonts
index 10b9886dbc30a59c3f4c65eb7d81aa4cc9753d66..c5a6f75459fdb1b57dc6fcb3c7ccb6db983d1506 100644 (file)
@@ -654,6 +654,28 @@ AltFont biolinum-2012
        MoreOptions      1
 EndFont
 
+Font cantarell
+       GuiName         "Cantarell Sans Serif"
+       Family          sf
+       OsfOption       oldstyle
+       Package         cantarell
+       PackageOption   "defaultsans"
+       MoreOptions      1
+       FontEncoding    T2A,T1,OT1
+       ScaleOption     scale=$$val
+       AltFonts        cantarell1
+EndFont
+
+AltFont cantarell1
+       GuiName         "Cantarell Sans Serif"
+       Family          sf
+       OsfOption       oldstyle
+       OsfDefault      0
+       Package         cantarell
+       ScaleOption     scale=$$val
+       FontEncoding    T2A,T1,OT1
+EndFont
+
 Font cmbr
        GuiName          "CM Bright"
        Family           sf
index e0f38ed3b5ba43b5bcb4c735b466453b32e307c9..b555851ee092a819167047103ad054b305cc05aa 100644 (file)
@@ -173,6 +173,9 @@ def createFontMapping(fontlist):
                                   'NotoSansExtralight,extralight'],
                                   "sans", "sf", "noto-sans", "scaled")
             fm.expandFontMapping(['NotoMonoRegular,regular'], "typewriter", "tt", "noto-mono", "scaled")
+        elif font == 'Cantarell':
+            fm.expandFontMapping(['cantarell,defaultsans'],
+                                  "sans", "sf", "cantarell", "scaled", "oldstyle")
     return fm
 
 def convert_fonts(document, fm):
@@ -383,6 +386,22 @@ def revert_AdobeFonts(document):
         if revert_fonts(document, fm, fontmap):
             add_preamble_fonts(document, fontmap)
 
+def convert_CantarellFont(document):
+    " Handle Cantarell font definition to LaTeX "
+
+    if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+        fm = createFontMapping(['Cantarell'])
+        convert_fonts(document, fm)
+
+def revert_CantarellFont(document):
+    " Revert native Cantarell font definition to LaTeX "
+
+    if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+        fontmap = dict()
+        fm = createFontMapping(['Cantarell'])
+        if revert_fonts(document, fm, fontmap, True):
+            add_preamble_fonts(document, fontmap)
+
 def removeFrontMatterStyles(document):
     " Remove styles Begin/EndFrontmatter"
 
@@ -2623,6 +2642,22 @@ def revert_AdobeFonts_xopts(document):
         add_preamble_fonts(document, fontmap)
 
 
+def revert_CantarellFont_xopts(document):
+    " Revert native (extended) Cantarell font definition (with extra options) to LaTeX "
+
+    i = find_token(document.header, '\\use_non_tex_fonts', 0)
+    if i == -1:
+        document.warning("Malformed LyX document: Missing \\use_non_tex_fonts.")
+        return
+    if str2bool(get_value(document.header, "\\use_non_tex_fonts", i)):
+        return
+
+    fontmap = dict()
+    fm = createFontMapping(['Cantarell'])
+    if revert_fonts(document, fm, fontmap, True):
+        add_preamble_fonts(document, fontmap)
+
+
 def convert_osf(document):
     " Convert \\font_osf param to new format "
 
@@ -2882,10 +2917,12 @@ convert = [
            [578, []],
            [579, []],
            [580, []],
-           [581, [convert_osf]]
+           [581, [convert_osf]],
+           [582, [convert_CantarellFont]],
           ]
 
-revert =  [[580, [revert_texfontopts,revert_osf]],
+revert =  [[581, [revert_CantarellFont, revert_CantarellFont_xopts]],
+           [580, [revert_texfontopts,revert_osf]],
            [579, [revert_minionpro, revert_plainNotoFonts_xopts, revert_notoFonts_xopts, revert_IBMFonts_xopts, revert_AdobeFonts_xopts, revert_font_opts]], # keep revert_font_opts last!
            [578, [revert_babelfont]],
            [577, [revert_drs]],
index e42b7a8ed7e205255ac0a82b783740897919fca4..1fb7c5d5f05bfdda10e1f8fef8f9f952aedcff2a 100644 (file)
@@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-#define LYX_FORMAT_LYX 581 // spitz: split osf to font families
-#define LYX_FORMAT_TEX2LYX 581
+#define LYX_FORMAT_LYX 582 // Kornel: Add cantarell sans serif font
+#define LYX_FORMAT_TEX2LYX 582
 
 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
 #ifndef _MSC_VER