]> git.lyx.org Git - features.git/commitdiff
Merge the two noto regular fonts
authorJuergen Spitzmueller <spitz@lyx.org>
Thu, 18 Jul 2019 06:41:00 +0000 (08:41 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 18 Jun 2020 13:48:37 +0000 (15:48 +0200)
These are actually the same font and shape, so no need for two entries

lib/latexfonts
lib/lyx2lyx/lyx_2_4.py

index a18aa2e9f445214c7e89dd29e6b46ff9394f692a..017c45f264aa5f7c37e8f1a2858a19d3ba967ec7 100644 (file)
@@ -370,65 +370,58 @@ Font newcent
 EndFont
 
 Font NotoSerifRegular
-       GuiName         "Noto Serif"
-       Family          rm
-       Package         noto-serif
-       OsfOption       osf
+       GuiName          "Noto Serif"
+       Family           rm
+       Package          noto-serif
+       OsfOption        osf
+       MoreOptions      1
+       CompleteFont     noto
+EndFont
+
+AltFont noto
+       GuiName          "Noto Serif"
+       Family           rm
+       Package          noto
+       OsfOption        osf
        MoreOptions      1
 EndFont
 
 Font NotoSerifMedium
-       GuiName         "Noto Serif (Medium)"
-       Family          rm
-       Package         noto-serif
-       PackageOptions  medium
-       OsfDefault      0
-       OsfOption       osf
+       GuiName          "Noto Serif (Medium)"
+       Family           rm
+       Package          noto-serif
+       PackageOptions   medium
+       OsfDefault       0
+       OsfOption        osf
        MoreOptions      1
 EndFont
 
 Font NotoSerifThin
-       GuiName         "Noto Serif (Thin)"
-       Family          rm
-       Package         noto-serif
-       PackageOptions  thin
-       OsfDefault      0
-       OsfOption       osf
+       GuiName          "Noto Serif (Thin)"
+       Family           rm
+       Package          noto-serif
+       PackageOptions   thin
+       OsfDefault       0
+       OsfOption        osf
        MoreOptions      1
 EndFont
 
 Font NotoSerifLight
-       GuiName         "Noto Serif (Light)"
-       Family          rm
-       Package         noto-serif
-       PackageOptions  light
-       OsfDefault      0
-       OsfOption       osf
+       GuiName          "Noto Serif (Light)"
+       Family           rm
+       Package          noto-serif
+       PackageOptions   light
+       OsfDefault       0
+       OsfOption        osf
        MoreOptions      1
 EndFont
 
 Font NotoSerifExtralight
-       GuiName         "Noto Serif (Extralight)"
-       Family          rm
-       Package         noto-serif
-       PackageOptions  extralight
-       OsfDefault      0
-       OsfOption       osf
-       MoreOptions     1
-EndFont
-
-Font NotoSerif-TLF
-       GuiName          "Noto Serif"
-       Family           rm
-       SwitchDefault    1
-       Requires         noto
-       CompleteFont     noto
-EndFont
-
-AltFont noto
-       GuiName          "Noto Serif"
+       GuiName          "Noto Serif (Extralight)"
        Family           rm
-       Package          noto
+       Package          noto-serif
+       PackageOptions   extralight
+       OsfDefault       0
        OsfOption        osf
        MoreOptions      1
 EndFont
@@ -917,7 +910,7 @@ Font NotoSansRegular
        Package         noto-sans
        OsfDefault      0
        OsfOption       osf
-       MoreOptions      1
+       MoreOptions     1
 EndFont
 
 Font NotoSansMedium
@@ -928,7 +921,7 @@ Font NotoSansMedium
         PackageOptions  medium
        OsfDefault      0
        OsfOption       osf
-       MoreOptions      1
+       MoreOptions     1
 EndFont
 
 Font NotoSansThin
@@ -939,7 +932,7 @@ Font NotoSansThin
        PackageOptions  thin
        OsfDefault      0
        OsfOption       osf
-       MoreOptions      1
+       MoreOptions     1
 EndFont
 
 Font NotoSansLight
@@ -950,7 +943,7 @@ Font NotoSansLight
        PackageOptions  light
        OsfDefault      0
        OsfOption       osf
-       MoreOptions      1
+       MoreOptions     1
 EndFont
 
 Font NotoSansExtralight
@@ -961,14 +954,7 @@ Font NotoSansExtralight
        PackageOptions  extralight
        OsfDefault      0
        OsfOption       osf
-       MoreOptions      1
-EndFont
-
-Font NotoSans-TLF
-       GuiName          "Noto Sans"
-       Family           sf
-       SwitchDefault    1
-       Requires         noto
+       MoreOptions     1
 EndFont
 
 Font PTSans-TLF
index 61066ab8cca6559844cd5fae9052cfcebbc7316d..4f2fcf7280855afb0a90a06162a7d3e1c7320242 100644 (file)
@@ -2966,8 +2966,6 @@ def convert_Semibolds(document):
     else:
         NonTeXFonts = str2bool(get_value(document.header, "\\use_non_tex_fonts", i))
 
-    sbfonts = ["IBMPlexSerifSemibold", "IBMPlexSansSemibold", "IBMPlexMonoSemibold" ]
-
     i = find_token(document.header, "\\font_roman", 0)
     if i == -1:
         document.warning("Malformed LyX document: Missing \\font_roman.")
@@ -3047,6 +3045,43 @@ def convert_Semibolds(document):
                     document.header[x] = "\\font_typewriter_opts \"semibold, " + sfopts[1].strip('"') + "\""
 
 
+def convert_NotoRegulars(document):
+    " Merge diverse noto reagular fonts "
+
+    i = find_token(document.header, "\\font_roman", 0)
+    if i == -1:
+        document.warning("Malformed LyX document: Missing \\font_roman.")
+    else:
+        # We need to use this regex since split() does not handle quote protection
+        romanfont = re.findall(r'[^"\s]\S*|".+?"', document.header[i])
+        roman = romanfont[1].strip('"')
+        if roman == "NotoSerif-TLF":
+            romanfont[1] = '"NotoSerifRegular"'
+            document.header[i] = " ".join(romanfont)
+
+    i = find_token(document.header, "\\font_sans", 0)
+    if i == -1:
+        document.warning("Malformed LyX document: Missing \\font_sans.")
+    else:
+        # We need to use this regex since split() does not handle quote protection
+        sffont = re.findall(r'[^"\s]\S*|".+?"', document.header[i])
+        sf = sffont[1].strip('"')
+        if sf == "NotoSans-TLF":
+            sffont[1] = '"NotoSansRegular"'
+            document.header[i] = " ".join(sffont)
+
+    i = find_token(document.header, "\\font_typewriter", 0)
+    if i == -1:
+        document.warning("Malformed LyX document: Missing \\font_typewriter.")
+    else:
+        # We need to use this regex since split() does not handle quote protection
+        ttfont = re.findall(r'[^"\s]\S*|".+?"', document.header[i])
+        tt = ttfont[1].strip('"')
+        if tt == "NotoMono-TLF":
+            ttfont[1] = '"NotoMonoRegular"'
+            document.header[i] = " ".join(ttfont)
+
+
 ##
 # Conversion hub
 #
@@ -3091,7 +3126,7 @@ convert = [
            [580, []],
            [581, [convert_osf]],
            [582, [convert_AdobeFonts,convert_latexFonts,convert_notoFonts,convert_CantarellFont,convert_FiraFont]],# old font re-converterted due to extra options
-           [583, [convert_ChivoFont,convert_Semibolds]],
+           [583, [convert_ChivoFont,convert_Semibolds,convert_NotoRegulars]],
           ]
 
 revert =  [[582, [revert_ChivoFont]],