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: Sun, 26 Aug 2018 10:43:32 +0200 (CEST)

>>  FT_Load_Glyph( face, 0, 0 );
>>  FT_Get_Glyph( face->glyph, &reference );
>>
>>  FT_Glyph_Copy( reference, &glyph1 );
>>  ...
>>  FT_Done_Glyph( glyph1 );
>>
>>  FT_Glyph_Copy( reference, &glyph2 );
>>  ...
>>  FT_Done_Glyph( glyph2 );
>>
>>  FT_Done_Glyph( reference );
> 
> Mhm; I mean I get it -- changing to deep copy here would also
> introduce semantic changes which is never anything you really want
> in an API.
> 
> Just another proposal (feel free to decline!): how about coming back
> to (3) and introduce something like `FT_Get_Glyph_Deep'?
> Internally, the same logic could be used; I would simply add a
> switch (bool var) that gets propagated down to
> `ft_bitmap_glyph_init' to skip the lazy copy?  I could even prepare
> the patch if you like, no work for anyone ;)

With `FT_Get_Glyph_Deep' the code would be

  FT_Load_Glyph( face, 0, 0 );

  FT_Get_Glyph_Deep( face->glyph, &glyph1 );
  ...
  FT_Done_Glyph( glyph1 );

  FT_Get_Glyph_Deep( reference, &glyph2 );
  ...
  FT_Done_Glyph( glyph2 );

which indeed looks nicer – but just a bit :-) The question is whether
we really need this...


    Werner

reply via email to

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