From 33a94d820deee8da6a4477b95dfb145d29e57517 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 17 Jan 2023 21:55:12 -0700 Subject: [PATCH] [instancer/VarComposite] Allow instancing non-variable VarComposite axes --- Lib/fontTools/varLib/instancer/__init__.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Lib/fontTools/varLib/instancer/__init__.py b/Lib/fontTools/varLib/instancer/__init__.py index e46989349..42063c616 100644 --- a/Lib/fontTools/varLib/instancer/__init__.py +++ b/Lib/fontTools/varLib/instancer/__init__.py @@ -495,11 +495,19 @@ def _instantiateGvarGlyph( glyph = glyf[glyphname] if glyph.isVarComposite(): for component in glyph.components: + newLocation = {} for tag, loc in component.location.items(): - if tag in axisLimits: + if tag not in axisLimits: + newLocation[tag] = loc + continue + if component.flags & _g_l_y_f.VarComponentFlags.AXES_HAVE_VARIATION: raise NotImplementedError( - "Instancing accross VarComposite axes is not supported." + "Instancing accross VarComposite axes with variation is not supported." ) + limits = axisLimits[tag] + loc = normalizeValue(loc, limits) + newLocation[tag] = loc + component.location = newLocation # _setCoordinates also sets the hmtx/vmtx advance widths and sidebearings from # the four phantom points and glyph bounding boxes.