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: Antoine Leca
Subject: Re: [Devel] Adding a new function, question about face's alloced memory
Date: Mon, 05 Nov 2001 10:58:26 +0100

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 )

What about:
- passing a (user) buffer and the length of it
- returning the length of the string written
- in the case the length prove to be too small, return the length that
  would be needed, and the content of the buffer is said to be
  'indetermined' (may be partially written, maybe not)

That way, you have two ways to use the function:
- either, allocate a "sufficient" buffer, and use, and hopefully (?)
check you did not overrun (I know this is not "the right way")
- or, first call with a length of 0, to get the needed length; then,
allocate the memory (as you need to, malloc(), ::operator new, etc.),
and call a 2nd time he 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).

Hmmm, this is the kind of "optimizations" I do not find useful.

I see the same function as useful for type 4.0 'post' tables in 'sfnt'
(TrueType) fonts, where the names of the characters, highly repetitive
(like a0101, a0102, a0103, etc.) are encoded as 16-bit quantities;
however, there may be as much as 65,536 characters in such a font, so
your function won't do the job. :-(


Antoine



reply via email to

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