PDA

View Full Version : FCL-Image/FreeType



code_glitch
14-05-2011, 09:23 PM
I have found two issues with FPC and FreeTypes' docs: FPC's docs seem to work but don't really give much information about how to do squat else (http://wiki.lazarus.freepascal.org/fcl-image near the bottom) and FreeType's documentation is written in C (this is OK, I can read C/C++ fine thank god ;)) but does not work with the fcl-image FreeType header since it would seem they are different versions. This is clear from line 1 where you cannot initialize FreeType :o (http://www.freetype.org/freetype2/docs/tutorial/step1.html).

Their other tutorials use an 'OGLFT' which is not supplied by default with FPC and is a little restrictive so is not really what I would like to use. So all in all, does anyone have some more or less functional/up to date code that does the following:

Load a TTF file into a variable of some kind
Render strings in specified colours of that font to an OpenGl Texture or similar? C/C++ and other mainstream languages are fine and I'll post my pascal equivalent once I'm done. Frankly, if this loads/draws TTF text nicely faster than sdl_ttf (hard not to I shoudl think) I'd be happy...

Oh, and I am aware that PGD is slow as sh.. at the moment so I'm not expecting many/any replies until the hosting company figure this one out... ::)

Stoney
15-05-2011, 02:49 AM
I don't think you should expect much of a performance gain by using Freetype directly because SDL_ttf uses FreeType internally.

code_glitch
15-05-2011, 08:12 AM
So you'd have to make your own TTF processor to get better performance? Any thoughts on complexity?

Either way, it would be good to not have to rely on the bulk of SDL to get fonts working nicely... So any code really is welcome here. :)

JSoftware
15-05-2011, 09:10 AM
Did you know that freetype was written in pascal originally: http://www.google.com/codesearch/p?hl=en#nsX8izVpRps/xc/extras/FreeType/pascal/lib

code_glitch
15-05-2011, 09:55 PM
Actually I didn't... Their 'official' site says it was written in C/C++ and FPC says it uses a wrapper...

But some of that code looks very interesting ;) I see some potential for partially integrating that code with my Libs to make a more lightweight FreeType implementation... Interesting indeed. Of course I'll give credit where it is due but that is a very nice find. :)