![]() |
CRM64Pro GDK v0.14.0
A free cross-platform game development kit built on top of SDL 3.0
|
Font Manager and Font objects for bitmap-based text rendering [v26.01.0].
The Font module provides fast bitmap font handling optimized for game development. Instead of using a more sophisticated TTF font rendering system, the GDK uses a simple and blazing fast approach that is still quite powerful and allows using any kind of font design.
Font images must contain the following 96 characters in this exact order:
! \" # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~
|
The first character is a space. Characters can represent any graphical representation, it is the responsibility of the creator to ensure the correct order.
| Step 1 | Create an image containing the 96-character set using your favorite image design software with any font style and attributes. |
|---|---|
| Step 2 | Ensure the image complies with spacing requirements (see Image requirements below). |
| Step 3 | Save the image to PNG or BMP format. |
| Step 4 | Load the image using the Image Manager (set colorkey now if used). |
| Step 5 | Create a font with FontMgr::create(). |
| Step 6 | Call Font::assignImage() to scan and initialize the font (scans for 96 characters). |
| Character separation | At least 2 pixels between each character. |
|---|---|
| Left/Right margins | At least 5 pixels on each side of the image. |
| Transparency | Use colorkey or alpha transparent pixels for separation and margins. |
| Supported formats | PNG or BMP. |
| Format | CDC v1.x specification. |
|---|---|
| FontMgr::load() | Load font from CDC archive. |
| Font::save() | Save font to CDC archive. |
This is an advanced "cloning" manager: when loading a font from a CDC file that is already loaded or created (using the name as the key), it will create a new child font. Child fonts share base data with the parent while allowing independent state.
Classes | |
| class | CRM64Pro::Font |
| Font Object class. More... | |
| class | CRM64Pro::FontMgr |
| Font Manager class. More... | |