manpagez: man pages & more
html files: harfbuzz
Home | html | info | man

Level 2

Level 2 is a different beast from levels 0 and 1. It is simple to describe, but hard to make sense of. It simply doesn't do any cluster merging whatsoever. When things ligate or otherwise multiple glyphs turn into one, the cluster value of the first glyph is retained.

Here are a few examples of why processing cluster values produced at this level might be tricky:

Ligatures with combining marks

Imagine capital letters are bases and lower case letters are combining marks. With an input sequence like this:

  A,a,B,b,C,c
  0,1,2,3,4,5

if A,B,C ligate, then here are the cluster values one would get under the various levels:

level 0:

  ABC,a,b,c
  0  ,0,0,0

level 1:

  ABC,a,b,c
  0  ,0,0,5

level 2:

  ABC,a,b,c
  0  ,1,3,5

Making sense of the last example is the hardest for a client, because there is nothing in the cluster values to suggest that B and C ligated with A.

Reordering

Another tricky case is when things reorder. Under level 2:

  A,B,C,D,E
  0,1,2,3,4

Now imagine D moves before B:

  A,D,B,C,E
  0,3,1,2,4

Now, if D ligates with B, we get:

  A,DB,C,E
  0,3 ,2,4

In a different scenario, A and B could have ligated before D reordered; that would have resulted in:

  AB,D,C,E
  0 ,3,2,4   

There's no way to differentitate between these two scenarios based on the cluster numbers alone.

Another problem appens with ligatures under level 2 if the direction of the text is forced to opposite of its natural direction (e.g. left-to-right Arabic). But that's too much of a corner case to worry about.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.