[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Compositing glyphs.
From: |
David Turner |
Subject: |
Re: Compositing glyphs. |
Date: |
Fri, 15 Sep 2000 11:38:46 +0200 |
Hi Nathan,
Nathan Hurst a écrit :
>
> G'Day, B-)
>
> I've been asked several times how to composite glyphs from freetype, so
> I've written my understanding up at
>
> http://www.csse.monash.edu.au/~njh/phd/ft-composition.txt
>
> Please feel free to send me comments, or to move this onto the main
> freetype site.
>
I think it'd be an interesting idea to provide this kind of document
on the freetype site, though a few screenshots to illustrate this
would be welcomed :-)
Other than that, I believe that the correct way to render text is
to render each line into an intermediate gray buffer, perform
saturation, then blit/compose the whole line with one of the
available composition routines, yours included.
> njh
> p.s. Is there an authoritative document on how FT2 manages memory?
What do you mean exactly ? :
- what objects belong to the library, and which do not ?
(especially when they're returned to client apps)
Basically, I would say that this must be documented
for each function call. If not, the information is
missing..
- how memory is managed internally ? Well, all memory
allocations are made through FT_Alloc, FT_Realloc and
FT_Free, that all have interesting properties:
- the second argument is a pointer to a pointer,
which is always set to 0 in case of error (in
the case of allocation), or normally (in the
case of FT_Free).
- their first parameter is a FT_Memory handle to
a memory manager. (see <freetype/ftsystem.h> for
details). It's possible to plug your own manager
by initializing the library with:
// create memory manager
FT_Memory my_memory = ....;
// create new library instance
error = FT_New_Library( my_memory, &library );
if (error) ...
// register default modules to the new library
error = FT_Add_Default_Modules( library );
if (error)
this sequence replaces a FT_Init_FreeType call
(which uses a default memory manager based on malloc/free)
You must also finalize your library with
FT_Done_Library() instead of FT_Done_FreeType()
And finally, there isn't a single static or global variable
in the code, so you can run several library instances concurrently
(but each instance isn't thread-safe though to simplify the design
of the engine, and more importantly, of modules).
> p.p.s. I'm going to be in Sydney for a couple of days so I may take a
> while in answering emails :-)
Have fun in Sidney :-)
Cheers,
- David