[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywh
From: |
Clément Pit-Claudel |
Subject: |
Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)) |
Date: |
Mon, 18 May 2020 15:01:49 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 |
On 18/05/2020 13.39, Eli Zaretskii wrote:
>> From: Clément Pit-Claudel <address@hidden>
>> Date: Mon, 18 May 2020 13:31:30 -0400
>>
>> I've attached a screenshot with a few examples, though I couldn't find a
>> font that displays ae as æ.
>
> Thanks. Once again, I wonder how they decide where each parts starts
> and ends. The examples show very simple cases, so it's hard to know
> where this ends.
Hi Eli,
I asked on Firefox' Matrix server. Here is a lightly edited transcript:
cpitclaudel> Hi all. I noticed that Firefox has this nifty feature that makes
it possible to move the cursor within a ligature (for example, with the right
font config, "ffi" can be rendered as "ffi" while allowing the cursor to move
between the individual glyphs that make up that composition). Is the
extraction of ligature information and the rendering done by Firefox itself, or
by a lower-level library? Most font shaping libraries I've seen don't seem to
return glyph-decomposition information for ligatures, so I'm curious to
understand how Firefox does it ^^
jfkthame> Firefox uses harfbuzz to handle the font shaping (ligature rules,
etc). I'd expect what you describe to work pretty much the same in other
browsers too, fwiw.
krosylight
cpitclaudel> Thanks! But Harfbuzz doesn't give sub-glyph information for
ligatures, does it? So how does Firefox know where to put the caret when it
moves through a ligature?
jfkthame> it doesn't, really - it just knows how many underlying characters are
represented by the ligature glyph, and divides the advance width up into that
many slices (usually that works pretty reasonably, but it's possible to come up
with fonts where the inaccuracy becomes obvious)
jfkthame> In principle, OpenType fonts can provide specific positions for the
caret within a ligature (see the LigatureCaretList subtable within the GDEF
table), but in practice that's rarely supported or used (harfbuzz can provide
this information if it's present, see the hb_ot_layout_get_ligature_carets
function, but currently firefox doesn't use it anyhow)
cpitclaudel> Thanks, that's very useful! How does that work for glyphs like
"fs" displayed as ẞ or "fz" displayed as ß? Does Firefox move in that single
glyph? (I couldn't find a font that does that, otherwise I'd have tested it ^^)
Thanks a lot for your help :)
jfkthame> Yes, it'd be the same - doesn't matter what the specific characters
are, if there's a ligature of two characters Firefox would put the caret
half-way through the ligature glyph when it is between the component characters
in the underlying text
jfkthame> btw, if you're on a mac (or have access to one), you can see an
extreme case if you try the word "Zapfino" in the font Zapfino .... the entire
word is a single 7-character ligature, and the seven equal slices that Firefox
treats it as for selection/editing purposes don't match up to the visual shapes
of the sub-glyphs at all well
HTH,
Clément.
- Re: Ligatures, (continued)
- Re: Ligatures, tomas, 2020/05/18
- Re: Ligatures, Eli Zaretskii, 2020/05/18
- Re: Ligatures, tomas, 2020/05/18
- Re: Ligatures, Eli Zaretskii, 2020/05/18
- Re: Ligatures, Stefan Monnier, 2020/05/18
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), Clément Pit-Claudel, 2020/05/18
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), Eli Zaretskii, 2020/05/18
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)),
Clément Pit-Claudel <=
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), Eli Zaretskii, 2020/05/18
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), tomas, 2020/05/18
- Re: Ligatures, Stefan Monnier, 2020/05/18
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), Alan Third, 2020/05/18
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), Eli Zaretskii, 2020/05/19
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), Clément Pit-Claudel, 2020/05/19
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), Pip Cet, 2020/05/19
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), Clément Pit-Claudel, 2020/05/19
- Re: Ligatures, Stefan Monnier, 2020/05/19
- Re: Ligatures (was: Unify the Platforms: Cairo+FreeType+Harfbuzz Everywhere (except TTY)), tomas, 2020/05/20