Re: [css3-fonts] font matching and grapheme clusters (was Re: [css3-fonts] font selection for Unicode Variation Selector)

On 2/27/2011 11:25 PM, John Daggett wrote:
>
> Given a grapheme, for each font in the fontlist:
>
> 1. Test for cmap support of base + all combiners, stop if match
> 2. If can be normalized to precomposed character, test cmap for
>     precomposed character, stop if match
> 3. Match individual characters, fallback for unsupported characters

Almost what we have implemented in Flash's flash.text.engine:

1. same

2. same intent, but slightly different formulation:  if there is more 
than one code point in the cluster, and it is canonically equivalent to 
a single code point, test the cmap for that code point, use it if match 
(there are sequences which are canonically equivalent to a singe code 
point but do not normalize to that code point).

3. iterate 1,2 over all the fonts, either listed in the font-family, or 
in the user agent fallback list

4. if not found, just map the individual characters using the first font.


Also, we use a notion of grapheme clusters that makes <Cons1, Virama, 
Cons2> a single cluster (if Virama and Cons2 have the same script).


Eric.

Received on Monday, 28 February 2011 20:04:45 UTC