Using TT_NAME_ID_SAMPLE_TEXT

Behdad Esfahbod behdad at behdad.org
Wed Mar 12 17:20:06 UTC 2014


On 14-03-12 02:23 AM, Richard Hughes wrote:
> On 11 March 2014 21:47, Behdad Esfahbod <behdad at behdad.org> wrote:
>>> Okay, that looks awesome. Can I get that data from pango (e.g.
>>> pango_script_get_sample_char) or should I encode it into my program?
>> Commit to Pango please!
> 
> Okay, I've attached two different versions of incomplete patches for
> comments. I'd like to know how to encode the sample chars; all those
> 'if's makes for an unhappy compiler. switch/case might be slightly
> faster, or v2 just defines a static data table the size of all the
> entries in PangoScript (and add a private PANGO_SCRIPT_LAST) and does
> a direct lookup, although if the PANGO_SCRIPT_ defines ever get out of
> sync it'll be tricky to debug. Using the table looks sane to me, but
> it's just a pain to order all those enums :)

Table please.


> I've also chosen char * to return the sample char in, I figured this
> was more flexible than using gunichar and probably easier for the
> consumer to digest and use. Both patches are known incomplete and
> broken. Feedback please :)

Nah.  gunichar.  It's one function call away from turning into UTF-8.

-- 
behdad
http://behdad.org/


More information about the fonts mailing list