Page 1 of 1
FreeType Tips?
Posted: Sat May 12, 2007 1:38 am
by pcmattman
Does anyone have any tips for implementing the FreeType library into my OS? I'm planning to do this ASAP so I can get my GUI programming started (I can't start until I have text output). What sort of runtime is necessary? Will I need file i/o, if so what functions and how are they called?
And has anyone got any other method of printing text in graphics mode (short of getting the BIOS font)?
Posted: Sat May 12, 2007 11:36 am
by carbonBased
I read up on the Borland stroked (*.CHR) font format and wrote a quick loader/renderer for it in my first graphics library.
You can probably find a few stroked fonts online (I believe I include some in my graphics library, actually), and there was also a stroked font creation app for DOS available back in the day.
These fonts aren't as configurable, or pretty, as true type fonts, but if you're looking to get something up and running quickly, these fonts are easy to parse and render (only about a hundred lines of code!).
Then, later, once you've got your APIs solidified, you can patch in the FreeType library.
If you want to take this approach, the source can be downloaded from
http://www.neuraldk.org (the product is called Petal).
--Jeff
Posted: Sat May 12, 2007 12:27 pm
by Alboin
If you can port something using SDL, then you're pretty much set. I found
Sfont which has a C++ interface. There's no other libraries involved. Moreover, an even simpler library would be
sdl_picofont. (Which would be the one I would suggest as the font is programmed right in the library.)
If you're set on freetype, however, the
Design of freetype might be of some help.
Posted: Sat May 12, 2007 7:43 pm
by pcmattman
Wow, it is simple! And it's done in such a way that I can keep the font but take away the SDL part.
Edit: I ported it to my OS by taking out the SDL references and rewriting the font renderer. It only took me about an hour, you just need to be able to plot pixels onto the screen.
So now I have 8-bit fonts in my OS GUI
![Very Happy :D](./images/smilies/icon_biggrin.gif)