Merge pull request #394 from Finii/bugfix/diacritics_in_mono

Bugfix/diacritics in mono
This commit is contained in:
Ryan L McIntyre 2019-12-21 20:55:47 -08:00 committed by GitHub
commit a192bff0b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -784,7 +784,19 @@ class font_patcher:
""" Makes self.sourceFont monospace compliant """
for glyph in self.sourceFont.glyphs():
self.remove_glyph_neg_bearings(glyph)
if (glyph.width == self.font_dim['width']):
# Don't tough the (negative) bearings if the width is ok
# Ligartures will have these.
continue
if (glyph.width != 0):
# If the width is zero this glyph is intened to be printed on top of another one.
# In this case we need to keep the negative bearings to shift it 'left'.
# Things like Ä have these: composed of U+0041 'A' and U+0308 'double dot above'
#
# If width is not zero, correct the bearings such that they are within the width:
self.remove_glyph_neg_bearings(glyph)
self.set_glyph_width_mono(glyph)