aboutsummaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-11-16 17:42:16 -0800
committerHaibo Huang <hhb@google.com>2020-11-16 17:42:16 -0800
commit5ad7e67a4fae992c0775829298e3846987a98c16 (patch)
tree52b2b1fe80bc84b56de0ce1d9c7accd9ed7d5b04 /Lib
parentaf6cd2e5e079d8013e48aabcc196c47c223610f9 (diff)
downloadfonttools-5ad7e67a4fae992c0775829298e3846987a98c16.tar.gz
Upgrade fonttools to 4.17.1
Test: make Change-Id: If6e8c002b874435c2e9804978bbe2b638bbcac45
Diffstat (limited to 'Lib')
-rw-r--r--Lib/fontTools/__init__.py2
-rw-r--r--Lib/fontTools/colorLib/builder.py15
-rw-r--r--Lib/fonttools.egg-info/PKG-INFO9
3 files changed, 23 insertions, 3 deletions
diff --git a/Lib/fontTools/__init__.py b/Lib/fontTools/__init__.py
index 7712d6d6..c4ee2653 100644
--- a/Lib/fontTools/__init__.py
+++ b/Lib/fontTools/__init__.py
@@ -4,6 +4,6 @@ from fontTools.misc.loggingTools import configLogger
log = logging.getLogger(__name__)
-version = __version__ = "4.17.0"
+version = __version__ = "4.17.1"
__all__ = ["version", "log", "configLogger"]
diff --git a/Lib/fontTools/colorLib/builder.py b/Lib/fontTools/colorLib/builder.py
index 3d75567e..5e7d8c6e 100644
--- a/Lib/fontTools/colorLib/builder.py
+++ b/Lib/fontTools/colorLib/builder.py
@@ -296,13 +296,26 @@ def buildCPAL(
_DEFAULT_ALPHA = VariableFloat(1.0)
+def _is_colrv0_layer(layer: Any) -> bool:
+ # Consider as COLRv0 layer any sequence of length 2 (be it tuple or list) in which
+ # the first element is a str (the layerGlyph) and the second element is an int
+ # (CPAL paletteIndex).
+ # https://github.com/googlefonts/ufo2ft/issues/426
+ try:
+ layerGlyph, paletteIndex = layer
+ except (TypeError, ValueError):
+ return False
+ else:
+ return isinstance(layerGlyph, str) and isinstance(paletteIndex, int)
+
+
def _split_color_glyphs_by_version(
colorGlyphs: _ColorGlyphsDict,
) -> Tuple[_ColorGlyphsV0Dict, _ColorGlyphsDict]:
colorGlyphsV0 = {}
colorGlyphsV1 = {}
for baseGlyph, layers in colorGlyphs.items():
- if all(isinstance(l, tuple) and isinstance(l[1], int) for l in layers):
+ if all(_is_colrv0_layer(l) for l in layers):
colorGlyphsV0[baseGlyph] = layers
else:
colorGlyphsV1[baseGlyph] = layers
diff --git a/Lib/fonttools.egg-info/PKG-INFO b/Lib/fonttools.egg-info/PKG-INFO
index 280bf692..c85d381e 100644
--- a/Lib/fonttools.egg-info/PKG-INFO
+++ b/Lib/fonttools.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: fonttools
-Version: 4.17.0
+Version: 4.17.1
Summary: Tools to manipulate font files
Home-page: http://github.com/fonttools/fonttools
Author: Just van Rossum
@@ -264,6 +264,13 @@ Description: |Travis Build Status| |Appveyor Build status| |Coverage Status| |Py
Changelog
~~~~~~~~~
+ 4.17.1 (released 2020-11-16)
+ ----------------------------
+
+ - [colorLib] Fixed regression in 4.17.0 when building COLR v0 table; when color
+ layers are stored in UFO lib plist, we can't distinguish tuples from lists so
+ we need to accept either types (e5439eb9, googlefonts/ufo2ft/issues#426).
+
4.17.0 (released 2020-11-12)
----------------------------