Skip to content

Commit

Permalink
Pass MATH userData in minimal mode as well
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Feb 14, 2024
1 parent 9e0bf7d commit 2cb8d53
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/glyphsLib/builder/glyph.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def to_ufo_glyph(self, ufo_glyph, layer, glyph, do_color_layers=True): # noqa:
self.to_ufo_guidelines(ufo_glyph, layer) # .guidelines
self.to_ufo_glyph_background(ufo_glyph, layer) # below
self.to_ufo_annotations(ufo_glyph, layer) # .annotations
self.to_ufo_glyph_user_data(ufo_font, glyph) # .user_data
self.to_ufo_layer_user_data(ufo_glyph, layer) # .user_data
self.to_ufo_smart_component_axes(ufo_glyph, glyph) # .components
self.to_ufo_glyph_user_data(ufo_font, glyph) # .user_data
self.to_ufo_layer_user_data(ufo_glyph, layer) # .user_data

# Optimization: profiling glyphs2ufo of NotoSans-MM.glyphs (6000 glyphs) on a Mac
# mini late 2014, Python 3.6.8, revealed that a whopping 17% of the time was spent
Expand Down
4 changes: 4 additions & 0 deletions Lib/glyphsLib/builder/user_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ def to_ufo_glyph_user_data(self, ufo, glyph):
ufo.lib.setdefault(GLYPHS_MATH_VARIANTS_KEY, {})[glyph.name] = dict(
mathData[GLYPHS_MATH_VARIANTS_KEY]
)
if self.minimal:
return
otherData = {k: v for k, v in glyph.userData.items() if k not in mathData}
key = GLYPH_USER_DATA_KEY + "." + glyph.name
if otherData:
Expand Down Expand Up @@ -101,6 +103,8 @@ def to_ufo_layer_lib(self, master, ufo, ufo_layer):
def to_ufo_layer_user_data(self, ufo_glyph, layer):
user_data = layer.userData
for key in user_data.keys():
if self.minimal and not key.startswith(GLYPHS_MATH_PREFIX):
continue
if _user_data_has_no_special_meaning(key):
ufo_glyph.lib[key] = user_data[key]

Expand Down

0 comments on commit 2cb8d53

Please sign in to comment.