diff --git a/Lib/ufo2ft/filters/transformations.py b/Lib/ufo2ft/filters/transformations.py index a39cf0f6f..60bea5455 100644 --- a/Lib/ufo2ft/filters/transformations.py +++ b/Lib/ufo2ft/filters/transformations.py @@ -98,6 +98,7 @@ def filter(self, glyph): if matrix == Identity or not (glyph or glyph.components or glyph.anchors): return False # nothing to do + justscale = self.context.justscale modified = self.context.modified glyphSet = self.context.glyphSet for component in glyph.components: @@ -125,4 +126,6 @@ def filter(self, glyph): for a in glyph.anchors: a.x, a.y = matrix.transformPoint((a.x, a.y)) + glyph.width, glyph.height = matrix.transformVector((glyph.width, glyph.height)) + return True diff --git a/requirements.txt b/requirements.txt index e2b3c7e69..b604bb688 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -fonttools[lxml,ufo]==4.25.1 +fonttools[lxml,ufo]==4.26.1 defcon==0.8.1 cu2qu==1.6.7 compreffor==0.5.1 diff --git a/setup.py b/setup.py index 93f448ac0..5dd40f30c 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ setup_requires=pytest_runner + wheel + ["setuptools_scm"], tests_require=["pytest>=2.8"], install_requires=[ - "fonttools[ufo]>=4.25.1", + "fonttools[ufo]>=4.26.1", "cu2qu>=1.6.7", "cffsubr>=0.2.8", "booleanOperations>=0.9.0", diff --git a/tests/filters/transformations_test.py b/tests/filters/transformations_test.py index 4d88ea292..70b161ec1 100644 --- a/tests/filters/transformations_test.py +++ b/tests/filters/transformations_test.py @@ -127,6 +127,8 @@ def test_ScaleX(self, font, origin): assert (a[0][0].x, a[0][0].y) == (0, 0) assert (a[0][2].x, a[0][2].y) == (150, 300) + assert a.width == 350 * 0.50 + def test_ScaleY(self, font, origin): percent = 50 filter_ = TransformationsFilter(ScaleY=percent, Origin=origin) @@ -156,6 +158,7 @@ def test_ScaleXY(self, font, origin): # both x and y change assert (a[0][0].x, a[0][0].y) == (0, bottom) assert (a[0][2].x, a[0][2].y) == (150, top) + assert a.width == 350 * factor def test_Slant(self, font, origin): filter_ = TransformationsFilter(Slant=45, Origin=origin) @@ -190,3 +193,16 @@ def test_composite_glyphs(self, font): # its original transform had a scale, so it was necessary to # compensate for the transformation applied on the base glyph assert d.components[0].transformation == (1, 0, 0, -1, 0, 102) + + def test_ScaleOffset_width(self, font, origin): + percent = 50 + filter_ = TransformationsFilter( + OffsetX=-100, ScaleX=percent, ScaleY=percent, Origin=origin + ) + assert filter_(font) + factor = percent / 100 + + a = font["a"] + # The offset value here should not change the fact that the glyph + # bounding box is scaled by 50%. + assert a.width == 350 * factor