fixes name table entries for static files, re issue #519

This commit is contained in:
Rasmus Andersson 2023-06-08 10:10:47 -07:00
parent 9e6dd3d7fb
commit d88ab4204a
5 changed files with 35 additions and 5 deletions

View file

@ -170,7 +170,6 @@ $(FONTDIR)/static/%.otf: $(UFODIR)/%.ufo build/features_data | $(FONTDIR)/static
$(FONTDIR)/static/InterDisplay-%.ttf: $(UFODIR)/InterDisplay-%.ufo build/features_data | $(FONTDIR)/static venv
. $(VENV) ; fontmake -u $< -o ttf --output-path $@ $(FM_ARGS_2)
. $(VENV) ; python misc/tools/fix-static-display-names.py $@
$(FONTDIR)/static/%.ttf: $(UFODIR)/%.ufo build/features_data | $(FONTDIR)/static venv
. $(VENV) ; fontmake -u $< -o ttf --output-path $@ $(FM_ARGS_2)

View file

@ -81,6 +81,7 @@ def main():
family = "Inter Display"
style = remove_substring(getStyleName(font), "Display")
isItalic = style.find('Italic') != -1
if style == '':
style = 'Regular'
@ -110,14 +111,16 @@ def main():
id[3] = fullNamePs
rec.string = ";".join(id)
elif id == LEGACY_FAMILY: # ID 1
rec.string = family
rec.string = family + ' ' + style
elif id == SUBFAMILY_NAME: # ID 2
rec.string = 'Italic' if isItalic else 'Regular'
elif id == PREFERRED_FAMILY: # ID 16
rec.string = family
elif id == WWS_FAMILY: # ID 21
rec.string = family
elif id == WWS_SUBFAMILY: # ID 22
rec.string = style
elif id in (SUBFAMILY_NAME, TYPO_SUBFAMILY_NAME): # ID 2, ID 17
elif id == TYPO_SUBFAMILY_NAME: # ID 17
rec.string = style
# print("————————————————————————————————————————————————————")

View file

@ -1,7 +1,14 @@
import sys
import sys, re
import defcon
WHITESPACE_RE = re.compile(r'\s+')
def rmspace(s):
return WHITESPACE_RE.sub('', s)
# See https://github.com/rsms/inter/issues/508
# TODO: Remove when https://github.com/googlefonts/glyphsLib/issues/821 is fixed
def fix_fractional_advance_width(ufo):
@ -19,6 +26,20 @@ def main(argv):
ufo_file = argv[1]
ufo = defcon.Font(ufo_file)
fix_fractional_advance_width(ufo)
# fix legacy names to make style linking work in MS Windows
familyName = ufo.info.familyName # e.g. "Inter Display"
styleName = ufo.info.styleName # e.g. "ExtraBold"
ufo.info.openTypeNamePreferredFamilyName = familyName
ufo.info.openTypeNamePreferredSubfamilyName = styleName
ufo.info.familyName = familyName + ' ' + styleName
ufo.info.styleName = 'Regular' if styleName.find('Italic') == -1 else 'Italic'
# must also set these explicitly to avoid PostScript names like "Inter-ThinRegular":
# "postscriptFontName" maps to name ID 6 "postscriptName"
ufo.info.postscriptFontName = rmspace(familyName) + '-' + rmspace(styleName)
ufo.save(ufo_file)

View file

@ -4040,6 +4040,7 @@ instanceInterpolations = {
};
isBold = 1;
isItalic = 1;
linkStyle = Regular;
name = "Bold Italic";
weightClass = 700;
},
@ -4511,6 +4512,7 @@ m010 = 0.52;
};
isBold = 1;
isItalic = 1;
linkStyle = Regular;
name = "Bold Italic";
properties = (
{

View file

@ -3987,6 +3987,7 @@ instanceInterpolations = {
"C698F293-3EC0-4A5A-A3A0-0FDB1F5CF265" = 0.48;
};
isBold = 1;
linkStyle = Regular;
name = Bold;
weightClass = 700;
},
@ -4407,7 +4408,7 @@ m007 = 0.48;
m009 = 0.52;
};
isBold = 1;
linkStyle = Display;
linkStyle = Regular;
name = Bold;
properties = (
{
@ -4460,6 +4461,8 @@ instanceInterpolations = {
m007 = 0.24;
m009 = 0.76;
};
isBold = 1;
linkStyle = Medium;
name = ExtraBold;
properties = (
{
@ -4511,6 +4514,8 @@ value = 0;
instanceInterpolations = {
m009 = 1;
};
isBold = 1;
linkStyle = SemiBold;
name = Black;
properties = (
{