emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Entering emojis


From: Lars Ingebrigtsen
Subject: Re: Entering emojis
Date: Fri, 05 Nov 2021 06:04:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> > And the definitions of those rules should be specific to the font you
>> > are using, because different fonts support different ligatures.
>> 
>> Huh.  Well, I know nothing about this, but...  don't the fonts come with
>> this metadata?
>
> Maybe they do, I don't know.  If someone does know, please tell how to
> get that meta-data.

I don't know anything about this, but I'm just poking around.

So, I've got a font called Jolie that has a very noticeable ligature --
it turns the string "#03" (1-3 are ligatures, the rest aren't) into a
swoosh.

I tried the hb-shape harfbuzz debug command:

larsi@elva:~/src$ hb-shape -V ~/.fonts/Jolie\ Romantique.ttf "#03"
trace: start table GSUB buffer: [numbersign=0|zero=1|three=2]
trace: start lookup 0   buffer: [numbersign=0|zero=1|three=2]
trace: end lookup 0     buffer: [end3.swsh=0]
trace: end table GSUB   buffer: [end3.swsh=0]
trace: start table GPOS buffer: [end3.swsh=0+362]
trace: start lookup 0   buffer: [end3.swsh=0+362]
trace: end lookup 0     buffer: [end3.swsh=0+362]
trace: end table GPOS   buffer: [end3.swsh=0+362]
[end3.swsh=0+362]

And indeed, it finds the swoosh in the GSUB/GPOS ligature tables in the
font file.  If I try a combination that doesn't have a swoosh:

larsi@elva:~/src$ hb-shape -V ~/.fonts/Jolie\ Romantique.ttf "#05"
trace: start table GSUB buffer: [numbersign=0|zero=1|five=2]
trace: start lookup 0   buffer: [numbersign=0|zero=1|five=2]
trace: end lookup 0     buffer: [numbersign=0|zero=1|five=2]
trace: end table GSUB   buffer: [numbersign=0|zero=1|five=2]
trace: start table GPOS buffer: [numbersign=0+407|zero=1+289|five=2+313]
trace: start lookup 0   buffer: [numbersign=0+407|zero=1+289|five=2+313]
trace: end lookup 0     buffer: [numbersign=0+407|zero=1+289|five=2+313]
trace: end table GPOS   buffer: [numbersign=0+407|zero=1+289|five=2+313]
[numbersign=0+407|zero=1+289|five=2+313]

It returns three characters instead of a cluster, if I interpret this
correctly.

So apparently by traversing the GSUB/GPOS tables (whatever they are),
this data can be found, and then we can feed it to font-shape-gstring
and get ligatures?

I've had a peek at the hb-shape source code, but it's unfortunately
written in the C++ style "everything happens somewhere else", so it's a
bit difficult to read.

But apparently we already parse these tables in hbfont_otf_capability?
So...  we need...  to parse them more to get all the ligature data out
of them and then...  put it in a ... char table range?  How all this
connects is very vague to me.  😀

Does this have anything to do with anything:

https://harfbuzz.github.io/harfbuzz-hb-ot-layout.html#hb-ot-layout-get-ligature-carets

?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



reply via email to

[Prev in Thread] Current Thread [Next in Thread]