From c44ca7275482956cec2c04ac666224bba23a2637 Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Mon, 23 Nov 2020 18:34:20 +0000 Subject: [PATCH] use skipExportGlyphs also in feature writers We already read public.skipExportGlyphs to subset the UFO glyph set inside the preProcessor. However if one attempts to use a standalone feature writer class independently of a FeatureCompiler, we were ignoring the public.skipExportGlyphs. Now we do. Fixes #411. --- Lib/ufo2ft/featureWriters/baseFeatureWriter.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Lib/ufo2ft/featureWriters/baseFeatureWriter.py b/Lib/ufo2ft/featureWriters/baseFeatureWriter.py index dde2fa8ad..494cf39f5 100644 --- a/Lib/ufo2ft/featureWriters/baseFeatureWriter.py +++ b/Lib/ufo2ft/featureWriters/baseFeatureWriter.py @@ -143,16 +143,20 @@ def makeUnicodeToGlyphNameMapping(self): return cmap def getOrderedGlyphSet(self): - """Return OrderedDict[glyphName, glyph] sorted by glyphOrder. - """ + """Return OrderedDict[glyphName, glyph] sorted by glyphOrder.""" compiler = self.context.compiler if compiler is not None: return compiler.glyphSet - from ufo2ft.util import makeOfficialGlyphOrder + from ufo2ft.util import _GlyphSet, makeOfficialGlyphOrder - glyphSet = self.context.font - glyphOrder = makeOfficialGlyphOrder(self.context.font) + font = self.context.font + glyphOrder = makeOfficialGlyphOrder(font) + # subset glyphSet by skipExportGlyphs if any + glyphSet = _GlyphSet.from_layer( + font, + skipExportGlyphs=set(font.lib.get("public.skipExportGlyphs", [])), + ) return OrderedDict((gn, glyphSet[gn]) for gn in glyphOrder) def compileGSUB(self):