Using TT_NAME_ID_SAMPLE_TEXT

Richard Hughes hughsient at gmail.com
Wed Mar 12 09:23:36 UTC 2014


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 :)

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 :)

Richard.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-pango_script_get_sample_char.patch
Type: text/x-patch
Size: 2319 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/fonts/attachments/20140312/c9ed228d/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Add-pango_script_get_sample_char-using-a-table-of-da.patch
Type: text/x-patch
Size: 6076 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/fonts/attachments/20140312/c9ed228d/attachment-0001.bin>


More information about the fonts mailing list