So, this will be the prototype:

HB_EXTERN hb_map_t *
hb_ot_layout_lookup_get_glyphs_alternates (hb_face_t *face,
                                           unsigned   lookup_index);

behdad
http://behdad.org/


On Sun, Jun 15, 2025 at 11:40 AM Behdad Esfahbod <beh...@behdad.org> wrote:

> Hi Werner,
>
> I have an idea. Similar in essence to `af_map_lookup`, just using another
> style to avoid extra allocations.
>
> Basically, to get gid's variants, you will check `gid + (i << 24)` for i
> being 0, 1, 2, ... until you hit a miss.
>
> This allows for just one hash table to be returned. Allows for 24bit
> gid's. Its only limitation is 8bit of alternates, but if you see gid has
> alternate at index 255, you can use to the slower API to get all the
> remaining alternates.
>
> Does that sound good to you? I can go ahead and prototype it.
> behdad
> http://behdad.org/
>
>
> On Sun, Jun 15, 2025 at 1:00 AM Werner LEMBERG <w...@gnu.org> wrote:
>
>>
>> I've just submitted a Merge Request to speed up the auto-hinter
>> start-up.  The previous code using HarfBuzz functions was far too slow
>> to be acceptable – HarfBuzz (currently) doesn't exactly provide what
>> we need, causing way to much overhead.
>>
>> To speed things up it was necessary to (partially) parse, validate and
>> access the GSUB table.  I really tried to avoid that, but...
>>
>> Please have a look!  The speed-up is really impressive, I think; the
>> old code slowed down the start-up time by more than 300% (in
>> comparison to a commit before introducing vertical accent
>> positioning), while the new code only adds about 25%.
>>
>>   https://gitlab.freedesktop.org/freetype/freetype/-/merge_requests/381
>>
>> Ideally, I would like to get rid of the GSUB code since it doesn't fit
>> conceptually into FreeType (and HarfBuzz does it anyway).  Behdad, do
>> you have ideas whether something similar to `af_map_lookup` could be
>> added to HarfBuzz?  This would be a long-term solution, since even if
>> HarfBuzz gets fitting functionality I don't want to make FreeType
>> depend on the newest HarfBuzz version...
>>
>>
>>     Werner
>>
>

Reply via email to