freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Update on OT-SVG in FreeType


From: Werner LEMBERG
Subject: Re: Update on OT-SVG in FreeType
Date: Tue, 03 Aug 2021 20:42:45 +0000 (UTC)

>> ...why must this be in FreeType at all?  It's user data, so what
>> about letting the application store this?  All hooks are in user
>> space, right?
> 
> This caching is something that the hooks need, FreeType doesn't
> care, it's an optimization that the hooks want to do.  But at the
> same time, it's not really user data.  It's intermediate temporary
> data generated and used by the rendering process.  While the client
> itself plugs in the hooks, the rest of the "client application"
> never really cares about this data.

But both caching and rendering happens outside of FreeType, right?

> If you store this in some structure on the client side, how should
> the hooks access it?

The hooks can pass a pointer for the cache data, as they already do
for the glyph slot.

> Are you thinking of making it a global variable that can be then
> accessed by the hook functions?

No, not a global variable, but (additional) pointers in the hooks.

> Also, the cache structure must be unique for each instance of
> FT_Library, so making it a global variable may not work.

Yep.  Additionally, it wouldn't be thread-safe.

What about something like the following.

  typedef FT_Error
  (*SVG_Lib_Init_Func)( void*  data )

  typedef void
  (*SVG_Lib_Free_Func)( void*  data );

  typedef FT_Error
  (*SVG_Lib_Render_Func)( FT_GlyphSlot  slot,
                          void*         data );

  typedef FT_Error
  (*SVG_Lib_Preset_Slot_Func)( FT_GlyphSlot  slot,
                               void*         data,
                               FT_Bool       cache );



    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]