PDA

View Full Version : pgeFont bitmap font library



wraggster
June 21st, 2007, 16:03
News/release from insert witty name: (http://insomniac.0x89.org)


pgeFont is part of Phoenix Game Engine.

-=Info=-
The library loads a TrueType font and generates a swizzled 4-bit paletted bitmap font texture for use when drawing text. It's very fast.

-=Samples=-
There are two samples included, one for raw GU and the other using the graphics library from Yeldarb's tutorials on psp-programming.com
If you're using the graphics library then you may need to reset the sceGuTex* states to what they are defaulted to in the initGraphics() functions, after using the pgeFont* functions.
It should be easy enough to add to any other library.

-=Dependencies=-
Freetype

-=Differences=-
The differences between this release and the actual Phoenix Game Engine pgeFont code are:
- No loading to VRAM
- No loading from memory

Possibly more on release of the engine.

-=Credits=-
Raphael: Converted my initial 8-bit textures to 4-bit and fixed a bug in the swizzle function.

-=License=-
This is released under the Creative Commons Attribution-Share Alike 3.0 License.
See LICENSE for more information.

-=Atttribution=-
With accordance to the license, the following must be adhered to:
If you use the code in any way, shape or form you must attribute it in the following way:

'Uses pgeFont by InsertWittyName - http://insomniac.0x89.org

If you alter the code in any way, shape or form you must also release the updated code under the same license.

See http://creativecommons.org/licenses/by-sa/3.0/ if you need more information.

Download and Give Feedback Via Comments

ldraconus
October 18th, 2007, 21:04
Found a bug in a function:


int pgeFontMeasureText(pgeFont *font, const char *text)
{
if(!font)
return 0;

int x = 0;

while(*text)
{
Glyph *glyph = font->glyph + font->map[*text & 0xff];
x += glyph->advance;
+
+ text++;
+
}

return x;
}