Skip to content

Commit

Permalink
Remove negative bearings on 2048-em glyphs
Browse files Browse the repository at this point in the history
  • Loading branch information
polyzen authored and ryanoasis committed Sep 6, 2020
1 parent 881813d commit 59c45ba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -773,17 +773,16 @@ class font_patcher:
align_matrix = psMat.translate(x_align_distance, y_align_distance)
self.sourceFont.transform(align_matrix)

# Ensure after horizontal adjustments and centering that the glyph
# does not overlap the bearings (edges)
self.remove_glyph_neg_bearings(self.sourceFont[currentSourceFontGlyph])

# 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.
# it should come after setting the glyph bearings
self.set_glyph_width_mono(self.sourceFont[currentSourceFontGlyph])

# Ensure after horizontal adjustments and centering that the glyph
# does not overlap the bearings (edges)
self.remove_glyph_neg_bearings(self.sourceFont[currentSourceFontGlyph])

# 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
if symbolFontStart == 0:
Expand All @@ -801,7 +800,7 @@ class font_patcher:

for glyph in self.sourceFont.glyphs():
if (glyph.width == self.font_dim['width']):
# Don't tough the (negative) bearings if the width is ok
# Don't touch the (negative) bearings if the width is ok
# Ligartures will have these.
continue

Expand Down
Binary file modified src/glyphs/Symbols-2048-em Nerd Font Complete.ttf
Binary file not shown.

0 comments on commit 59c45ba

Please sign in to comment.