[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ft-devel] FT_New_Memory_Face free buffer? (v2.2.1, win32)
From: |
Darkvater |
Subject: |
[ft-devel] FT_New_Memory_Face free buffer? (v2.2.1, win32) |
Date: |
Sat, 2 Dec 2006 00:56:51 +0100 |
As read from the mailinglist archives when loading a font from memory
the memory buffer itself is used and must be available until one is
done with FreeType. This, while easily encountered during debugging if
one properly frees a buffer and sets it to NULL is not mentioned
anywhere (apart from a single mailinglist archive).
Neither in the docs:
http://freetype.sourceforge.net/freetype2/docs/reference/ft2-base_interface.html#FT_New_Memory_Face
Nor in the tutorial:
http://freetype.sourceforge.net/freetype2/docs/tutorial/step1.html
(section b. From memory)
I think it should be put there.
My actual question is that, obviously you do need to free the buffer
yourself when using FT_New_Memory_Face. Regarding this, I have one
question and one proposal. The question is who can I reliably
determine from the face itself if the font was loaded from Memory?
Judging from debugging information and looking into the documentation
FT_Face->stream->descriptor, FT_Face->stream->read,
FT_Face->stream->close might be a good candidate. Can someone tell me
if I can use any of these and which one preferrably, or should I look
somewhere else to make this distinction?
My suggestion would be to create an additional FT_Done_Face() function
that not only accepts an FT_Face paramter but also a second one, which
when set to free also frees any user-supplied buffers to FreeType.
Thank you for your time,
Tamas Farago
P.S. Yes I know, some could say: use a global variable for buffer and
just free that when done, but that is not really a good programming
practice and can even be troublesome with multiple FreeType libraries
loaded to find the correct one.
- [ft-devel] FT_New_Memory_Face free buffer? (v2.2.1, win32),
Darkvater <=