diff options
author | Rasmus Andersson <rasmus@notion.se> | 2019-07-19 00:05:31 +0300 |
---|---|---|
committer | Rasmus Andersson <rasmus@notion.se> | 2019-07-19 00:06:00 +0300 |
commit | 3de54b5680647d43f10914ba46dd51d935a3c7df (patch) | |
tree | 6df41d219f7892699d51e6fd150dd63bec067f8b | |
parent | 230d288015545f8f083190d98f22775efec9212b (diff) | |
parent | 20b8b8e26fb7cd8f79562b59c592a0f82962c4c3 (diff) | |
download | inter-3de54b5680647d43f10914ba46dd51d935a3c7df.tar.xz |
Only decompose glyphs with reflected components (#171)
Instead of decomposing a component if any scaling is happening, only decompose a component if xScale < 0 or yScale < 0 (that is, if it is mirrored on the x or y axis). Removes yAxisIsNonTrivial which was set for all italic instances and would cause all composed glyphs to be decomposed.
Closes #169
-rwxr-xr-x | misc/fontbuild | 41 | ||||
-rw-r--r-- | src/Inter.glyphs | 140 |
2 files changed, 88 insertions, 93 deletions
diff --git a/misc/fontbuild b/misc/fontbuild index 1d4a8d801..075886a7e 100755 --- a/misc/fontbuild +++ b/misc/fontbuild @@ -58,26 +58,22 @@ def fatal(msg): -def composedGlyphIsNonTrivial(g, yAxisIsNonTrivial=False): - # A non-trivial glyph is one that is composed from either multiple - # components or that uses component transformations. - # If yAxisIsNonTrivial is true, then any transformation over the Y axis - # is be considered non-trivial. +def composedGlyphIsNonTrivial(g): + # A non-trivial glyph is one that uses reflecting component transformations. if g.components and len(g.components) > 0: - if len(g.components) > 1: - return True for c in g.components: # has non-trivial transformation? (i.e. scaled) # Example of optimally trivial transformation: # (1, 0, 0, 1, 0, 0) no scale or offset # Example of scaled transformation matrix: # (-1.0, 0, 0.3311, 1, 1464.0, 0) flipped x axis, sheered and offset - # - xScale, xyScale, yxScale, yScale, xOffset, yOffset = c.transformation - if xScale != 1 or xyScale != 0 or yxScale != 0 or yScale != 1: - return True - if yAxisIsNonTrivial and yOffset != 0: + # + xScale = c.transformation[0] + yScale = c.transformation[3] + # If glyph is reflected along x or y axes, it won't slant well. + if xScale < 0 or yScale < 0: return True + return False @@ -157,7 +153,7 @@ class VarFontProject(FontProject): **kwargs ): """Build OpenType binaries with interpolatable outlines.""" - # We decompose any glyph with two or more components to make sure + # We decompose any glyph with reflected components to make sure # that fontTools varLib is able to produce properly-slanting interpolation. self._load_designspace_sources(designspace) @@ -179,12 +175,11 @@ class VarFontProject(FontProject): ufo.info.openTypeNamePreferredFamilyName =\ ufo.info.openTypeNamePreferredFamilyName.replace('Inter', self.familyName) updateFontVersion(ufo) - isItalic = ufo.info.italicAngle != 0 ufoname = basename(ufo.path) - + for g in ufo: directives = findGlyphDirectives(g) - if g.components and composedGlyphIsNonTrivial(g, yAxisIsNonTrivial=isItalic): + if g.components and composedGlyphIsNonTrivial(g): decomposeGlyphs.add(g.name) if 'removeoverlap' in directives: if g.components and len(g.components) > 0: @@ -247,7 +242,7 @@ def updateFontVersion(font, dummy=False): # setFontInfo patches font.info -# +# def setFontInfo(font, weight): # # For UFO3 names, see @@ -487,7 +482,7 @@ class Main(object): if outfilename is None or outfilename == '': outfilename = os.path.splitext(basename(args.srcfile))[0] + '.otf' log.info('setting --output %r' % outfilename) - + # build formats list from filename extension formats = [] # for outfilename in args.outputs: @@ -550,7 +545,7 @@ class Main(object): success = False if len(otssan_res) == 0: otssan_res = 'error' - + if success: os.unlink(tmpfile) else: @@ -732,7 +727,7 @@ class Main(object): else: # name "Black" => "black" source.name = source.styleName.lower().replace(' ', '') - + source.path = ufo_path weight = int(source.location['Weight']) @@ -840,11 +835,11 @@ class Main(object): # clear anchors for g in font: g.clearAnchors() - + # update font info weight = instance_weight[basename(font.path)] setFontInfo(font, weight) - + font.save() @@ -875,7 +870,7 @@ class Main(object): argparser.add_argument('files', metavar='<file>', nargs='+', help='Font files') - + args = argparser.parse_args(argv) q = Queue() diff --git a/src/Inter.glyphs b/src/Inter.glyphs index f0e3be58c..4ad966191 100644 --- a/src/Inter.glyphs +++ b/src/Inter.glyphs @@ -1,5 +1,5 @@ { -.appVersion = "1240"; +.appVersion = "1247"; classes = ( { automatic = 1; @@ -26013,7 +26013,7 @@ userData = { }, { glyphname = Idieresis; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26091,7 +26091,7 @@ transform = "{1, 0, 0, 1, -564, 64}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -26105,7 +26105,7 @@ userData = { }, { glyphname = Idieresisacute; -lastChange = "2019-03-30 20:56:26 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26239,7 +26239,7 @@ transform = "{1, 0, 0, 1, 866, 0}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -26251,7 +26251,7 @@ interface.gridadjust.original = "{'width': 1018, 'leftMargin': 28, 'rightMargin' }, { glyphname = Istroke; -lastChange = "2018-12-31 21:21:37 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26329,7 +26329,7 @@ transform = "{1, 0, 0, 1, -220, 64}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); unicode = 0197; @@ -26342,7 +26342,7 @@ interface.gridadjust.original = "{'width': 938, 'leftMargin': 27, 'rightMargin': }, { glyphname = Itildebelow; -lastChange = "2018-12-31 21:21:37 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26420,7 +26420,7 @@ transform = "{1, 0, 0, 1, 1376, 0}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -26435,7 +26435,7 @@ interface.gridadjust.original = "{'width': 1011, 'leftMargin': -13, 'rightMargin }, { glyphname = Igrave; -lastChange = "2019-01-01 00:04:58 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26513,7 +26513,7 @@ transform = "{1, 0, 0, 1, -392, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -26522,7 +26522,7 @@ unicode = 00CC; }, { glyphname = Iacute; -lastChange = "2019-02-10 19:23:45 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26600,7 +26600,7 @@ transform = "{1, 0, 0, 1, -258, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -26609,7 +26609,7 @@ unicode = 00CD; }, { glyphname = Icircumflex; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26687,7 +26687,7 @@ transform = "{1, 0, 0, 1, -156, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -26797,7 +26797,7 @@ unicode = 0128; }, { glyphname = Imacron; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26875,7 +26875,7 @@ transform = "{1, 0, 0, 1, 26, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -26884,7 +26884,7 @@ unicode = 012A; }, { glyphname = Ibreve; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -26962,7 +26962,7 @@ transform = "{1, 0, 0, 1, -148, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -27070,7 +27070,7 @@ unicode = 012E; }, { glyphname = Idotaccent; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -27148,7 +27148,7 @@ transform = "{1, 0, 0, 1, 182, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -27157,7 +27157,7 @@ unicode = 0130; }, { glyphname = Icaron; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -27235,7 +27235,7 @@ transform = "{1, 0, 0, 1, -152, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -27244,7 +27244,7 @@ unicode = 01CF; }, { glyphname = Idblgrave; -lastChange = "2019-02-10 19:12:05 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -27322,7 +27322,7 @@ transform = "{1, 0, 0, 1, 1206, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -27331,7 +27331,7 @@ unicode = 0208; }, { glyphname = Iinvertedbreve; -lastChange = "2018-12-31 21:21:37 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -27409,7 +27409,7 @@ transform = "{1, 0, 0, 1, 1180, 612}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -27418,7 +27418,7 @@ unicode = 020A; }, { glyphname = Ihookabove; -lastChange = "2018-12-31 21:21:37 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -27496,7 +27496,7 @@ transform = "{1, 0, 0, 1, 1144, 572}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -27505,7 +27505,7 @@ unicode = 1EC8; }, { glyphname = Idotbelow; -lastChange = "2019-02-02 20:28:22 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -27583,7 +27583,7 @@ transform = "{1, 0, 0, 1, 1120, 0}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -27592,7 +27592,7 @@ unicode = 1ECA; }, { glyphname = Iota; -lastChange = "2018-12-31 21:21:37 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -27646,7 +27646,7 @@ name = I; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -27753,7 +27753,7 @@ unicode = 038A; }, { glyphname = Iotadieresis; -lastChange = "2018-12-31 21:21:37 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -27807,7 +27807,7 @@ name = Idieresis; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -28614,7 +28614,7 @@ unicode = 1F3F; }, { glyphname = uni1FD8; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -28692,7 +28692,7 @@ transform = "{1, 0, 0, 1, -148, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -28701,7 +28701,7 @@ unicode = 1FD8; }, { glyphname = uni1FD9; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -28779,7 +28779,7 @@ transform = "{1, 0, 0, 1, 26, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -28988,7 +28988,7 @@ unicode = 1FDB; }, { glyphname = afii10055; -lastChange = "2018-12-31 21:21:37 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -29042,7 +29042,7 @@ name = I; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -29051,7 +29051,7 @@ unicode = 0406; }, { glyphname = afii10056; -lastChange = "2019-01-01 00:18:52 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -29129,7 +29129,7 @@ transform = "{1, 0, 0, 1, -488, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = Idieresis; @@ -38019,7 +38019,7 @@ interface.gridadjust.original = "{'width': 2010, 'leftMargin': 241, 'rightMargin }, { glyphname = uni040D; -lastChange = "2019-01-23 15:58:06 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -38093,11 +38093,11 @@ name = afii10026; }, { name = grave; -transform = "{1, 0, 0, 1, 334, 512}"; +transform = "{1, 0, 0, 1, 340, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 2170; +width = 2176; } ); leftKerningGroup = B; @@ -38106,7 +38106,7 @@ unicode = 040D; }, { glyphname = afii10027; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -38180,11 +38180,11 @@ name = afii10026; }, { name = breve; -transform = "{1, 0, 0, 1, 578, 512}"; +transform = "{1, 0, 0, 1, 584, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 2170; +width = 2176; } ); leftKerningGroup = B; @@ -38193,7 +38193,7 @@ unicode = 0419; }, { glyphname = Imacroncyrillic; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -38267,11 +38267,11 @@ name = afii10026; }, { name = macron; -transform = "{1, 0, 0, 1, 752, 512}"; +transform = "{1, 0, 0, 1, 758, 512}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 2170; +width = 2176; } ); leftKerningGroup = B; @@ -38280,7 +38280,7 @@ unicode = 04E2; }, { glyphname = Idieresiscyrillic; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -38354,11 +38354,11 @@ name = afii10026; }, { name = casedieresis.cn; -transform = "{1, 0, 0, 1, 162, 64}"; +transform = "{1, 0, 0, 1, 168, 64}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 2170; +width = 2176; } ); leftKerningGroup = B; @@ -38367,7 +38367,7 @@ unicode = 04E4; }, { glyphname = uni048A; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -38463,15 +38463,15 @@ name = afii10026; }, { name = breve; -transform = "{1, 0, 0, 1, 578, 512}"; +transform = "{1, 0, 0, 1, 584, 512}"; }, { name = cyrillictail.cn; -transform = "{1, 0, 0, 1, 1512, -100}"; +transform = "{1, 0, 0, 1, 1518, -100}"; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 2170; +width = 2176; } ); leftKerningGroup = B; @@ -80416,7 +80416,7 @@ interface.gridadjust.original = "{'width': 989, 'leftMargin': 315, 'rightMargin' }, { glyphname = fdotaccent; -lastChange = "2019-02-04 01:15:21 +0000"; +lastChange = "2019-07-18 20:42:52 +0000"; layers = ( { components = ( @@ -80438,11 +80438,11 @@ name = f; }, { name = dotaccent; -transform = "{1, 0, 0, 1, 240, 512}"; +transform = "{1, 0, 0, 1, 216, 512}"; } ); layerId = "5C20EF92-B63D-42A8-8878-93C2863E0093"; -width = 1156; +width = 1132; }, { components = ( @@ -80464,11 +80464,11 @@ name = f; }, { name = dotaccent; -transform = "{1, 0, 0, 1, 326, 512}"; +transform = "{1, 0, 0, 1, 302, 512}"; } ); layerId = "D0EC06BF-13F9-4C88-A6F5-B8203AF6C77E"; -width = 1156; +width = 1134; }, { components = ( @@ -94300,7 +94300,7 @@ unicode = E05C; }, { glyphname = uni04CF; -lastChange = "2018-12-31 21:21:38 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -94354,7 +94354,7 @@ name = I; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -307433,7 +307433,7 @@ unicode = 04BE; }, { glyphname = palochkacyrillic; -lastChange = "2018-12-31 21:21:38 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -307487,7 +307487,7 @@ name = I; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); leftKerningGroup = B; @@ -326060,7 +326060,7 @@ interface.gridadjust.original = "{'width': 1282, 'leftMargin': 138, 'rightMargin { color = (227,245,235,1); glyphname = romanone; -lastChange = "2018-12-31 21:21:38 +0000"; +lastChange = "2019-07-18 20:40:07 +0000"; layers = ( { components = ( @@ -326114,7 +326114,7 @@ name = I; } ); layerId = "200BE2C5-40F6-4CF4-AF4F-A33C0CC0964F"; -width = 700; +width = 704; } ); unicode = 2160; |