From 76f983adaee6116ce9775d959be6e8bbad334f7d Mon Sep 17 00:00:00 2001 From: Rasmus Andersson Date: Mon, 8 Jan 2018 10:26:09 -0800 Subject: Fixes to font metadata, including addition of some OS/2 panose information --- misc/ufocompile | 51 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 12 deletions(-) (limited to 'misc/ufocompile') diff --git a/misc/ufocompile b/misc/ufocompile index c140315a6..f56ae5519 100755 --- a/misc/ufocompile +++ b/misc/ufocompile @@ -133,61 +133,88 @@ def main(): proj = FontProject(rg.font, BASEDIR, os.path.join(srcDir,'fontbuild.cfg'), buildTag=buildTag) proj.builddir = args.out + # panose for entire family + panose = { + 'bFamilyType': 2, # Latin Text + 'bSerifStyle': 11, # Normal Sans + 'bProportion': 2, # Old Style + # bWeight: see http://monotype.de/services/pan2#_Toc380547249 + } + + def mkpanose(weight): + return dict(panose.items() + { + 'bWeight': weight + }.items()) + if args.otf: proj.buildOTF = True - # name syntax: family/longstyle/shortstyle/subfamilyAbbrev + # name syntax: family/styleName/styleCode/subfamilyAbbrev + # + # styleCode should be one of: + # Regular, Italic, Bold, Bold Italic + # # italicNarrowAmount controls scale on the x axis. 1.0 means no scaling. # italicMeanYCenter controls how far on the x axis the glyph should slide # to compensate for the slant. if ALL or 'regular' in styles: handledStyles.append('regular') - proj.generateFont(rg.font, "%s/Regular/Regular/Rg" % FAMILYNAME) + proj.generateFont(rg.font, "%s/Regular/Regular/Rg" % FAMILYNAME, + panose=mkpanose(5)) if ALL or 'italic' in styles: handledStyles.append('italic') - proj.generateFont(rg.font, "%s/Italic/Italic/Rg" % FAMILYNAME, - italic=True, stemWidth=232, italicMeanYCenter=-825, italicNarrowAmount=1) + proj.generateFont( + rg.font, "%s/Italic/Italic/Rg" % FAMILYNAME, + italic=True, stemWidth=232, italicMeanYCenter=-825, italicNarrowAmount=1, + panose=mkpanose(5)) if ALL or 'medium' in styles: handledStyles.append('medium') proj.generateFont( Mix2([rg, bl], 0.35, glyphSpecializations.get('medium', {})), - "%s/Medium/Regular/Me" % FAMILYNAME) + "%s/Medium/Regular/Me" % FAMILYNAME, + panose=mkpanose(6)) if ALL or 'mediumitalic' in styles: handledStyles.append('mediumitalic') proj.generateFont( Mix2([rg, bl], 0.35, glyphSpecializations.get('medium', {})), "%s/Medium Italic/Italic/Me" % FAMILYNAME, - italic=True, stemWidth=300, italicMeanYCenter=-825, italicNarrowAmount=1) + italic=True, stemWidth=300, italicMeanYCenter=-825, italicNarrowAmount=1, + panose=mkpanose(6)) if ALL or 'bold' in styles: handledStyles.append('bold') proj.generateFont( Mix2([rg, bl], 0.65, glyphSpecializations.get('bold', {})), - "%s/Bold/Bold/Bd" % FAMILYNAME) + "%s/Bold/Bold/Rg" % FAMILYNAME, + panose=mkpanose(8)) if ALL or 'bolditalic' in styles: handledStyles.append('bolditalic') proj.generateFont( Mix2([rg, bl], 0.65, glyphSpecializations.get('bold', {})), - "%s/Bold Italic/Bold Italic/Bd" % FAMILYNAME, - italic=True, stemWidth=350, italicMeanYCenter=-825, italicNarrowAmount=1) + "%s/Bold Italic/Bold Italic/Rg" % FAMILYNAME, + italic=True, stemWidth=350, italicMeanYCenter=-825, italicNarrowAmount=1, + panose=mkpanose(8)) if ALL or 'black' in styles: handledStyles.append('black') - proj.generateFont(bl.font, "%s/Black/Regular/Bl" % FAMILYNAME) + proj.generateFont(bl.font, "%s/Black/Regular/Bl" % FAMILYNAME, + panose=mkpanose(9)) if ALL or 'blackitalic' in styles: handledStyles.append('blackitalic') - proj.generateFont(bl.font, "%s/Black Italic/Italic/Bl" % FAMILYNAME, - italic=True, stemWidth=400, italicMeanYCenter=-825, italicNarrowAmount=1) + proj.generateFont( + bl.font, "%s/Black Italic/Italic/Bl" % FAMILYNAME, + italic=True, stemWidth=400, italicMeanYCenter=-825, italicNarrowAmount=1, + panose=mkpanose(9)) # generate TTFs if args.no_ttf == False: -- cgit v1.2.3