Eli Zaretskii writes: >> From: Akib Azmain Turja >> Cc: 57607@debbugs.gnu.org, gerd.moellmann@gmail.com >> Date: Tue, 04 Oct 2022 18:00:57 +0600 >> >> > Please try with some 2-column CJK characters, I'm not sure the example >> > with ^L is relevant here. You can find the list of wide characters in >> > characters.el (search for "width"); for example, characters in the >> > U+FF00 block can be useful. >> >> Thanks, "CJK STROKE D" doesn't work as expected, and the result depends >> on terminal in use. How can I determine the width of a glyph? > > Like this: > > (char-width CHAR) > > where CHAR is the character you are interested in. For example: > > (char-width #x31D4) > => 2 > > From C, you can call char_width, like Fchar_width (which see) does. > > One other subtle point: the argument STRING to tty_write_glyphs is a > string of 'struct glyph' objects, not a string of characters. Each > struct glyph has the code of the character to display in its u.ch > member, if the glyph is a simple character glyph; for the full story > see encode_terminal_code. Thanks. I just discovered new type of glyph: padding glyph. What's this? Is this a nop glyph? I guess it's used to make string of width N use N numbers of glyph. But how? Is this like [CJK PAD] or [PAD CJK]? > >> > (And the existing code could have bugs, >> > no need to assume it is always correct.) >> >> Yes, it can, but in most cases, my brain has more bugs. > > Indeed, that the existing code has bugs should not be our first > hypothesis. But it shouldn't be axiomatic that there are no bugs > there ;-) > >> > face_id is an integer, and zero is a valid value (it means the default >> > face), so NULL won't do. But you can use -1 to mean "no face ID". >> > Just make sure you never pass it to FACE_FROM_ID etc. >> > >> > Thanks. >> >> OK, I'll try that. Thanks. > > TIA -- Akib Azmain Turja Find me on Mastodon at @akib@hostux.social. This message is signed by me with my GnuPG key. Its fingerprint is: 7001 8CE5 819F 17A3 BBA6 66AF E74F 0EFA 922A E7F5