Skip to content

Commit

Permalink
use skipExportGlyphs also in feature writers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anthrotype committed Nov 23, 2020
1 parent b04c886 commit c44ca72
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Lib/ufo2ft/featureWriters/baseFeatureWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit c44ca72

Please sign in to comment.