Merge the two noto regular fonts

These are actually the same font and shape, so no need for two entries
This commit is contained in:
Juergen Spitzmueller 2019-07-18 08:41:00 +02:00
parent 2e07502c8b
commit 212314ada7
2 changed files with 86 additions and 65 deletions

View File

@ -370,58 +370,11 @@ Font newcent
EndFont EndFont
Font NotoSerifRegular Font NotoSerifRegular
GuiName "Noto Serif"
Family rm
Package noto-serif
OsfOption osf
MoreOptions 1
EndFont
Font NotoSerifMedium
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
MoreOptions 1
EndFont
Font NotoSerifLight
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" GuiName "Noto Serif"
Family rm Family rm
SwitchDefault 1 Package noto-serif
Requires noto OsfOption osf
MoreOptions 1
CompleteFont noto CompleteFont noto
EndFont EndFont
@ -433,6 +386,46 @@ AltFont noto
MoreOptions 1 MoreOptions 1
EndFont EndFont
Font NotoSerifMedium
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
MoreOptions 1
EndFont
Font NotoSerifLight
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 palatino Font palatino
GuiName "Palatino" GuiName "Palatino"
Family rm Family rm
@ -917,7 +910,7 @@ Font NotoSansRegular
Package noto-sans Package noto-sans
OsfDefault 0 OsfDefault 0
OsfOption osf OsfOption osf
MoreOptions 1 MoreOptions 1
EndFont EndFont
Font NotoSansMedium Font NotoSansMedium
@ -928,7 +921,7 @@ Font NotoSansMedium
PackageOptions medium PackageOptions medium
OsfDefault 0 OsfDefault 0
OsfOption osf OsfOption osf
MoreOptions 1 MoreOptions 1
EndFont EndFont
Font NotoSansThin Font NotoSansThin
@ -939,7 +932,7 @@ Font NotoSansThin
PackageOptions thin PackageOptions thin
OsfDefault 0 OsfDefault 0
OsfOption osf OsfOption osf
MoreOptions 1 MoreOptions 1
EndFont EndFont
Font NotoSansLight Font NotoSansLight
@ -950,7 +943,7 @@ Font NotoSansLight
PackageOptions light PackageOptions light
OsfDefault 0 OsfDefault 0
OsfOption osf OsfOption osf
MoreOptions 1 MoreOptions 1
EndFont EndFont
Font NotoSansExtralight Font NotoSansExtralight
@ -961,14 +954,7 @@ Font NotoSansExtralight
PackageOptions extralight PackageOptions extralight
OsfDefault 0 OsfDefault 0
OsfOption osf OsfOption osf
MoreOptions 1 MoreOptions 1
EndFont
Font NotoSans-TLF
GuiName "Noto Sans"
Family sf
SwitchDefault 1
Requires noto
EndFont EndFont
Font PTSans-TLF Font PTSans-TLF

View File

@ -2966,8 +2966,6 @@ def convert_Semibolds(document):
else: else:
NonTeXFonts = str2bool(get_value(document.header, "\\use_non_tex_fonts", i)) NonTeXFonts = str2bool(get_value(document.header, "\\use_non_tex_fonts", i))
sbfonts = ["IBMPlexSerifSemibold", "IBMPlexSansSemibold", "IBMPlexMonoSemibold" ]
i = find_token(document.header, "\\font_roman", 0) i = find_token(document.header, "\\font_roman", 0)
if i == -1: if i == -1:
document.warning("Malformed LyX document: Missing \\font_roman.") 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('"') + "\"" 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 # Conversion hub
# #
@ -3091,7 +3126,7 @@ convert = [
[580, []], [580, []],
[581, [convert_osf]], [581, [convert_osf]],
[582, [convert_AdobeFonts,convert_latexFonts,convert_notoFonts,convert_CantarellFont,convert_FiraFont]],# old font re-converterted due to extra options [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]], revert = [[582, [revert_ChivoFont]],