Conversation
|
The logic of double width overflow has been moved from libtsm to kmscon. This prevents the problem of breaking libtsm's ABI. |
|
That looks good overall, but I think there is a small flaw. bool previous_overflow, this checks if the previous drawn character has overflown, but this assume the previous character is on the left, which might not be always the case. two example:
I think it can be solved by also storing the position in txt->overflow_posx and txt->overflow_posy ? Also if you can rebase on top of main (instead of merge), and squash "Double width overflow support" and "Move double width overflow logic into kmscon" together, to have a nice linear git history. Thanks |
42174e0 to
1ca1a5a
Compare
I updated previous_overflow to not be used if posx is 0, so this should be fixed.
From my understanding libtsm and each render engine always redraws the entire screen from up to down left to right. If I am wrong about this, please show me in the code where this is wrong.
Should be fixed now. |
|
Thanks a lot, just let me a few days to run some tests, and I will merge it. |
|
I've tested it, and that's indeed fixes the issue with Hack Nerd Fonts. And indeed libtsm always redraw the whole screen, I really thought there was some optimizations there. If no objection, I will merge it soon. |
This PR along with Aetf/libtsm#51 adds support for single cell characters overflowing to the next cell. This fixes #18. Changes for both PRs will be in this in this description.
Libtsm Changes
A new callback function, overflow_cb, is added to tsm_screen_draw. This function determines if the current character needs to overflow into the next and writes that to overflow_next. The overflow_next variable will cause the next call to tsm_screen_draw to be skipped if it is an empty cell, thus preventing the previous cell from being overwritten.
Kmscon Changes
The kmscon_font_pango_get_overflow function is added to implement the overflow_cb in libtsm. This detects if the logical width of a character is greater than the fonts attribute width. The txt->ops->draw functions are altered to add an overflow_next parameter to change the functionality of drawing. gltex_draw is altered to use the glyph's width if overflow_next is set. tp_draw is altered to always use glyph's buffer width to draw. bbulk_draw is altered to set the next cell's buffer to NULL if overflow_next is set.
This causes all render engines to not overwrite the right side of single cell double width characters.