fonttools 4.55.5__py3-none-any.whl → 4.55.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fonttools might be problematic. Click here for more details.
- fontTools/__init__.py +1 -1
- fontTools/ttLib/tables/_g_l_y_f.py +26 -5
- {fonttools-4.55.5.dist-info → fonttools-4.55.7.dist-info}/METADATA +14 -1381
- {fonttools-4.55.5.dist-info → fonttools-4.55.7.dist-info}/RECORD +9 -9
- {fonttools-4.55.5.data → fonttools-4.55.7.data}/data/share/man/man1/ttx.1 +0 -0
- {fonttools-4.55.5.dist-info → fonttools-4.55.7.dist-info}/LICENSE +0 -0
- {fonttools-4.55.5.dist-info → fonttools-4.55.7.dist-info}/WHEEL +0 -0
- {fonttools-4.55.5.dist-info → fonttools-4.55.7.dist-info}/entry_points.txt +0 -0
- {fonttools-4.55.5.dist-info → fonttools-4.55.7.dist-info}/top_level.txt +0 -0
fontTools/__init__.py
CHANGED
|
@@ -1206,9 +1206,7 @@ class Glyph(object):
|
|
|
1206
1206
|
Return True if bounds were calculated, False otherwise.
|
|
1207
1207
|
"""
|
|
1208
1208
|
for compo in self.components:
|
|
1209
|
-
if
|
|
1210
|
-
return False
|
|
1211
|
-
if not float(compo.x).is_integer() or not float(compo.y).is_integer():
|
|
1209
|
+
if not compo._hasOnlyIntegerTranslate():
|
|
1212
1210
|
return False
|
|
1213
1211
|
|
|
1214
1212
|
# All components are untransformed and have an integer x/y translate
|
|
@@ -1241,7 +1239,7 @@ class Glyph(object):
|
|
|
1241
1239
|
else:
|
|
1242
1240
|
return self.numberOfContours == -1
|
|
1243
1241
|
|
|
1244
|
-
def getCoordinates(self, glyfTable, round=noRound):
|
|
1242
|
+
def getCoordinates(self, glyfTable, *, round=noRound):
|
|
1245
1243
|
"""Return the coordinates, end points and flags
|
|
1246
1244
|
|
|
1247
1245
|
This method returns three values: A :py:class:`GlyphCoordinates` object,
|
|
@@ -1276,7 +1274,18 @@ class Glyph(object):
|
|
|
1276
1274
|
% compo.glyphName
|
|
1277
1275
|
)
|
|
1278
1276
|
coordinates = GlyphCoordinates(coordinates)
|
|
1279
|
-
|
|
1277
|
+
# if asked to round e.g. while computing bboxes, it's important we
|
|
1278
|
+
# do it immediately before a component transform is applied to a
|
|
1279
|
+
# simple glyph's coordinates in case these might still contain floats;
|
|
1280
|
+
# however, if the referenced component glyph is another composite, we
|
|
1281
|
+
# must not round here but only at the end, after all the nested
|
|
1282
|
+
# transforms have been applied, or else rounding errors will compound.
|
|
1283
|
+
if (
|
|
1284
|
+
round is not noRound
|
|
1285
|
+
and g.numberOfContours > 0
|
|
1286
|
+
and not compo._hasOnlyIntegerTranslate()
|
|
1287
|
+
):
|
|
1288
|
+
coordinates.toInt(round=round)
|
|
1280
1289
|
if hasattr(compo, "firstPt"):
|
|
1281
1290
|
# component uses two reference points: we apply the transform _before_
|
|
1282
1291
|
# computing the offset between the points
|
|
@@ -1933,6 +1942,18 @@ class GlyphComponent(object):
|
|
|
1933
1942
|
result = self.__eq__(other)
|
|
1934
1943
|
return result if result is NotImplemented else not result
|
|
1935
1944
|
|
|
1945
|
+
def _hasOnlyIntegerTranslate(self):
|
|
1946
|
+
"""Return True if it's a 'simple' component.
|
|
1947
|
+
|
|
1948
|
+
That is, it has no anchor points and no transform other than integer translate.
|
|
1949
|
+
"""
|
|
1950
|
+
return (
|
|
1951
|
+
not hasattr(self, "firstPt")
|
|
1952
|
+
and not hasattr(self, "transform")
|
|
1953
|
+
and float(self.x).is_integer()
|
|
1954
|
+
and float(self.y).is_integer()
|
|
1955
|
+
)
|
|
1956
|
+
|
|
1936
1957
|
|
|
1937
1958
|
class GlyphCoordinates(object):
|
|
1938
1959
|
"""A list of glyph coordinates.
|