]> git.lyx.org Git - features.git/commitdiff
Extend handling of Noto fonts
authorKornel Benko <kornel@lyx.org>
Sun, 7 Apr 2019 09:05:42 +0000 (11:05 +0200)
committerKornel Benko <kornel@lyx.org>
Sun, 7 Apr 2019 09:05:42 +0000 (11:05 +0200)
Added the possibility to use options Regular, Medium, Thin, Light, Extralight

development/FORMAT
lib/chkconfig.ltx
lib/latexfonts
lib/lyx2lyx/lyx_2_4.py
src/version.h

index d38e809f1704e89cc0ad107714a96c576e90654b..48309d380dc0e6f7f7f3dcad5bd287038a524aac 100644 (file)
@@ -7,6 +7,9 @@ changes happened in particular if possible. A good example would be
 
 -----------------------
 
+2019-04-07  Kornel Benko <kornel@lyx.org>
+       * format incremented to 572: Extended Noto fonts.
+
 2019-04-03  Jürgen Spitzmüller <spitz@lyx.org>
        * format incremented to 571: Add \cmidrule trimming support
           \cmidrule(lr){n-n}
index d8b027f001c196e42f835df72f7a8c292fde2116..dbdb7ed449463e46195cef163a82f04a22af0e9f 100644 (file)
 \TestPackage{newtxmath}
 \TestPackage[binhex.tex]{binhex} % required by newtxmath
 \TestPackage{noto}
+\TestPackage{noto-serif}
+\TestPackage{noto-sans}
+\TestPackage{noto-mono}
 \TestPackage{paratype}
 \TestFont[psyr]{symbol}
 \TestPackage{tgadventor}
index 31f008832ba4ae6bba9bf99f497ff00d527c76e3..53032a441c9832c766f5db63f853e767e96978f1 100644 (file)
@@ -359,6 +359,51 @@ Font newcent
        Package          newcent
 EndFont
 
+Font NotoSerifRegular
+       GuiName         "Noto Serif Regular"
+       Family          rm
+       Package         noto-serif
+       PackageOption   regular
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
+Font NotoSerifMedium
+       GuiName         "Noto Serif Medium"
+       Family          rm
+       Package         noto-serif
+       PackageOption   medium
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
+Font NotoSerifThin
+       GuiName         "Noto Serif Thin"
+       Family          rm
+       Package         noto-serif
+       PackageOption   thin
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
+Font NotoSerifLight
+       GuiName         "Noto Serif Light"
+       Family          rm
+       Package         noto-serif
+       PackageOption   light
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
+Font NotoSerifExtralight
+       GuiName         "Noto Serif Extralight"
+       Family          rm
+       Package         noto-serif
+       PackageOption   extralight
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
 Font NotoSerif-TLF
        GuiName          "Noto Serif"
        Family           rm
@@ -720,6 +765,54 @@ Font lmss
        Requires         lmodern
 EndFont
 
+Font NotoSansRegular
+       GuiName         "Noto Sans Regular"
+       Family          sf
+       ScaleOption     scaled=$$val
+       Package         noto-sans
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
+Font NotoSansMedium
+       GuiName         "Noto Sans Medium"
+       Family          sf
+       ScaleOption     scaled=$$val
+       Package         noto-sans
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
+Font NotoSansThin
+       GuiName         "Noto Sans Thin"
+       Family          sf
+       ScaleOption     scaled=$$val
+       Package         noto-sans
+       PackageOption   thin
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
+Font NotoSansLight
+       GuiName         "Noto Sans Light"
+       Family          sf
+       ScaleOption     scaled=$$val
+       Package         noto-sans
+       PackageOption   light
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
+Font NotoSansExtralight
+       GuiName         "Noto Sans Extralight"
+       Family          sf
+       ScaleOption     scaled=$$val
+       Package         noto-sans
+       PackageOption   extralight
+       OsfDefault      0
+       OsfOption       osf
+EndFont
+
 Font NotoSans-TLF
        GuiName          "Noto Sans"
        Family           sf
@@ -869,6 +962,14 @@ Font luximono
        Package          luximono
 EndFont
 
+Font NotoMonoRegular
+       GuiName         "Noto Mono Regular"
+       Family          tt
+       ScaleOption     scaled=$$val
+       Package         noto-mono
+       PackageOption   regular
+EndFont
+
 Font NotoMono-TLF
        GuiName          "Noto Mono"
        Family           tt
index 3bf7a6b2d1531d237df28c23fd1fc668aac4d25f..6e69e3605e5a32d344340f51f4fd733b8c4089fb 100644 (file)
@@ -158,6 +158,16 @@ def createFontMapping(fontlist):
             fm.expandFontMapping(['ADOBESourceSerifPro'], "roman", None, "sourceserifpro")
             fm.expandFontMapping(['ADOBESourceSansPro'], "sans", "sf", "sourcesanspro", "scaled")
             fm.expandFontMapping(['ADOBESourceCodePro'], "typewriter", "tt", "sourcecodepro", "scaled")
+        elif font == 'Noto':
+            fm.expandFontMapping(['NotoSerifRegular,regular', 'NotoSerifMedium,medium',
+                                  'NotoSerifThin,thin', 'NotoSerifLight,light',
+                                  'NotoSerifExtralight,extralight'],
+                                  "roman", None, "noto-serif")
+            fm.expandFontMapping(['NotoSansRegular,regular', 'NotoSansMedium,medium',
+                                  'NotoSansThin,thin', 'NotoSansLight,light',
+                                  'NotoSansExtralight,extralight'],
+                                  "sans", "sf", "noto-sans", "scaled")
+            fm.expandFontMapping(['NotoMonoRegular'], "typewriter", "tt", "noto-mono", "scaled")
     return fm
 
 def convert_fonts(document, fm):
@@ -273,6 +283,22 @@ def revert_fonts(document, fm, fontmap):
 ###
 ###############################################################################
 
+def convert_notoFonts(document):
+    " Handle Noto fonts definition to LaTeX "
+
+    if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+        fm = createFontMapping(['Noto'])
+        convert_fonts(document, fm)
+
+def revert_notoFonts(document):
+    " Revert native Noto font definition to LaTeX "
+
+    if find_token(document.header, "\\use_non_tex_fonts false", 0) != -1:
+        fontmap = dict()
+        fm = createFontMapping(['Noto'])
+        revert_fonts(document, fm, fontmap)
+        add_preamble_fonts(document, fontmap)
+
 def convert_latexFonts(document):
     " Handle DejaVu and IBMPlex fonts definition to LaTeX "
 
@@ -1608,10 +1634,12 @@ convert = [
            [568, []],
            [569, []],
            [570, []],
-           [571, []]
+           [571, []],
+           [572, [convert_notoFonts]]  # Added options thin, light, extralight for Noto
           ]
 
 revert =  [
+           [571, [revert_notoFonts]],
            [570, [revert_cmidruletrimming]],
            [569, [revert_bibfileencodings]],
            [568, [revert_tablestyle]],
index 2b900966ca054b660c64e8ed60ee6ed886a24e84..bfdc4212ff8e5211f3dcad3021a0b90c8c100332 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 571 // spitz: cmidrule trimming
-#define LYX_FORMAT_TEX2LYX 571
+#define LYX_FORMAT_LYX 572 // kornel: Noto fonts expanded to use more options
+#define LYX_FORMAT_TEX2LYX 572
 
 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
 #ifndef _MSC_VER