summaryrefslogtreecommitdiffstats
path: root/contrib/python/fonttools
diff options
context:
space:
mode:
authorrobot-piglet <[email protected]>2025-02-08 20:17:29 +0300
committerrobot-piglet <[email protected]>2025-02-08 20:32:11 +0300
commit6b7c255668de517dff6462bd377d345d240f8a67 (patch)
tree1bde953b7f2b6d9e8efd72a0ceebfa0a791a024c /contrib/python/fonttools
parent2309a9980fd82ba7df5a21876c790e7e4d776ded (diff)
Intermediate changes
commit_hash:f4cb1bdccfb534d71b7f461fc8f8e5656c47bfa5
Diffstat (limited to 'contrib/python/fonttools')
-rw-r--r--contrib/python/fonttools/.dist-info/METADATA13
-rw-r--r--contrib/python/fonttools/fontTools/__init__.py2
-rw-r--r--contrib/python/fonttools/fontTools/feaLib/builder.py8
-rw-r--r--contrib/python/fonttools/fontTools/ttLib/tables/_g_l_y_f.py36
-rw-r--r--contrib/python/fonttools/ya.make2
5 files changed, 51 insertions, 10 deletions
diff --git a/contrib/python/fonttools/.dist-info/METADATA b/contrib/python/fonttools/.dist-info/METADATA
index 931191c2892..68bd23ea996 100644
--- a/contrib/python/fonttools/.dist-info/METADATA
+++ b/contrib/python/fonttools/.dist-info/METADATA
@@ -1,6 +1,6 @@
Metadata-Version: 2.2
Name: fonttools
-Version: 4.55.4
+Version: 4.55.6
Summary: Tools to manipulate font files
Home-page: http://github.com/fonttools/fonttools
Author: Just van Rossum
@@ -389,6 +389,17 @@ Have fun!
Changelog
~~~~~~~~~
+4.55.6 (released 2025-01-24)
+----------------------------
+
+- [glyf] Fixed regression introduced in 4.55.5 when computing bounds of nested composite glyphs with transformed components (#3752).
+
+4.55.5 (released 2025-01-23)
+----------------------------
+
+- [glyf] Fixed recalcBounds of transformed components with unrounded coordinates (#3750).
+- [feaLib] Allow duplicate script/language statements (#3749).
+
4.55.4 (released 2025-01-21)
----------------------------
diff --git a/contrib/python/fonttools/fontTools/__init__.py b/contrib/python/fonttools/fontTools/__init__.py
index d1af15d948f..83406338269 100644
--- a/contrib/python/fonttools/fontTools/__init__.py
+++ b/contrib/python/fonttools/fontTools/__init__.py
@@ -3,6 +3,6 @@ from fontTools.misc.loggingTools import configLogger
log = logging.getLogger(__name__)
-version = __version__ = "4.55.4"
+version = __version__ = "4.55.6"
__all__ = ["version", "log", "configLogger"]
diff --git a/contrib/python/fonttools/fontTools/feaLib/builder.py b/contrib/python/fonttools/fontTools/feaLib/builder.py
index 1cfe1c3a137..a6ba8f2f612 100644
--- a/contrib/python/fonttools/fontTools/feaLib/builder.py
+++ b/contrib/python/fonttools/fontTools/feaLib/builder.py
@@ -1106,7 +1106,13 @@ class Builder(object):
if (language == "dflt" or include_default) and lookups:
self.features_[key] = lookups[:]
else:
- self.features_[key] = []
+ # if we aren't including default we need to manually remove the
+ # default lookups, which were added to all declared langsystems
+ # as they were encountered (we don't remove all lookups because
+ # we want to allow duplicate script/lang statements;
+ # see https://github.com/fonttools/fonttools/issues/3748
+ cur_lookups = self.features_.get(key, [])
+ self.features_[key] = [x for x in cur_lookups if x not in lookups]
self.language_systems = frozenset([(self.script_, language)])
if required:
diff --git a/contrib/python/fonttools/fontTools/ttLib/tables/_g_l_y_f.py b/contrib/python/fonttools/fontTools/ttLib/tables/_g_l_y_f.py
index 92b69e70b1f..eaa9920f008 100644
--- a/contrib/python/fonttools/fontTools/ttLib/tables/_g_l_y_f.py
+++ b/contrib/python/fonttools/fontTools/ttLib/tables/_g_l_y_f.py
@@ -1187,7 +1187,7 @@ class Glyph(object):
):
return
try:
- coords, endPts, flags = self.getCoordinates(glyfTable)
+ coords, endPts, flags = self.getCoordinates(glyfTable, round=otRound)
self.xMin, self.yMin, self.xMax, self.yMax = coords.calcIntBounds()
except NotImplementedError:
pass
@@ -1206,9 +1206,7 @@ class Glyph(object):
Return True if bounds were calculated, False otherwise.
"""
for compo in self.components:
- if hasattr(compo, "firstPt") or hasattr(compo, "transform"):
- return False
- if not float(compo.x).is_integer() or not float(compo.y).is_integer():
+ if not compo._hasOnlyIntegerTranslate():
return False
# All components are untransformed and have an integer x/y translate
@@ -1241,7 +1239,7 @@ class Glyph(object):
else:
return self.numberOfContours == -1
- def getCoordinates(self, glyfTable):
+ def getCoordinates(self, glyfTable, *, round=noRound):
"""Return the coordinates, end points and flags
This method returns three values: A :py:class:`GlyphCoordinates` object,
@@ -1267,13 +1265,27 @@ class Glyph(object):
for compo in self.components:
g = glyfTable[compo.glyphName]
try:
- coordinates, endPts, flags = g.getCoordinates(glyfTable)
+ coordinates, endPts, flags = g.getCoordinates(
+ glyfTable, round=round
+ )
except RecursionError:
raise ttLib.TTLibError(
"glyph '%s' contains a recursive component reference"
% compo.glyphName
)
coordinates = GlyphCoordinates(coordinates)
+ # if asked to round e.g. while computing bboxes, it's important we
+ # do it immediately before a component transform is applied to a
+ # simple glyph's coordinates in case these might still contain floats;
+ # however, if the referenced component glyph is another composite, we
+ # must not round here but only at the end, after all the nested
+ # transforms have been applied, or else rounding errors will compound.
+ if (
+ round is not noRound
+ and g.numberOfContours > 0
+ and not compo._hasOnlyIntegerTranslate()
+ ):
+ coordinates.toInt(round=round)
if hasattr(compo, "firstPt"):
# component uses two reference points: we apply the transform _before_
# computing the offset between the points
@@ -1930,6 +1942,18 @@ class GlyphComponent(object):
result = self.__eq__(other)
return result if result is NotImplemented else not result
+ def _hasOnlyIntegerTranslate(self):
+ """Return True if it's a 'simple' component.
+
+ That is, it has no anchor points and no transform other than integer translate.
+ """
+ return (
+ not hasattr(self, "firstPt")
+ and not hasattr(self, "transform")
+ and float(self.x).is_integer()
+ and float(self.y).is_integer()
+ )
+
class GlyphCoordinates(object):
"""A list of glyph coordinates.
diff --git a/contrib/python/fonttools/ya.make b/contrib/python/fonttools/ya.make
index 461b5646645..9ada57d3f69 100644
--- a/contrib/python/fonttools/ya.make
+++ b/contrib/python/fonttools/ya.make
@@ -2,7 +2,7 @@
PY3_LIBRARY()
-VERSION(4.55.4)
+VERSION(4.55.6)
LICENSE(MIT)