1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2024-12-25 20:18:01 +02:00

Fixes glyph overlapping issues

This commit is contained in:
Ryan L McIntyre 2018-03-23 20:51:56 -04:00
parent 87801fe6b3
commit 31d7524a2c

View File

@ -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