|
ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
|
Fixed-width Fonts baked into a glyph sheet, drawn as one quad per glyph. More...
Go to the source code of this file.
Data Structures | |
| struct | FontBitmap |
| A fixed-width Font's glyphs, baked into one sheet, drawn as one quad per glyph. More... | |
Macros | |
| #define | FONT_BITMAP_COLUMNS 32 |
The number of cells per row of the glyph sheet: FONT_BITMAP_COUNT cells make a square grid of this many columns and rows. | |
| #define | FONT_BITMAP_COUNT 1024 |
| The codepoint count Font bakes into its bitmap. | |
| #define | FONT_BITMAP_FIRST ' ' |
| The first codepoint Font bakes into its bitmap. | |
| #define | FONT_BITMAP_LAST (FONT_BITMAP_FIRST + FONT_BITMAP_COUNT) |
| One past the last baked codepoint in a Font bitmap (exclusive upper bound). | |
| #define | FONT_BITMAP_REPLACEMENT '?' |
| The codepoint drawn in place of one outside the baked range. | |
Functions | |
| OBJECTIVELYMVC_EXPORT void | deallocBitmap (FontBitmap *bitmap) |
Releases the resources held by bitmap. Safe to call on a zeroed FontBitmap. | |
| OBJECTIVELYMVC_EXPORT bool | initBitmap (FontBitmap *bitmap, Font *font) |
Bakes FONT_BITMAP_COUNT codepoints of font, from FONT_BITMAP_FIRST, into a glyph sheet, initializing bitmap. | |
| OBJECTIVELYMVC_EXPORT void | renderCharactersBitmap (Font *self, const Renderer *renderer, const char *chars, SDL_Color color, int wrapWidth, const SDL_Point *origin, const ImageAtlas *icons) |
| Implements Font::renderBitmapCharacters. | |
| OBJECTIVELYMVC_EXPORT void | renderDeviceWillResetBitmap (Font *self) |
| Implements Font::renderDeviceWillReset. | |
| OBJECTIVELYMVC_EXPORT void | sizeCharactersBitmap (const Font *self, const char *chars, int wrapWidth, const ImageAtlas *icons, int *w, int *h) |
| Implements Font::sizeBitmapCharacters. | |
Fixed-width Fonts baked into a glyph sheet, drawn as one quad per glyph.
Definition in file Font+Bitmap.h.
| #define FONT_BITMAP_COLUMNS 32 |
The number of cells per row of the glyph sheet: FONT_BITMAP_COUNT cells make a square grid of this many columns and rows.
Definition at line 50 of file Font+Bitmap.h.
| #define FONT_BITMAP_COUNT 1024 |
The codepoint count Font bakes into its bitmap.
Covers Basic Latin, Latin-1 Supplement, Latin Extended-A/B, and Greek and Coptic (U+0020-U+041F) – generous enough for any Latin- or Greek-script text without configuration. Individual codepoints a Font lacks a glyph for are simply skipped, not rejected, so this is safe to bake against any fixed-width face regardless of its actual coverage.
Definition at line 40 of file Font+Bitmap.h.
| #define FONT_BITMAP_FIRST ' ' |
The first codepoint Font bakes into its bitmap.
Definition at line 31 of file Font+Bitmap.h.
| #define FONT_BITMAP_LAST (FONT_BITMAP_FIRST + FONT_BITMAP_COUNT) |
One past the last baked codepoint in a Font bitmap (exclusive upper bound).
Definition at line 45 of file Font+Bitmap.h.
| #define FONT_BITMAP_REPLACEMENT '?' |
The codepoint drawn in place of one outside the baked range.
Definition at line 55 of file Font+Bitmap.h.
| OBJECTIVELYMVC_EXPORT void deallocBitmap | ( | FontBitmap * | bitmap | ) |
Releases the resources held by bitmap. Safe to call on a zeroed FontBitmap.
| bitmap | The FontBitmap. |
Definition at line 375 of file Font+Bitmap.c.
| OBJECTIVELYMVC_EXPORT bool initBitmap | ( | FontBitmap * | bitmap, |
| Font * | font | ||
| ) |
Bakes FONT_BITMAP_COUNT codepoints of font, from FONT_BITMAP_FIRST, into a glyph sheet, initializing bitmap.
A codepoint outside the range draws FONT_BITMAP_REPLACEMENT instead.
| bitmap | The FontBitmap, zero-initialized. |
| font | The Font, which MUST be fixed-width. |
font is not fixed-width or has no glyphs in the range, in which case bitmap is left zeroed. Definition at line 322 of file Font+Bitmap.c.
| OBJECTIVELYMVC_EXPORT void renderCharactersBitmap | ( | Font * | self, |
| const Renderer * | renderer, | ||
| const char * | chars, | ||
| SDL_Color | color, | ||
| int | wrapWidth, | ||
| const SDL_Point * | origin, | ||
| const ImageAtlas * | icons | ||
| ) |
Implements Font::renderBitmapCharacters.
Definition at line 452 of file Font+Bitmap.c.
| OBJECTIVELYMVC_EXPORT void renderDeviceWillResetBitmap | ( | Font * | self | ) |
Implements Font::renderDeviceWillReset.
Definition at line 390 of file Font+Bitmap.c.
| OBJECTIVELYMVC_EXPORT void sizeCharactersBitmap | ( | const Font * | self, |
| const char * | chars, | ||
| int | wrapWidth, | ||
| const ImageAtlas * | icons, | ||
| int * | w, | ||
| int * | h | ||
| ) |
Implements Font::sizeBitmapCharacters.
Definition at line 485 of file Font+Bitmap.c.