Skip to content

Commit

Permalink
Fixes glyph overlapping issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanoasis committed Mar 24, 2018
1 parent 87801fe commit 31d7524
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -703,12 +703,20 @@ def copy_glyphs(sourceFont, sourceFontStart, sourceFontEnd, symbolFont, symbolFo
align_matrix = psMat.translate(x_align_distance, y_align_distance)
sourceFont.transform(align_matrix)

if args.single:
# Ensure the font is considered monospaced on Windows by setting the same
# width for all character glyphs.
# This needs to be done for all glyphs, even the ones that are empty and
# didn't go through the scaling operations.
sourceFont[currentSourceFontGlyph].width = font_dim['width']
# Needed for setting 'advance width' on each glyph so they do not overlap,
# also ensures the font is considered monospaced on Windows by setting the
# same width for all character glyphs.
# This needs to be done for all glyphs, even the ones that are empty and
# didn't go through the scaling operations.
sourceFont[currentSourceFontGlyph].width = font_dim['width']

# Ensure after horizontal adjustments and centering that the glyph
# does not overlap the bearings (edges)
if sourceFont[currentSourceFontGlyph].left_side_bearing < 0:
sourceFont[currentSourceFontGlyph].left_side_bearing = 0.0

if sourceFont[currentSourceFontGlyph].right_side_bearing < 0:
sourceFont[currentSourceFontGlyph].right_side_bearing = 0.0

# reset selection so iteration works properly @todo fix? rookie misunderstanding?
# This is likely needed because the selection was changed when the glyph was copy/pasted
Expand Down

0 comments on commit 31d7524

Please sign in to comment.