You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ST divides rendered text to sequences of glyphs with same style and then sequentially draws them. This leads to a problem: if a wide glyph is followed by another glyph with different style (can be color, weight or anything), the excessive parts of the glyph will be overdrawn by the beginning of the next sequence.
Steps to reproduce
If you have a double-width Nerd font installed, execute this in your terminal: echo '\uF03E\e[36mX \uF03EX '
You'll get the following picture:
Note how the first icon gets truncated due to style difference while the second one doesn't.
The reason
If you'll take a look at xdrawglyphfontspecs function, which is used for drawing sequences of glyphs with same style, you'll see that it calls 2 functions before drawing actual glyphs:
XftDrawRect - this one draws background of the current sequence basically overdrawing parts of previous sequence if they happen to cross current sequence boundary.
XftDrawSetClipRectangles - this one puts drawable glyphs in an invisible rectangle outside of which glyphs are not rendered. (Later followed by XftDrawSetClip to negate this.)
Proposed solution
Use 2 passes for drawing lines: one for background, another one for foreground. So parts of wide glyphs do not get overdrawn.
Git rid of rectangle clipping. It was introduced in this commit and is intended for removing overdrawing for some fonts. Was it worth introducing in the first place? I don't know. Such fonts are still going to look crippled and are not worth using in the first place.
The issue
ST divides rendered text to sequences of glyphs with same style and then sequentially draws them. This leads to a problem: if a wide glyph is followed by another glyph with different style (can be color, weight or anything), the excessive parts of the glyph will be overdrawn by the beginning of the next sequence.
Steps to reproduce
echo '\uF03E\e[36mX \uF03EX '
You'll get the following picture:

Note how the first icon gets truncated due to style difference while the second one doesn't.
The reason
If you'll take a look at
xdrawglyphfontspecs
function, which is used for drawing sequences of glyphs with same style, you'll see that it calls 2 functions before drawing actual glyphs:XftDrawRect
- this one draws background of the current sequence basically overdrawing parts of previous sequence if they happen to cross current sequence boundary.XftDrawSetClipRectangles
- this one puts drawable glyphs in an invisible rectangle outside of which glyphs are not rendered. (Later followed byXftDrawSetClip
to negate this.)Proposed solution
I made a very dirty proof-of-concept fix here: Dreomite@e4355b5
With no fix:

With this fix:

Is this an acceptable solution?
The text was updated successfully, but these errors were encountered: