Re: [dev] [st] wide characters getting cropped

2021-10-26 Thread Ian Liu Rodrigues
On Tuesday, October 26th, 2021 at 17:27, Страхиња Радић  
wrote:
> For me, this patch fixed the glyph truncation:
>
> https://github.com/LukeSmithxyz/st/pull/224
>
> Perhaps someone could add this to the official patches?


Thanks! I will try applying that patch.



[dev] [st] wide characters getting cropped

2021-10-26 Thread Ian Liu Rodrigues
Dear all,

This is my first post here after two failed attempts, I think because
of the email being sent as HTML. Lets hope this one goes alright.

I've noticed that in some situations wide characters are being cropped
on my terminal. The following script, which uses a wide character from
the "Nerd Font Symbol"[1], shows a test case:


echo -e '\e[31m \e[0m c'
echo -e '\e[31m  \e[0mc'


Here is a screenshot of the script's output: https://qu.ax/3SBs.png

The only difference between the two echo's is the position where
the foreground color resets: the first resets right after the wide
character, whereas the second resets after the space.

I've hacked a little bit in the source code but couldn't figure out how
st paints the characters. I see in function xdrawglyphfontspecs[2] that
it calls this:

/* Clean up the region we want to draw to. */
XftDrawRect(xw.draw, bg, winx, winy, width, win.ch);

which seems to clear the character rectangle unconditionally, but then
shouldn't the second echo also crop?

Kind regards,
Ian L. Rodrigues

[1]: 
https://raw.githubusercontent.com/ryanoasis/nerd-fonts/d0bf73a19c3459aab39734a05159e2694911d7d6/src/glyphs/Symbols-2048-em%20Nerd%20Font%20Complete.ttf

[2]: https://git.suckless.org/st/file/x.c.html#l1453