freetype-devel
[Top][All Lists]
Advanced

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

Re: [ft-devel] PCF: Issues with lazy copy in `ft_bitmap_glyph_init'


From: Werner LEMBERG
Subject: Re: [ft-devel] PCF: Issues with lazy copy in `ft_bitmap_glyph_init'
Date: Sat, 25 Aug 2018 19:44:09 +0200 (CEST)

>> (1) Avoid lazy copying in `FT_Get_Glyph'.
> 
> How frequently is `FT_Get_Glyph' used and in which context?

Within FreeType it's used only once.  However, the demo programs use
it quite frequently.

>> (2) Update the documentation:
>>
>>       By default, `FT_Get_Glyph' can be used only once.[*] If you
>>       want more copies, use either `FT_Copy_Glyph' or call
>>       `FT_GlyphSlot_Own_Bitmap' before calling `FT_Get_Glyph'
>>       again.
> 
> If I'm not mistaken, `FT_Glyph_Done' is still problematic in that case:
> 
> (1) if `FT_Glyph_Done' is NOT called, we (might?) end up with mem
>     leaks, but
> 
> (2) IF it is called, the bitmap in the face's glyph slot gets erased
>     (something that is not expected IMO) and the whole loaded glyph
>     cannot be used anymore.

I think the updated documentation in my other e-mail, together with
the example file, should clarify the usage.  However, it still doesn't
fit your usage pattern...

>> What do you prefer?
> 
> This question is not targeted towards me (I think) but if the
> overhead of properly copying the bitmaps is OK with `FT_Get_Glyph's
> current use cases (do we have any statistics on API usage?), I would
> lobby for that outcome.  Esp. since `FT_Get_Glyph' has the potential
> of being something really powerful ... however, the lazy copy makes
> it unintuitively and complicated to use (beware: opinion!) ... then
> again, I currently use the API in somewhat unconventional ways,
> other people might have other preferences there.

Yeah.  Another proposal.

(3) Make `FT_Get_Glyph' always do a deep copy.  Add new function
    `FT_Get_Glyph_Lazy' to do a lazy copy if it holds a bitmap object.


    Werner



reply via email to

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