Skip to content

Commit

Permalink
remove hack that sets 0-width to glyph.xMax
Browse files Browse the repository at this point in the history
this messes up horizontal positioning of glyphs with zero advance width, was added to prevent clipping of bitmap glyphs exceeding their viewbox (#402). The latter issue will be dealt with separately.
  • Loading branch information
anthrotype committed Aug 17, 2022
1 parent 5406472 commit d404e17
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions src/nanoemoji/colr_to_svg.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,6 @@ def glyph_region(ttfont: ttLib.TTFont, glyph_name: str) -> Rect:
map_font_space_to_viewbox handles font +y goes up => svg +y goes down."""
width = ttfont["hmtx"][glyph_name][0]
if width == 0:
glyph = ttfont["glyf"][glyph_name]
if hasattr(glyph, "xMax"): # empty glyphs have no bbox attributes
width = glyph.xMax
return Rect(
0,
-ttfont["OS/2"].sTypoAscender,
Expand Down

0 comments on commit d404e17

Please sign in to comment.