freetype-devel
[Top][All Lists]
Advanced

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

[Devel] Adding a new function, question about face's alloced memory


From: Tom Kacvinsky
Subject: [Devel] Adding a new function, question about face's alloced memory
Date: Sat, 3 Nov 2001 07:46:57 -0500 (EST)

I would like to write a new function called

    FT_String* FT_Get_Char_Name( FT_Face  face, FT_Byte  char_code )

The idea is for this function to be used with non-CID keyed CFF fonts and Type 1
fonts (hence, the char code is always in the range 0 -- 255, which is why I
chose FT_Byte for the char_code parameter).

The function would access the internal data of the Type 1/CFF face to get the
glyph name for a given char code, and would return a pointer to that name.

The problems I have are that 1. Someone might do a free on this pointer (oops!)
and 2.  They might keep the pointer around, even after the face goes away.  When
they next dereference this pointer, they get garbage.

Do you think FT_Get_Char_Name should have no return value, and the glyph name be
returned in a FT_String* parameter allocated by the user?  In this way, we
wouldn't have to worry about the above points -- it is the users responsibility
to alloc/free the buffer that is passed to FT_Get_Char_Name.

Regards,

Tom




reply via email to

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