Re: [HarfBuzz] Ligatures

2020-05-26 Thread Khaled Hosny
> On May 24, 2020, at 6:34 PM, Eli Zaretskii wrote: > >> From: Khaled Hosny >> Date: Sun, 24 May 2020 18:00:45 +0200 >> Cc: harfbuzz@lists.freedesktop.org >> > >> This, for example, ensures that HarfBuzz can do basic Arabic-like shaping >> across item boundaries e.g. if you break items in

Re: [HarfBuzz] Ligatures

2020-05-25 Thread Eli Zaretskii
> Date: Sun, 24 May 2020 20:27:26 +0100 > From: Richard Wordingham > Cc: harfbuzz@lists.freedesktop.org > > It seems to me that Emacs knows what script a cluster is in; perhaps > it just hasn't united the concepts. It's a kind of coincidence: different scripts almost always require different

Re: [HarfBuzz] Ligatures

2020-05-24 Thread Richard Wordingham
On Sun, 24 May 2020 17:18:27 +0300 Eli Zaretskii wrote: > > Date: Sat, 23 May 2020 21:42:24 +0100 > > From: Richard Wordingham > > > As for different scripts: if the character codepoints are the > > > same, Emacs currently assigns each character to a single script. > > I'll need to dig

Re: [HarfBuzz] Ligatures

2020-05-24 Thread Eli Zaretskii
> From: Khaled Hosny > Date: Sun, 24 May 2020 18:00:45 +0200 > Cc: harfbuzz@lists.freedesktop.org > > In general the safest is to pass the whole paragraph of text and the start > and length of each item (item being a run with same font, direction, script, > and language). I was talking about

Re: [HarfBuzz] Ligatures

2020-05-24 Thread Khaled Hosny
> On May 24, 2020, at 5:41 PM, Eli Zaretskii wrote: > >>> I almost understand (and agree), sans one part: the "arbitrary parts" >>> of what you wrote. If we want to produce a ligature out of "ffi", the >>> shaper will get "fii" and nothing more. Which part here is arbitrary? >> >> Sending

Re: [HarfBuzz] Ligatures

2020-05-24 Thread Eli Zaretskii
> > I almost understand (and agree), sans one part: the "arbitrary parts" > > of what you wrote. If we want to produce a ligature out of "ffi", the > > shaper will get "fii" and nothing more. Which part here is arbitrary? > > Sending "ffi" alone is an arbitrary decision. The font might have

Re: [HarfBuzz] Ligatures

2020-05-24 Thread Eli Zaretskii
> Date: Sat, 23 May 2020 21:42:24 +0100 > From: Richard Wordingham > > > As for different scripts: if the character codepoints are the same, > > Emacs currently assigns each character to a single script. > > I'll need to dig deeper. Composition of both 'a' and Greek alpha with > an acute

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Richard Wordingham
On Sat, 23 May 2020 19:45:17 +0300 Eli Zaretskii wrote: > > Date: Sat, 23 May 2020 16:54:51 +0100 > > From: Richard Wordingham > > Cc: harfbuzz@lists.freedesktop.org > > > > > Emacs supports more than one rule for each composable sequence of > > > characters. > > > > That doesn't help

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Simon Cozens
On 23/05/2020 08:44, Eli Zaretskii wrote: Thanks. Since (b) is not really feasible without redesigning the entire Emacs display engine (for which I see no volunteers lining up any time soon), I guess we will have to use some more-or-less reasonable and somewhat unreliable heuristics by

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> Cc: harfbuzz@lists.freedesktop.org > From: Simon Cozens > Date: Sat, 23 May 2020 20:14:16 +0100 > > On 23/05/2020 08:44, Eli Zaretskii wrote: > > Thanks. Since (b) is not really feasible without redesigning the > > entire Emacs display engine (for which I see no volunteers lining up > > any

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> Date: Sat, 23 May 2020 20:06:32 +0100 > From: Richard Wordingham > > There are three different tools for producing what looks like an "ffi" > ligature: > > 1) Make a ligature > 2) Contextual substitution > 3) A mix of contextual substitution and kerning. > > A font that uses the first will

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> From: Khaled Hosny > Date: Sat, 23 May 2020 20:54:15 +0200 > Cc: harfbuzz@lists.freedesktop.org > > > We pass to the shaper the part of text that matches the regexps you > > can see at the end of misc-lang.el, then display the glyphs the shaper > > returns. The above description is a

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Richard Wordingham
On Sat, 23 May 2020 21:26:00 +0300 Eli Zaretskii wrote: > > From: Khaled Hosny > > Date: Sat, 23 May 2020 20:09:50 +0200 > > Cc: harfbuzz@lists.freedesktop.org > > > > Overall, if you can’t send the whole text (words are the absolute > > minimum, but this has its issues as well), don’t just

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> From: Khaled Hosny > Date: Sat, 23 May 2020 20:40:44 +0200 > Cc: harfbuzz@lists.freedesktop.org > > Sending “ffi” alone is an arbitrary decision. The font might have kerning > between “ffi” and what comes before and after it, but you won’t get it. The > font might not hav a ligature for

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Khaled Hosny
> On May 23, 2020, at 8:34 PM, Eli Zaretskii wrote: > >> From: Khaled Hosny >> Date: Sat, 23 May 2020 20:18:33 +0200 >> Cc: harfbuzz@lists.freedesktop.org >> >>> The Emacs display engine examines the text to be displayed and laid >>> out one character at a time, and makes layout decisions

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Khaled Hosny
> On May 23, 2020, at 8:26 PM, Eli Zaretskii wrote: > >> From: Khaled Hosny >> Date: Sat, 23 May 2020 20:09:50 +0200 >> Cc: harfbuzz@lists.freedesktop.org >> >> Overall, if you can’t send the whole text (words are the absolute minimum, >> but this has its issues as well), don’t just send

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> From: Khaled Hosny > Date: Sat, 23 May 2020 20:18:33 +0200 > Cc: harfbuzz@lists.freedesktop.org > > > The Emacs display engine examines the text to be displayed and laid > > out one character at a time, and makes layout decisions after each > > character or grapheme cluster it lays out. Its

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> From: Khaled Hosny > Date: Sat, 23 May 2020 20:09:50 +0200 > Cc: harfbuzz@lists.freedesktop.org > > Overall, if you can’t send the whole text (words are the absolute minimum, > but this has its issues as well), don’t just send arbitrary parts of it as > the result will be some inconsistent

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Khaled Hosny
> On May 23, 2020, at 10:35 AM, Eli Zaretskii wrote: > >> From: Khaled Hosny >> Date: Sat, 23 May 2020 09:59:15 +0200 >> Cc: harfbuzz@lists.freedesktop.org >> >> Also either Emacs is currently treating text that it enables shaping for as >> second-class citizens where limitations/degraded

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Khaled Hosny
> On May 23, 2020, at 10:25 AM, Eli Zaretskii wrote: > >> From: Khaled Hosny >> Date: Sat, 23 May 2020 09:51:21 +0200 >> Cc: harfbuzz@lists.freedesktop.org >> >>> Thanks. Since (b) is not really feasible without redesigning the >>> entire Emacs display engine (for which I see no volunteers

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> Date: Sat, 23 May 2020 16:54:51 +0100 > From: Richard Wordingham > Cc: harfbuzz@lists.freedesktop.org > > > Emacs supports more than one rule for each composable sequence of > > characters. > > That doesn't help when the rules give conflicting divisions into > clusters, which is the case with

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> Date: Sat, 23 May 2020 16:33:12 +0100 > From: Richard Wordingham > > On Sat, 23 May 2020 11:25:38 +0300 > Eli Zaretskii wrote: > > > > From: Khaled Hosny > > > Date: Sat, 23 May 2020 09:51:21 +0200 > > > Cc: harfbuzz@lists.freedesktop.org > > > What are you going to do about kerning, or

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Richard Wordingham
On Sat, 23 May 2020 17:22:58 +0300 Eli Zaretskii wrote: > > Date: Sat, 23 May 2020 14:51:53 +0100 > > From: Richard Wordingham > > > > > > They may of course have more than one set of such rules, with > > > > the rule sets defining different sets of sequences. > > > > > > Who are "they"

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Richard Wordingham
On Sat, 23 May 2020 11:25:38 +0300 Eli Zaretskii wrote: > > From: Khaled Hosny > > Date: Sat, 23 May 2020 09:51:21 +0200 > > Cc: harfbuzz@lists.freedesktop.org > > What are you going to do about kerning, or mark positioning? > > Partially kerning arbitrary glyphs (because the sub string match >

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> Date: Sat, 23 May 2020 14:51:53 +0100 > From: Richard Wordingham > > > > They may of course have more than one set of such rules, with the > > > rule sets defining different sets of sequences. > > > > Who are "they" in this context? > > Devanagari and Tai Tham are two examples I am aware

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Richard Wordingham
On Sat, 23 May 2020 09:09:48 +0300 Eli Zaretskii wrote: > > Date: Fri, 22 May 2020 22:22:49 +0100 > > From: Richard Wordingham > > > > > The current support for producing ligatures works in the same way > > > as complex text shaping for scripts that require that, like > > > Arabic and Khmer:

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> From: Khaled Hosny > Date: Sat, 23 May 2020 09:59:15 +0200 > Cc: harfbuzz@lists.freedesktop.org > > Also either Emacs is currently treating text that it enables shaping for as > second-class citizens where limitations/degraded performance is acceptable > (which is really really bad) Could

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> From: Khaled Hosny > Date: Sat, 23 May 2020 09:51:21 +0200 > Cc: harfbuzz@lists.freedesktop.org > > > Thanks. Since (b) is not really feasible without redesigning the > > entire Emacs display engine (for which I see no volunteers lining up > > any time soon), I guess we will have to use some

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Khaled Hosny
> On May 23, 2020, at 9:51 AM, Khaled Hosny wrote: > > > >> On May 23, 2020, at 9:44 AM, Eli Zaretskii wrote: >> >>> From: Khaled Hosny >>> Date: Sat, 23 May 2020 08:36:10 +0200 >>> Cc: harfbuzz@lists.freedesktop.org >>> The only

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Khaled Hosny
> On May 23, 2020, at 9:44 AM, Eli Zaretskii wrote: > >> From: Khaled Hosny >> Date: Sat, 23 May 2020 08:36:10 +0200 >> Cc: harfbuzz@lists.freedesktop.org >> >>> The only way of >>> doing this right, I'm told, is to either (a) query the

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> From: Khaled Hosny > Date: Sat, 23 May 2020 08:36:10 +0200 > Cc: harfbuzz@lists.freedesktop.org > > >The only way of > > doing this right, I'm told, is to either (a) query the font to get the > > list of all the ligatures it supports, or

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Khaled Hosny
> On May 22, 2020, at 9:32 PM, Eli Zaretskii wrote: > > Hi, > > This is a bit off-topic, but I thought it could be appropriate to ask > here, since we have here some of the best experts on this subject. > > We are discussing support for ligatures in Emacs, specifically when > using HarfBuzz

Re: [HarfBuzz] Ligatures

2020-05-23 Thread Eli Zaretskii
> Date: Fri, 22 May 2020 22:22:49 +0100 > From: Richard Wordingham > > > The current support for producing ligatures works in the same way as > > complex text shaping for scripts that require that, like Arabic and > > Khmer: the sequences of characters that can be displayed as ligatures > > are

Re: [HarfBuzz] Ligatures

2020-05-22 Thread Richard Wordingham
On Fri, 22 May 2020 22:32:04 +0300 Eli Zaretskii wrote: > Can someone please tell what are the recommended practices regarding > these ligatures? Is the set of possible ligatures indeed infinite and > impossible to know in advance? And does HarfBuzz have APIs to query a > font about the

Re: [HarfBuzz] Ligatures

2020-05-22 Thread Richard Wordingham
On Fri, 22 May 2020 22:32:04 +0300 Eli Zaretskii wrote: > Hi, > > This is a bit off-topic, but I thought it could be appropriate to ask > here, since we have here some of the best experts on this subject. > > We are discussing support for ligatures in Emacs, specifically when > using HarfBuzz

Re: [HarfBuzz] Ligatures and color changes

2013-05-21 Thread Khaled Hosny
On Tue, Feb 19, 2013 at 05:53:04PM -0500, Behdad Esfahbod wrote: On 02/19/2013 05:47 PM, Khaled Hosny wrote: On Tue, Feb 19, 2013 at 05:34:40PM -0500, Behdad Esfahbod wrote: As for *where* to cut the ligature, here's what you need: * Count the number of cursor positions *inside* the

Re: [HarfBuzz] Ligatures and color changes

2013-02-20 Thread Jonathan Kew
On 19/2/13 23:35, Lóránt Pintér wrote: Using ZWNJ would be a great way of fixing it. And indeed it splits the ligature all right, but it also destroys the kerning. Here's a little test I did with HarfBuzz @ e0486fc1affd3796fb8f664e2e7fc208f1d2106c: (the font has an fi ligature, and has some

Re: [HarfBuzz] Ligatures and color changes

2013-02-20 Thread Lóránt Pintér
I'm trying this with a font that has the kerning data in the kern table as well as in the GPOS table. (Is that possible?) Can you show me a font that this feature works with? -- Lóránt Pintér Developer at Prezi (http://prezi.com) On Wednesday, February 20, 2013 at 10:26 AM, Jonathan

Re: [HarfBuzz] Ligatures and color changes

2013-02-20 Thread Jonathan Kew
On 20/2/13 12:24, Lóránt Pintér wrote: I'm trying this with a font that has the kerning data in the kern table as well as in the GPOS table. (Is that possible?) Can you show me a font that this feature works with? I thought we'd seen it work last week, but now it doesn't seem to. :( Behdad,

Re: [HarfBuzz] Ligatures and color changes

2013-02-19 Thread Behdad Esfahbod
Hi Lóránt, On 02/19/2013 12:20 PM, Lóránt Pintér wrote: Hi, I have a problem with half-colored ligatures, like (5) mfim in the image: Right. That's one of the harder issues of text rendering. I figured out two ways to do this, but neither is good enough: * I can shape each color

Re: [HarfBuzz] Ligatures and color changes

2013-02-19 Thread Khaled Hosny
On Tue, Feb 19, 2013 at 05:34:40PM -0500, Behdad Esfahbod wrote: Is there maybe a way to tell HarfBuzz to ignore ligatures if they span that color boundary? Or is there maybe a way to (quickly) assess if liga would be applied to a range of characters? We don't have a good answer for

Re: [HarfBuzz] Ligatures and color changes

2013-02-19 Thread Behdad Esfahbod
On 02/19/2013 05:47 PM, Khaled Hosny wrote: On Tue, Feb 19, 2013 at 05:34:40PM -0500, Behdad Esfahbod wrote: Is there maybe a way to tell HarfBuzz to ignore ligatures if they span that color boundary? Or is there maybe a way to (quickly) assess if liga would be applied to a range of

Re: [HarfBuzz] Ligatures and color changes

2013-02-19 Thread Jonathan Kew
On 19/2/13 22:34, Behdad Esfahbod wrote: Hi Lóránt, On 02/19/2013 12:20 PM, Lóránt Pintér wrote: Hi, I have a problem with half-colored ligatures, like (5) mfim in the image: Right. That's one of the harder issues of text rendering. I figured out two ways to do this, but neither is good

Re: [HarfBuzz] Ligatures and color changes

2013-02-19 Thread Lóránt Pintér
Using ZWNJ would be a great way of fixing it. And indeed it splits the ligature all right, but it also destroys the kerning. Here's a little test I did with HarfBuzz @ e0486fc1affd3796fb8f664e2e7fc208f1d2106c: (the font has an fi ligature, and has some kerning between F and ,) Splitting the