From 874c08dcd205342f2a12bc9f9487b8a7f7f08a7b Mon Sep 17 00:00:00 2001 From: justvanrossum Date: Wed, 5 Dec 2018 15:07:20 +0100 Subject: [PATCH] CFF: set FontMatrix based on unitsPerEm automatically, unless manually overridden --- Lib/fontTools/fontBuilder.py | 3 +++ Tests/fontBuilder/data/test.otf.ttx | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/fontTools/fontBuilder.py b/Lib/fontTools/fontBuilder.py index bfde5b25e..8b6b76387 100644 --- a/Lib/fontTools/fontBuilder.py +++ b/Lib/fontTools/fontBuilder.py @@ -478,6 +478,9 @@ class FontBuilder(object): topDict.Private = private for key, value in fontInfo.items(): setattr(topDict, key, value) + if "FontMatrix" not in fontInfo: + scale = 1 / self.font["head"].unitsPerEm + topDict.FontMatrix = [scale, 0, 0, scale, 0, 0] charStrings = CharStrings(None, topDict.charset, globalSubrs, private, fdSelect, fdArray) for glypnName, charString in charStringsDict.items(): diff --git a/Tests/fontBuilder/data/test.otf.ttx b/Tests/fontBuilder/data/test.otf.ttx index 4a4434a48..0b7279469 100644 --- a/Tests/fontBuilder/data/test.otf.ttx +++ b/Tests/fontBuilder/data/test.otf.ttx @@ -161,7 +161,7 @@ - +