Skip to content

Commit

Permalink
font-patcher: Fix glyphs with overlap
Browse files Browse the repository at this point in the history
[why]
For some powerline symbols we add a certain amount of overlap into the
previous or next character to cover up a small gap between the symbols
that otherwise can show up as ugly thin (usually colored) line.

But after we carefully design that glyph with a bit overlap (over-sized
and having negative bearings) we remove all bearings. That breaks of
course the glyph and no actual overlap on the left side happens.

[how]
Just do not remove negative bearings on overlap-enabled glyphs. As they
are rescaled in both directions anyhow all bearings are wanted and must
be kept.

Reported-by: Mihail Ivanchev <@MIvanchev>
Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
  • Loading branch information
Finii committed Feb 7, 2022
1 parent 2321a67 commit f528ffb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions font-patcher
Original file line number Diff line number Diff line change
Expand Up @@ -843,9 +843,10 @@ class font_patcher:
# even the ones that are empty and didn't go through the scaling operations.
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])
if not overlap:
# Ensure after horizontal adjustments and centering that the glyph
# does not overlap the bearings (edges)
self.remove_glyph_neg_bearings(self.sourceFont[currentSourceFontGlyph])

# Check if the inserted glyph is scaled correctly for monospace
if self.args.single:
Expand Down

2 comments on commit f528ffb

@MIvanchev
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reporter here, this has to be the quickest reaction I've ever experienced, I have been looking for the source of this bug (odity?) for a long time now, thanks :)

@Finii
Copy link
Collaborator Author

@Finii Finii commented on f528ffb Feb 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other thing I could have done this morning involves several badly designed C++ classes that I want to access through a class template; the loosely related 'bases' differ in small details but that breaks the template and because I am not allowed to use C++17 the easy if constexp is not possible and every one line in my head needs to be translated into 10 lines of C++14 code, and ... well, morale is low. *sigh*

Regarding the font-patcher, bad is that the order of set_glyph_width_mono() and remove_glyph_neg_bearings() is also wrong (i.e. has been deliberately broken) -> #764

Please sign in to comment.