mirror of
https://github.com/ryanoasis/nerd-fonts.git
synced 2024-09-12 09:41:47 +02:00
font-patcher: Fix broken ligature glyphs in monospaced font
[why] For some reason reading a font into fontforge looses data on glyphs. As a workaround the `font-patcher` script has the switch `--mono` to ascertain an equal width of all glyphs. We want to (and sometimes need to) use that mode of the script to get a new font that is detected as monospaced by Windows. Sometimes that workaround fails. For example it breaks ligature glyphs in some circumstances; they seem to be moved sideways. [how] The workaround is done in two steps: First each glyph is checked for negative bearings. If these are found they are set to fixed zero. Afterwards the glyph width is set to the font global width. The ligature glyphs have already the correct width, they just have negative bearings that they indeed need. There is no reason to change the (correct) bearings to get a monospaced font. In strict monospaced fonts that would be impossible, but the ligatures are only used in applications that could work with negative bearings and so they should be there. Strict monospaced usage does ignore the bearings anyhow. Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
parent
7216e596ab
commit
a2f0958ae5
1 changed files with 5 additions and 0 deletions
|
@ -784,6 +784,11 @@ class font_patcher:
|
|||
""" Makes self.sourceFont monospace compliant """
|
||||
|
||||
for glyph in self.sourceFont.glyphs():
|
||||
if (glyph.width == self.font_dim['width']):
|
||||
# Don't tough the (negative) bearings if the width is ok
|
||||
# Ligartures will have these.
|
||||
continue
|
||||
|
||||
self.remove_glyph_neg_bearings(glyph)
|
||||
self.set_glyph_width_mono(glyph)
|
||||
|
||||
|
|
Loading…
Reference in a new issue