Difference between revisions of "Unit Font"
Line 4: | Line 4: | ||
=== Description === | === Description === | ||
---- | ---- | ||
+ | |||
+ | '''Ultibo Font interface unit''' | ||
The fonts supported by Ultibo are a bitmap format that contains a block of data where each character is represented by a number of consecutive bytes. | The fonts supported by Ultibo are a bitmap format that contains a block of data where each character is represented by a number of consecutive bytes. |
Revision as of 04:58, 19 December 2016
Return to Unit Reference
Description
Ultibo Font interface unit
The fonts supported by Ultibo are a bitmap format that contains a block of data where each character is represented by a number of consecutive bytes.
Fonts can either be statically compiled as a pascal unit and loaded during startup or can be dynamically loaded by passing a header and data block to the FontLoad() function. A Font Builder tool is available to change common bitmap font formats into a pascal unit for compiling with a project.
For an 8x16 (8 pixels wide and 16 pixels high) font the data contains 8 bits (1 byte) for each of the 16 rows that make up a character and each character would be 16 bytes long.
For a 12x22 font the data contains 12 bits padded to 16 bits (2 bytes) for each of the 22 rows that make up a character. Therefore each character would be 44 bytes in length.
This unit can support any size font from 8x6 to 32x64 including every combination in between. For fonts where the bits per row is greater than one byte both little endian and big endian format is supported. Allowance has been made for including a Unicode translation table with each font so that writing of Unicode text to the console can be supported as well as an extended bitmap format where character data includes alpha or color information or both. These features are yet to be fully implemented.
Constants
FONT_*
FONT_MIN_COUNT = 256;
|
|
FONT_MIN_WIDTH = 8;
|
|
FONT_MAX_WIDTH = 32;
|
|
FONT_MIN_HEIGHT = 6;
|
|
FONT_MAX_HEIGHT = 64;
|
FONT_SIGNATURE_*
FONT_SIGNATURE = $77DE1BBC;
|
FONT_MODE_*
FONT_MODE_NONE = 0;
|
|
FONT_MODE_PIXEL = 1;
|
A font with 1 bit per pixel in the character data |
FONT_MODE_ALPHA8 = 2;
|
A font with 8 bits of alpha blending per pixel in the character data |
FONT_MODE_RGBA32 = 3;
|
A font with 32 bits RGBA per pixel in the character data |
NAME_*
FONT_FLAG_NONE = $00000000;
|
|
FONT_FLAG_UNICODE = $00000001;
|
Font includes a unicode translation table |
FONT_FLAG_CODEPAGE = $00000002;
|
Font has a specified codepage |
FONT_FLAG_BIGENDIAN = $00000004;
|
Font characters are in big endian order (Only applies to characters larger than one byte) |
FONT_FLAG_RIGHTALIGN = $00000008;
|
Font characters are right aligned, no need to shift during load |
FONT_FLAG_VARIABLE = $00000010;
|
Font characters are variable width rather than fixed |
Type definitions
To be documented
Public variables
To be documented
Function declarations
Initialization functions
procedure FontInit;
Note | None documented |
---|
Font functions
function FontLoad(Header:PFontHeader; Data:PFontData; Size:LongWord):TFontHandle;
Header | Pointer to the font header |
---|---|
Data | Pointer to the font data |
Size | Size of the font data |
function FontLoadEx(Header:PFontHeader; Data:PFontData; Unicode:PFontUnicode; Size:LongWord; Properties:PFontProperties):TFontHandle;
Header | Pointer to the font header |
---|---|
Data | Pointer to the font data |
Unicode | Pointer to the unicode translation table (Optional) |
Size | Size of the font data |
Properties | Pointer to a font properties record to use instead of the header (Optional) |
function FontUnload(Handle:TFontHandle):LongWord;
Note | None documented |
---|
function FontGetName(Handle:TFontHandle):String;
Note | None documented |
---|
function FontGetDescription(Handle:TFontHandle):String;
Note | None documented |
---|
function FontGetWidth(Handle:TFontHandle):LongWord;
Note | None documented |
---|
function FontGetHeight(Handle:TFontHandle):LongWord;
Note | None documented |
---|
function FontGetProperties(Handle:TFontHandle; Properties:PFontProperties):LongWord;
Note | None documented |
---|
function FontCharWidth(Handle:TFontHandle; Character:Word):LongWord;
Note | None documented |
---|
function FontCharHeight(Handle:TFontHandle; Character:Word):LongWord;
Note | None documented |
---|
function FontTextWidth(Handle:TFontHandle; const Text:String):LongWord;
Note | None documented |
---|
function FontTextHeight(Handle:TFontHandle; const Text:String):LongWord;
Note | None documented |
---|
function FontFindByName(const Name:String):TFontHandle;
Note | None documented |
---|
function FontFindByDescription(const Description:String):TFontHandle;
Note | None documented |
---|
function FontEnumerate(Callback:TFontEnumerate; Data:Pointer):LongWord;
Note | None documented |
---|
PSF font functions
function PSFFontLoad(const FileName:String):TFontHandle;
Note | None documented |
---|
function PSFFontLoadEx(Data:Pointer;Size:LongWord):TFontHandle;
Note | None documented |
---|
Font helper functions
function FontGetCount:LongWord; inline;
Note | None documented |
---|
function FontGetDefault:TFontHandle; inline;
Note | None documented |
---|
function FontSetDefault(Handle:TFontHandle):LongWord;
Note | None documented |
---|
function FontCheck(Font:PFontEntry):PFontEntry;
Note | None documented |
---|
Return to Unit Reference