fixes name table entries for static files, re issue #519
This commit is contained in:
parent
9e6dd3d7fb
commit
d88ab4204a
5 changed files with 35 additions and 5 deletions
1
Makefile
1
Makefile
|
|
@ -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
|
$(FONTDIR)/static/InterDisplay-%.ttf: $(UFODIR)/InterDisplay-%.ufo build/features_data | $(FONTDIR)/static venv
|
||||||
. $(VENV) ; fontmake -u $< -o ttf --output-path $@ $(FM_ARGS_2)
|
. $(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
|
$(FONTDIR)/static/%.ttf: $(UFODIR)/%.ufo build/features_data | $(FONTDIR)/static venv
|
||||||
. $(VENV) ; fontmake -u $< -o ttf --output-path $@ $(FM_ARGS_2)
|
. $(VENV) ; fontmake -u $< -o ttf --output-path $@ $(FM_ARGS_2)
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,7 @@ def main():
|
||||||
|
|
||||||
family = "Inter Display"
|
family = "Inter Display"
|
||||||
style = remove_substring(getStyleName(font), "Display")
|
style = remove_substring(getStyleName(font), "Display")
|
||||||
|
isItalic = style.find('Italic') != -1
|
||||||
if style == '':
|
if style == '':
|
||||||
style = 'Regular'
|
style = 'Regular'
|
||||||
|
|
||||||
|
|
@ -110,14 +111,16 @@ def main():
|
||||||
id[3] = fullNamePs
|
id[3] = fullNamePs
|
||||||
rec.string = ";".join(id)
|
rec.string = ";".join(id)
|
||||||
elif id == LEGACY_FAMILY: # ID 1
|
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
|
elif id == PREFERRED_FAMILY: # ID 16
|
||||||
rec.string = family
|
rec.string = family
|
||||||
elif id == WWS_FAMILY: # ID 21
|
elif id == WWS_FAMILY: # ID 21
|
||||||
rec.string = family
|
rec.string = family
|
||||||
elif id == WWS_SUBFAMILY: # ID 22
|
elif id == WWS_SUBFAMILY: # ID 22
|
||||||
rec.string = style
|
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
|
rec.string = style
|
||||||
|
|
||||||
# print("————————————————————————————————————————————————————")
|
# print("————————————————————————————————————————————————————")
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,14 @@
|
||||||
import sys
|
import sys, re
|
||||||
import defcon
|
import defcon
|
||||||
|
|
||||||
|
|
||||||
|
WHITESPACE_RE = re.compile(r'\s+')
|
||||||
|
|
||||||
|
|
||||||
|
def rmspace(s):
|
||||||
|
return WHITESPACE_RE.sub('', s)
|
||||||
|
|
||||||
|
|
||||||
# See https://github.com/rsms/inter/issues/508
|
# See https://github.com/rsms/inter/issues/508
|
||||||
# TODO: Remove when https://github.com/googlefonts/glyphsLib/issues/821 is fixed
|
# TODO: Remove when https://github.com/googlefonts/glyphsLib/issues/821 is fixed
|
||||||
def fix_fractional_advance_width(ufo):
|
def fix_fractional_advance_width(ufo):
|
||||||
|
|
@ -19,6 +26,20 @@ def main(argv):
|
||||||
ufo_file = argv[1]
|
ufo_file = argv[1]
|
||||||
ufo = defcon.Font(ufo_file)
|
ufo = defcon.Font(ufo_file)
|
||||||
fix_fractional_advance_width(ufo)
|
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)
|
ufo.save(ufo_file)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4040,6 +4040,7 @@ instanceInterpolations = {
|
||||||
};
|
};
|
||||||
isBold = 1;
|
isBold = 1;
|
||||||
isItalic = 1;
|
isItalic = 1;
|
||||||
|
linkStyle = Regular;
|
||||||
name = "Bold Italic";
|
name = "Bold Italic";
|
||||||
weightClass = 700;
|
weightClass = 700;
|
||||||
},
|
},
|
||||||
|
|
@ -4511,6 +4512,7 @@ m010 = 0.52;
|
||||||
};
|
};
|
||||||
isBold = 1;
|
isBold = 1;
|
||||||
isItalic = 1;
|
isItalic = 1;
|
||||||
|
linkStyle = Regular;
|
||||||
name = "Bold Italic";
|
name = "Bold Italic";
|
||||||
properties = (
|
properties = (
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3987,6 +3987,7 @@ instanceInterpolations = {
|
||||||
"C698F293-3EC0-4A5A-A3A0-0FDB1F5CF265" = 0.48;
|
"C698F293-3EC0-4A5A-A3A0-0FDB1F5CF265" = 0.48;
|
||||||
};
|
};
|
||||||
isBold = 1;
|
isBold = 1;
|
||||||
|
linkStyle = Regular;
|
||||||
name = Bold;
|
name = Bold;
|
||||||
weightClass = 700;
|
weightClass = 700;
|
||||||
},
|
},
|
||||||
|
|
@ -4407,7 +4408,7 @@ m007 = 0.48;
|
||||||
m009 = 0.52;
|
m009 = 0.52;
|
||||||
};
|
};
|
||||||
isBold = 1;
|
isBold = 1;
|
||||||
linkStyle = Display;
|
linkStyle = Regular;
|
||||||
name = Bold;
|
name = Bold;
|
||||||
properties = (
|
properties = (
|
||||||
{
|
{
|
||||||
|
|
@ -4460,6 +4461,8 @@ instanceInterpolations = {
|
||||||
m007 = 0.24;
|
m007 = 0.24;
|
||||||
m009 = 0.76;
|
m009 = 0.76;
|
||||||
};
|
};
|
||||||
|
isBold = 1;
|
||||||
|
linkStyle = Medium;
|
||||||
name = ExtraBold;
|
name = ExtraBold;
|
||||||
properties = (
|
properties = (
|
||||||
{
|
{
|
||||||
|
|
@ -4511,6 +4514,8 @@ value = 0;
|
||||||
instanceInterpolations = {
|
instanceInterpolations = {
|
||||||
m009 = 1;
|
m009 = 1;
|
||||||
};
|
};
|
||||||
|
isBold = 1;
|
||||||
|
linkStyle = SemiBold;
|
||||||
name = Black;
|
name = Black;
|
||||||
properties = (
|
properties = (
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Reference in a new issue