[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to walk a Lisp_String?
From: |
Po Lu |
Subject: |
Re: How to walk a Lisp_String? |
Date: |
Fri, 02 Sep 2022 16:31:13 +0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.91 (gnu/linux) |
Manuel Giraud <manuel@ledu-giraud.fr> writes:
> Po Lu <luangruo@yahoo.com> writes:
>
>> Manuel Giraud <manuel@ledu-giraud.fr> writes:
>>
>>> Finally, I'd like to walk this Lisp_String and call FACE_FOR_CHAR for
>>> each charater of this frame. And then be able to call XftDrawStringUtf8
>>> (or XmbDrawString) on each substring/font pair. WDYT?
>>
>> That won't work correctly since glyphs do not correspond to
>> characters.
>>
>> After you obtain the substring containing characters that can be
>> displayed with a single font, you should pass it to the font driver's
>> `shape' function, and then give the resulting glyphs and offsets to
>> XftDrawGlyphs.
>
> Thanks for those hints. What is a "font driver's `shape' function"?
See i.e. xftfont_shape in xftfont.c.
> Ok. I've said XftDrawStringUtf8 because this is what is currently used
> in lwlib for cairo or xft.
That is definitely a bad thing. The Cairo emulation of
XftDrawStringUtf8 uses the Cairo toy text API, which is something that
the Cairo developers tell you not to use:
The functions with text in their name form cairo's toy text API. The
toy API takes UTF-8 encoded text and is limited in its functionality
to rendering simple left-to-right text with no advanced features. That
means for example that most complex scripts like Hebrew, Arabic, and
Indic scripts are out of question. No kerning or correct positioning
of diacritical marks either. The font selection is pretty limited too
and doesn't handle the case that the selected font does not cover the
characters in the text. This set of functions are really that, a toy
text API, for testing and demonstration purposes. Any serious
application should avoid them.
The Xft function itself is much worse than the Cairo emulation.
- Re: How to walk a Lisp_String?, (continued)
- Re: How to walk a Lisp_String?, Po Lu, 2022/09/01
- Re: How to walk a Lisp_String?, Eli Zaretskii, 2022/09/02
- Re: How to walk a Lisp_String?, Po Lu, 2022/09/02
- Re: How to walk a Lisp_String?, Eli Zaretskii, 2022/09/02
- Re: How to walk a Lisp_String?, Po Lu, 2022/09/02
- Re: How to walk a Lisp_String?, Eli Zaretskii, 2022/09/02
- Re: How to walk a Lisp_String?, Po Lu, 2022/09/02
- Re: How to walk a Lisp_String?, Eli Zaretskii, 2022/09/02
- Re: How to walk a Lisp_String?, Manuel Giraud, 2022/09/02
- Re: How to walk a Lisp_String?, Eli Zaretskii, 2022/09/02
- Re: How to walk a Lisp_String?,
Po Lu <=
- Re: How to walk a Lisp_String?, Eli Zaretskii, 2022/09/02
- Re: How to walk a Lisp_String?, Manuel Giraud, 2022/09/02
- Re: How to walk a Lisp_String?, Eli Zaretskii, 2022/09/02
- Re: How to walk a Lisp_String?, Manuel Giraud, 2022/09/02
- Re: How to walk a Lisp_String?, Eli Zaretskii, 2022/09/02
- Re: How to walk a Lisp_String?, Manuel Giraud, 2022/09/02
- Re: How to walk a Lisp_String?, Po Lu, 2022/09/02
- Re: How to walk a Lisp_String?, Manuel Giraud, 2022/09/02
- Re: How to walk a Lisp_String?, Po Lu, 2022/09/02
- Re: How to walk a Lisp_String?, Tomas Hlavaty, 2022/09/03