-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Description
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
- 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 byXftDrawSetClip
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.
I made a very dirty proof-of-concept fix here: Dreomite@e4355b5
Is this an acceptable solution?
Metadata
Metadata
Assignees
Labels
No labels