[HarfBuzz] Contextual shaping of Malayalam post(pre)/below base forms

Richard Wordingham richard.wordingham at ntlworld.com
Mon Jun 17 18:38:56 PDT 2013

On Mon, 17 Jun 2013 08:47:10 +0530
Suresh P <sureshp at gmx.com> wrote:

> Behdad Esfahbod wrote:
> > On 13-06-13 07:57 AM, Suresh P wrote:
> >> Behdad Esfahbod wrote:
> >>> On 13-06-11 07:29 AM, Suresh P wrote:

> >>>> I want to know whether it is possible to prevent pref and blwf
> >>>> rules being applied using contextual rules

> >> But I find the ligation(for pref and blwf) always happen
> >> irrespective of the rules in the contextual lookup.

> Okay, as per the spec.
> >    Show us the font and malfunctioning sequence.

> There is no malfunctioning as such. But is looks weird when one see a 
> pre-base RA in front of a base YA ( and a below base LA subjoining
> YA ) because it is never written like this. Instead, in actual use,
> ligation (and reordering) is avoided and written with explicit
> virama. A test case is attached herewith and it applies to any font
> which uses pre-base RA and below base LA. It is better left to the
> font developer to decide the contexts.

I'll offer my understanding of the situation.  If my explanation
doesn't help you, it may be necessary to examine the actual <GSUB>
table of your font to explain what is happening, and other tables will
provide context for it.

So what you want in exactly one lookup for the <blwf> feature:

In context <ya virama la> do nothing
else in context <virama la> ligate virama la.

(The second, normal condition will invoke a ligature lookup.)

That should do what you want; are you having trouble expressing that
in the lookup definition language you are using?

The same trick should work with the <pref> feature:

In context <ya virama ra> do nothing
else in context <virama ra> ligate virama ra.

Again, the second, normal condition will invoke a ligature lookup.
This ligature lookup should *not* be listed under the <pref> feature.

The OpenType specification at

"Reorder pre-base reordering consonants: If a pre-base reordering
consonant is found, reorder it according to the following rules:

1.   Only reorder a glyph produced by substitution during application
     of the <pref> feature. (Note that a font may shape a Ra consonant
     with the <pref> feature generally but block it in certain

This is exactly the logic you want.  RA will be classified as a
pre-base reordering consonant, but not reordered in the context <ya
virama ra> because there will be no substitution resulting from
application of the <pref> feature.  I don't know if this rule applies
to the old Malayalam rendering engine - you may need to ensure that you
have the script tag <mlm2> rather than <mlym> in the <GSUB> table.


More information about the HarfBuzz mailing list