Fonts is an unimaginatively-named bitmap font manager for the PlayStation portable. Fonts uses a custom file format based on TXR, the texture format used by Tex. You must initialize Tex before using Fonts.
Font metrics describe the dimensions of individual characters and the font as a whole. There are several terms used to describe a font metrics, but Fonts is designed to be easy to use, so you only need to understand a couple of the terms.

The baseline is an imaginary line on which characters are drawn. You might think of characters as "sitting" on the baseline. A descender is a portion of a character that descends below the baseline. Examples of characters with descenders are g, q, and p. Line height is the amount of space required between two baselines. Line height includes space for descenders and a little bit of whitespace between lines.
If you know the coordinates of the top-left corner of where you'd like to draw some text, you can calculate the position of the baseline like so: top + lineHeight - descender
There's quite a bit more to font metrics, but that's all you need to know to use Fonts.
typedef struct { ...
Structure describing metrics for a single character. Normally, your program never needs to access structures of this type.
| Field | Type | Description |
|---|---|---|
srcX | s32 | X-coordinate of the character's bitmap image in the font's texture. |
srcY | s32 | Y-coordinate of the character's bitmap image in the font's texture. |
srcWidth | s32 | Width of the character's bitmap image in the font's texture. |
srcHeight | s32 | Height of the character's bitmap image in the font's texture. |
dstX | s32 | Amount to offset the X-coordinate of this character in the destination image. |
dstY | s32 | Amount to offset the Y-coordinate of this character in the destination image. |
advancement | s32 | Amount to advance the drawing position after drawing this character. |
typedef struct { ...
Structure describing a font.
| Field | Type | Description |
|---|---|---|
characterCount | u32 | Number of characters in the font. |
lineHeight | u32 | Height in pixels of one line in the font. |
descender | u32 | Size in pixels of the font's largest descender. |
texture | TexTexture* | Texture containing the font's character bitmaps. |
characters | FntCharacter* | Array of character metrics. |
fntLoad - Loads a font into memory.fntFree - Frees memory occupied by a font.fntDraw - Draws a string using the specified font.int fntDraw(FntFont *font, u32 color, int x, int y, const char *fmt, ...)
Draws fmt at the specified coordinates using font. The baseline is positioned at y. Before drawing, fmt is processed with sprintf, so you can include formatting codes and corresponding extra arguments. The text will be drawn with the color specified by color, which must be in 8888 format.
This function adds commands to the current GU display list. It must be called between sceGuStart and sceGuFinish.
Returns x plus the total width of the characters drawn.
void fntFree(FntFont *font)
Frees all memory occupied by font.
FntFont *fntLoad(const char *file)
Loads a font into memory. file must be a font file in FNT format.
Font uses Tex to load font textures. If Tex wasn't initialized with a cacheless pointer, you must flush the CPU's cache before using the loaded font.
FNT is a simple font format based on the TXR texture format. FNT files consists of two parts: texture and metrics. All data in a FNT file is little-endian.
The beginning of a FNT file is a TXR. The texture contains images of all characters in the font.
Immediately following the texture are the font metrics. This section has a short header followed by an array of FntCharacter structures. The header, which is identical to the first six bytes of a FntFont structure, consists of the following fields:
| Byte Count | Description |
|---|---|
| 2 | Number of characters in the font. |
| 2 | Line height. |
| 2 | Size in pixels of the font's largest descender. |
The first FntCharacter structure describes the space character (ASCII 32). Subsequenct FntCharacter structures describe the remainder of the ASCII character space in sequence.
At the moment there are no publicly available tools for creating FNT files. Sorry. In the meantime, you can download some free FNT files based on the Bitstream Vera fonts.