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: armin
Subject: Re: [ft-devel] PCF: Issues with lazy copy in `ft_bitmap_glyph_init'
Date: Tue, 28 Aug 2018 22:15:05 +0100

> Werner, Armin,

Alexei,

> Here is all the confusing parts about FT_Get_Glyph:
> - It takes ownership on the bitmap without copying the data. Thus, it should
> not be called twice on the same GlyphSlot and should fail if
> FT_GLYPH_OWN_BITMAP is not set. The current behavior with deep copy when
> FT_GLYPH_OWN_BITMAP is not set is a bug that need to be fixed.
> - It copies the outline data without modifying original ownership. So it is
> the opposite of bitmap glyphs. To add to the confusion FT_OUTLINE_OWNER is in
> a different place.

> I think we should stick to the lazy copy in both cases because it is usually
> used once. The deep copy is a waste because FT_GlyphSlot is usually discarded.
> I do not think the deep copy is useful.

What is the usual use case and why are there two (very) different glyph 
containers in first place (`FT_Glyph' and `FT_GlyphSlot')?  I would expect that 
`FT_GlyphSlot' is a wrapper around `FT_Glyph' to add more information that is 
e.g. needed for rendering etc.  But it turns out that they are two rather 
distinct things.

I totally agree with whatever the two of you cook up;  just trying to shed some 
light from a user's perspective who tries to work with FreeType only (!) 
reading the API docs (not trying to understand any of the black magic that goes 
on in the depths of FT):

The docs surrounding `FT_Get_Glyph' really make it look like I get an 
independent `FT_Glyph' that can be used whatever.  I would definitely add 
several warning signs to the docs.  Also, can FreeType become the owner of that 
generated `FT_Glyph'?  That way the confusion with `FT_Done_Glyph' would vanish 
& it would be clearer that I will always get the same (maybe, but who cares?) 
object from calling `FT_Get_Glyph' -- changes that I make to that object might 
get propageted into `FT_GlyphSlot' (also something that should be put into the 
docs explicitly IMO).  Reflecting on it, I do really believe that the call to 
`FT_Done_Glyph' is the source of much confusion (at least for me).




reply via email to

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