|
ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
|
A fixed-width Font's glyphs, baked into one sheet, drawn as one quad per glyph. More...
#include <Font+Bitmap.h>
Data Fields | |
| int | advance |
| The pen advance per glyph, in texels. | |
| int | bearing |
| The horizontal offset from the pen to a cell's left edge, in texels. | |
| SDL_Size | cellSize |
| The size of one cell, in texels. | |
| SDL_Surface * | surface |
The glyph sheet: a grid of FONT_BITMAP_COLUMNS by FONT_BITMAP_COLUMNS cells of cellSize, in texels, or NULL if the Font is not fixed-width. | |
A fixed-width Font's glyphs, baked into one sheet, drawn as one quad per glyph.
A Font rasterizes each string into its own surface and Texture, which costs hundreds of microseconds every time the string changes. A fixed-width Font therefore rasterizes a range of codepoints once, into a uniform grid of glyphs on a single surface, and Text draws it as one quad per glyph from that sheet. Unlike an ImageAtlas, nothing is packed: every glyph's position follows from its codepoint and the glyph size, so the grid is its own lookup table. Text that changes every frame becomes free.
Only fixed-width faces are supported, so there are no per-glyph metrics: a codepoint's cell is codepoint - FONT_BITMAP_FIRST, and overhang is baked by sizing every cell to the face's maximum ink bounds. This discards kerning and shaping (ligatures, joining, reordering), which is fine for a HUD or console and wrong for proportional prose; proportional Fonts never bake.
Cells are physical texels, rasterized at the Font's pixel density; sizes reported through sizeBitmapCharacters are logical, as Font's are. Like the Font that owns it, a FontBitmap is immutable and bound to that Font's pixel density.
This is a value embedded in Font, not an Object: surface == NULL means the Font is not fixed-width and has no bitmap.
Definition at line 82 of file Font+Bitmap.h.
| int FontBitmap::advance |
The pen advance per glyph, in texels.
Definition at line 86 of file Font+Bitmap.h.
| int FontBitmap::bearing |
The horizontal offset from the pen to a cell's left edge, in texels.
Negative when glyphs lean left of the pen, as a synthetic italic does.
Definition at line 92 of file Font+Bitmap.h.
| SDL_Size FontBitmap::cellSize |
The size of one cell, in texels.
Definition at line 97 of file Font+Bitmap.h.
| SDL_Surface* FontBitmap::surface |
The glyph sheet: a grid of FONT_BITMAP_COLUMNS by FONT_BITMAP_COLUMNS cells of cellSize, in texels, or NULL if the Font is not fixed-width.
Definition at line 103 of file Font+Bitmap.h.