From 303fdcbcec2cdfe8f8fbaa05e71bb8a285b5d676 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 17 Jan 2023 17:02:32 -0700 Subject: [PATCH] [scaleUpem/VarComposite] Implement glyf and add gvar TODO --- Lib/fontTools/ttLib/scaleUpem.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lib/fontTools/ttLib/scaleUpem.py b/Lib/fontTools/ttLib/scaleUpem.py index 77f20c9aa..c3e4efc35 100644 --- a/Lib/fontTools/ttLib/scaleUpem.py +++ b/Lib/fontTools/ttLib/scaleUpem.py @@ -116,6 +116,12 @@ def visit(visitor, obj, attr, glyphs): for component in g.components: component.x = visitor.scale(component.x) component.y = visitor.scale(component.y) + elif g.isVarComposite(): + for component in g.components: + for attr in ("translateX", "translateY", "tCenterX", "tCenterY"): + v = getattr(component, attr, None) + if v is not None: + setattr(component, attr, visitor.scale(v)) else: for attr in ("xMin", "xMax", "yMin", "yMax"): v = getattr(g, attr, None) @@ -130,6 +136,7 @@ def visit(visitor, obj, attr, glyphs): @ScalerVisitor.register_attr(ttLib.getTableClass("gvar"), "variations") def visit(visitor, obj, attr, variations): + # TODO(VarComposite) We should NOT scale the axisValues variations for varlist in variations.values(): for var in varlist: coordinates = var.coordinates