.font.ini (Config pack)
.font.ini - is the Moondust Project specific raster font format.
Features and disadvantages
Features
- Full Unicode support.
- Missing characters are using TTF subsystem as a fallback.
- Support for both mono-space and proportional fonts.
Disadvantages
- Width cut-off correction is limited with a 9 pixels maximum offset for each side.
- No support for diacritical signs with relative position offsets.
- One font will contain a lot of files depending on the count of included character maps.
- Non-intuitive character entry format.
- No support for encoded character symbols to specify the character by its full code rather placing the character itself.
Main font profile
This file explaining the font and includes the list of font maps. The font profile must always have the ".font.ini" suffix.
| [ font ] | |||
|---|---|---|---|
| Parameter | Allowed values | Example value | Description |
| name | string | name = "font1" | The short key name of the font which is using to refer this font. |
| ttf-borders | boolean | ttf-borders = "false" | Draw black border in TTF-fallback drawn letters. |
| tables | >=1 | tables = 4 | Count of font maps in this font. |
| space-width | >=1 | space-width = 16 | Width of space character in pixels. |
| interletter-space | >=0 | interletter-space = 1 | Inter-letter space in pixels. |
| newline-offset | >=0 | newline-offset = 20 | Offset between of the lines in pixels. |
List of font maps are used in this font. Each font map includes one sprite - a picture contains drawn letters and map of cells in that image in dependence on UTF8 character. Where is "table*" means the number at 1 which specifies each font map:
| [ tables ] | |||
|---|---|---|---|
| Parameter | Allowed values | Example value | Description |
| table* | string | table* = "font1_en.ini" | Name of the font map file. |
Font map file
Important note: Font map file uses UTF-8 encoding, if your font map file which contents non-ASCII characters isn't UTF-8 encoded, convert with some tools like NotePad--.
Font map contains the characters set mapped to the matrix texture where are actual characters was drawn. The filename of a font map is defined in the raster profile.
| [ font-map ] | |||
|---|---|---|---|
| Parameter | Allowed values | Example value | Description |
| texture | string | texture = "font1_en.png" | Picture contains characters of the font which a matrix of letters. |
| width | >=1 | width = 6 | Horizontal count of cells in the matrix on texture |
| height | >=1 | height = 6 | Vertical count of cells in the matrix on texture |
Map of font. Defines the available characters which can be printed.
| [ entries ] | |||
|---|---|---|---|
| Parameter | Allowed values | Example value | Description |
| Y-X | char | Y-X = "A" | Entry example. |
| Y-X-Z | char | Y-X-Z = "a23" | Entry example |
| Y-X-Z | char | Y-X-Z = "a23" | Entry example |
Entry format
Monospace fonts
Those fonts are have same width of characters. Each entry has next syntax inside of "entries" section:
y0-x1 = "UTF-8 encoded letter"
Example:
0-1 = "X"
- Where y0 - the 0 to N number of the vertical cell where the character is drawn on a texture.
- Where x1 - the 0 to N number of the horizontal cell where the character is drawn on a texture.
- Where X - the actual character which will be assigned to the specified position.
Proportional fonts
Those fonts can have characters of different width. There are can be done with left-right padding subtracting. Example:
0-1 = "X23"
- Where is "0-1" - the X=1 and Y=0 position on the texture
- Where is "X" - the actual character which will be assigned to the specified position.
- Where is "2" - the 0-9 left width cut-off on the character. Means how much pixels will be chopped from the character width at left side.
- Where is "3" - the 0-9 right width cur-off on the character. Means how much pixels will be chopped from the character width at right side.
In this example your character will have final width less than original with difference of 5 pixels (2 at left, and 3 at right).
Assign the same texture position by different characters
When you need to specify the same texture cell for two different characters (for example, for upper "X" and lower "x"), the "Z" discriminator can be used:
y0-x0-z0 = "X"
Example:
0-1-0 = "X" 0-1-1 = "x"
- Where y0 - the 0 to N vertical cell on the texture
- Where x0 - the 0 to N horizontal cell on the texture
- Where z0 - the discriminator value which means nothing, but is used to allow assigning of multiple different characters into the same texture cell.
- Where "X" and "x" - are characters assigned to the given texture position.
Example font
The complete example of the raster font with the full setup of most of properties.
font1.font.ini
[font]
name = "font1"
ttf-borders = true
tables = 4
space-width = 16
interletter-space = 2
newline-offset = 20
[tables]
table1 = "font1_en.ini"
table2 = "font1_ru.ini"
table3 = "font1_misc.ini"
table4 = "font1_misc2.ini"
font1_en.ini
[font-map]
texture = "font1_en.png"
width = 8
height = 8
[entries]
0-0 = "!64"
1-0 = "\"44"
2-0 = "#22"
3-0 = "$22"
4-0 = "%02"
5-0 = "&"
6-0 = "'64"
7-0 = "(44"
0-1 = ")62"
1-1 = "*24"
2-1 = "+22"
3-1 = ",62"
4-1 = "-22"
5-1 = ".62"
6-1 = "/24"
7-1 = "022"
0-2 = "122"
1-2 = "222"
2-2 = "322"
3-2 = "422"
4-2 = "522"
5-2 = "622"
6-2 = "722"
7-2 = "822"
0-3 = "922"
1-3 = ":63"
2-3 = ";63"
3-3 = "<44"
4-3 = "=42"
5-3 = ">44"
6-3 = "?22"
7-3 = "@22"
0-4 = "A22"
1-4 = "B22"
2-4 = "C22"
3-4 = "D22"
4-4 = "E22"
5-4 = "F22"
6-4 = "G22"
7-4 = "H22"
0-5 = "I44"
1-5 = "J22"
2-5 = "K22"
3-5 = "L24"
4-5 = "M20"
5-5 = "N22"
6-5 = "O22"
7-5 = "P22"
0-6 = "Q22"
1-6 = "R22"
2-6 = "S22"
3-6 = "T22"
4-6 = "U22"
5-6 = "V22"
6-6 = "W20"
7-6 = "X22"
0-7 = "Y22"
1-7 = "Z22"
0-4-1 = "a22"
1-4-1 = "b22"
2-4-1 = "c22"
3-4-1 = "d22"
4-4-1 = "e22"
5-4-1 = "f22"
6-4-1 = "g22"
7-4-1 = "h22"
0-5-1 = "i44"
1-5-1 = "j22"
2-5-1 = "k22"
3-5-1 = "l12"
4-5-1 = "m20"
5-5-1 = "n22"
6-5-1 = "o22"
7-5-1 = "p22"
0-6-1 = "q22"
1-6-1 = "r22"
2-6-1 = "s22"
3-6-1 = "t22"
4-6-1 = "u22"
5-6-1 = "v22"
6-6-1 = "w20"
7-6-1 = "x22"
0-7-1 = "y22"
1-7-1 = "z22"
2-7 = "[44"
3-7= "]62"
4-7 = "^42"
font1_ru.ini
[font-map]
texture = "font1_ru.png"
width = 6
height = 6
[entries]
0-0 = "А22"
1-0 = "Б22"
2-0 = "В22"
3-0 = "Г24"
4-0 = "Д02"
5-0 = "Е22"
0-1 = "Ё22"
1-1 = "Ж"
2-1 = "З22"
3-1 = "И22"
4-1 = "Й22"
5-1 = "К22"
0-2 = "Л02"
1-2 = "М20"
2-2 = "Н22"
3-2 = "О22"
4-2 = "П22"
5-2 = "Р22"
0-3 = "С22"
1-3 = "Т22"
2-3 = "У22"
3-3 = "Ф"
4-3 = "Х22"
5-3 = "Ц20"
0-4 = "Ч22"
1-4 = "Ш20"
2-4 = "Щ"
3-4 = "Ъ02"
4-4 = "Ы"
5-4 = "Ь22"
0-5 = "Э22"
1-5 = "Ю"
2-5 = "Я22"
3-5 = "І44"
4-5 = "Ї44"
5-5 = "Є22"
0-0-1 = "а22"
1-0-1 = "б22"
2-0-1 = "в22"
3-0-1 = "г24"
4-0-1 = "д02"
5-0-1 = "е22"
0-1-1 = "ё22"
1-1-1 = "ж"
2-1-1 = "з22"
3-1-1 = "и22"
4-1-1 = "й22"
5-1-1 = "к22"
0-2-1 = "л02"
1-2-1 = "м20"
2-2-1 = "н22"
3-2-1 = "о22"
4-2-1 = "п22"
5-2-1 = "р22"
0-3-1 = "с22"
1-3-1 = "т22"
2-3-1 = "у22"
3-3-1 = "ф"
4-3-1 = "х22"
5-3-1 = "ц20"
0-4-1 = "ч22"
1-4-1 = "ш20"
2-4-1 = "щ"
3-4-1 = "ъ02"
4-4-1 = "ы"
5-4-1 = "ь22"
0-5-1 = "э22"
1-5-1 = "ю"
2-5-1 = "я22"
3-5-1 = "і44"
4-5-1 = "ї44"
5-5-1 = "є22"
font1_misc.ini
[font-map]
texture = "font1_misc.png"
width = 8
height = 9
[entries]
0-0 = "№"
1-0 = "{24"
2-0 = "|68"
3-0 = "}42"
4-0 = "\\24"
5-0 = "_24"
6-0 = "`46"
7-0 = "~24"
8-0 = "©22"
0-1 = "¯24"
1-1 = "¬22"
2-1 = "®22"
3-1 = "¡66"
4-1 = "¢22"
5-1 = "£22"
6-1 = "€02"
7-1 = "¥22"
8-1 = "Š22"
8-1-1 ="š22"
0-2 = "§44"
1-2 = "°44"
2-2 = "±22"
3-2 = "Ž22"
3-2-1 ="ž22"
4-2 = "µ22"
5-2 = "·66"
6-2 = "º44"
7-2 = "«04"
8-2 = "»22"
0-3 = "Œ02"
0-3-1 ="œ02"
1-3 = "Ÿ22"
1-3-1 ="ÿ22"
2-3 = "¿22"
3-3 = "À22"
3-3-1 ="à22"
4-3 = "Á22"
4-3-1 ="á22"
5-3 = "Â22"
5-3-1 ="â22"
6-3 = "Ã22"
6-3-1 ="ã22"
7-3 = "Ä22"
7-3-1 ="ä22"
8-3 = "Å22"
8-3-1 ="å22"
0-4 = "Æ02"
0-4-1 ="æ02"
1-4 = "Ç22"
1-4-1 ="ç22"
2-4 = "È22"
2-4-1 ="è22"
3-4 = "É22"
3-4-1 ="é22"
4-4 = "Ê22"
4-4-1 ="ê22"
5-4 = "Ë22"
5-4-1 ="ë22"
6-4 = "Ì44"
6-4-1 ="ì44"
7-4 = "Í44"
7-4-1 ="í44"
8-4 = "Î44"
8-4-1 ="î44"
0-5 = "Ï44"
0-5-1 ="ï44"
1-5 = "Ð02"
1-5-1 ="ð02"
2-5 = "Ñ22"
2-5-1 ="ñ22"
3-5 = "Ò22"
3-5-1 ="ò22"
4-5 = "Ó22"
4-5-1 ="ó22"
5-5 = "Ô22"
5-5-1 ="ô22"
6-5 = "Õ22"
6-5-1 ="õ22"
7-5 = "Ö22"
7-5-1 ="ö22"
8-5 = "×02"
0-6 = "Ø02"
0-6-1 ="ø02"
1-6 = "Ù22"
1-6-1 ="ù22"
2-6 = "Ú22"
2-6-1 ="ú221"
3-6 = "Û22"
3-6-1 ="û22"
4-6 = "Ü22"
4-6-1 ="ü22"
5-6 = "Ý22"
5-6-1 ="ý22"
6-6 = "Þ44"
6-6-1 ="þ44"
7-6 = "ß22"
8-6 = "÷24"
0-7 = "ª24"
1-7 = "¶02"
2-7 = "¹46"
3-7 = "²44"
4-7 = "³44"
font1_misc2.ini
[font-map]
texture = "font1_misc2.png"
width = 7
height = 8
[entries]
0-0-0="Ą"
0-0-1="ą"
1-0-0="˘"
2-0-0="Ł"
2-0-1="ł"
3-0-0="¤"
4-0-0="Ľ"
4-0-1="ľ"
5-0-0="Ś"
5-0-1="ś"
6-0-0="§"
7-0-0="¨"
0-1-0="Š"
0-1-1="š"
1-1-0="Ş"
1-1-1="ş"
2-1-0="Ť"
2-1-1="ť"
3-1-0="Ž"
3-1-1="ž"
4-1-0="Ż"
4-1-1="ż"
5-1-0="°"
6-1-0="˛"
7-1-0="´"
0-2-0="ˇ"
1-2-0="¸"
2-2-0="˝"
3-2-0="Ŕ"
3-2-1="ŕ"
4-2-0="Á"
4-2-1="á"
5-2-0="Â"
5-2-1="â"
6-2-0="Ă"
6-2-1="ă"
7-2-0="Ä"
7-2-1="ä"
0-3-0="Ĺ"
0-3-1="ĺ"
1-3-0="Ć"
1-3-1="ć"
2-3-0="Ç"
2-3-1="ç"
3-3-0="Č"
3-3-1="č"
4-3-0="É"
4-3-1="é"
5-3-0="Ę"
5-3-1="ę"
6-3-0="Ë"
6-3-1="ë"
7-3-0="Ě"
7-3-1="ě"
0-4-0="Í"
0-4-1="í"
1-4-0="Î"
1-4-1="î"
2-4-0="Ď"
2-4-1="ď"
3-4-0="Đ"
3-4-1="đ"
4-4-0="Ń"
4-4-1="ń"
5-4-0="Ó"
5-4-1="ó"
6-4-0="Ô"
6-4-1="ô"
7-4-0="Ő"
7-4-1="ő"
0-5-0="Ö"
0-5-1="ö"
1-5-0="×"
2-5-0="Ř"
2-5-1="ř"
3-5-0="Ů"
3-5-1="ů"
4-5-0="Ú"
4-5-1="ú"
5-5-0="Ű"
5-5-1="ű"
6-5-0="Ü"
6-5-1="ü"
7-5-0="Ý"
7-5-1="ý"
0-6-0="Ţ"
0-6-1="ţ"
1-6-0="ß"
2-6-0="˙"
3-7-0="Ź"
3-7-1="ź"
5-7-0="Ň"
5-7-1="ň"



