freetype-devel
[Top][All Lists]
Advanced

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

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


From: Tom Kacvinsky
Subject: Re: [Devel] Adding a new function, question about face's alloced memory
Date: Sun, 4 Nov 2001 09:23:17 -0500 (EST)

Nope, I need to add a new function because I do now want to build the cmap
synthesizer for the CFF driver (just yet).  The function FT_Get_Glyph_Name()
requires a non-empty cmap list for it to work properly. And the function
FT_Get_Postscript_Name() has nothing to do with getting glyph names (only names
of the font, from either the names table in a TT font or the /FontName in a Type
1 font).

I will do the "buffer thing" where the user (not FT) has control over the 
buffer.

Tom

On Sun, 4 Nov 2001, Detlef Würkner wrote:

> address@hidden (Tom Kacvinsky) wrote:
>
> > I would like to write a new function called
> >
> >     FT_String* FT_Get_Char_Name( FT_Face  face, FT_Byte  char_code )
>
> Can't you use FT_Get_Glyph_Name() or FT_Get_Postscript_Name() instead of
> writing a new function?
>
> > 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.
>
> You could either supply a pointer to a buffer and the length of the
> buffer to copy the name into like in FT_Get_Glyph_Name() or just receive
> a pointer that keeps valid until the face is freed like in
> FT_Get_Postscript_Name(). I would prefer the first method.
>
> Ciao, Detlef
>

-- 
all alone the life you lead -- a silent diner where you feed
bow your head and pretend to read -- this one is for you

Brian and Robert (from The Story of the Ghost, by Phish)





reply via email to

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