FontData
Jump to navigation
Jump to search
Overview
The font data (.xml file).
Used in font folders and linked by Font definitions (Fonts.sbc).
Creating a font
This XML file can be generated by the font tools included in the game folder.
- Navigate to your game's install folder or SDK folder, then
/Tools/Fonts/. - There duplicate
Options_dialog.txtandMakeFontDataDialog.batwith new names. - Edit your duplicated .bat with notepad to change the
Options_dialog.txtinto whatever name you gave your duplicated .txt file. - Edit your duplicated .txt file to change
-output's value which decides the names of the files. - Run the duplicated .bat which will open a popup to choose the font to convert into a bitmap font.
- Now you have an .xml file and one or more .png textures, you should convert the .png files to .dds and edit the .xml to point to them.
- Place these files in your mod's
Fonts\YourFontName\. - The last step is to have a Fonts.sbc in your mod's Data folder which points to the xml.
For further documentation on BMFontGen, open BMFontGen/bmfontgen.html.
Glyph data
Visualization of the glyph chracteristics:
Baseline being the line where you write on, most characters are above this line. Some characters can stretch under it, for example: g, y, q, etc.
Example syntax
You should not be creating this file manually, the docs and example are merely as an idea of what to expect, use the guide above to create a font.
Short example to see the overall syntax
From white font's FontDataPA.xml but trimmed to have an overview, and stripped unused attributes for clarity:
<?xml version="1.0" encoding="UTF-8" ?>
<font
xmlns="http://xna.microsoft.com/bitmapfont"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xna.microsoft.com/bitmapfont bitmapfont.xsd"
base="30" height="37">
<bitmaps>
<bitmap id="0" name="FontDataPA-0.dds" size="1024x1024" />
<!-- ... -->
</bitmaps>
<glyphs>
<glyph ch=" " bm="0" origin="0,0" size="15x45" aw="8" lsb="-7" ho="0" />
<glyph ch=""" bm="0" origin="39,0" size="25x45" aw="10" lsb="-7" ho="0" />
<!-- ... -->
</glyphs>
<kernpairs>
<kernpair left="Ж" right="в" adjust="-1" />
<!-- ... -->
</kernpairs>
</font>
Elements
basebase (attribute[1]) | Type: Int32 | Default: (required) | ||||||||||||||||||||||||||||||||||||||||||
| Distance from top of font to the baseline. | ||||||||||||||||||||||||||||||||||||||||||||
heightheight (attribute[1]) | Type: Int32 | Default: (required) | ||||||||||||||||||||||||||||||||||||||||||
| Distance from top to bottom of the font. | ||||||||||||||||||||||||||||||||||||||||||||
bitmaps<bitmaps> | Type: bitmap[] | Default: null | ||||||||||||||||||||||||||||||||||||||||||
List of textures that can be used by the <glyph> elements.
<bitmaps>
<bitmap id="0" name="FontDataPA-0.dds" size="1024x1024" />
<!-- ... -->
</bitmaps>
| ||||||||||||||||||||||||||||||||||||||||||||
glyphs<glyphs> | Type: glyph[] | Default: null | ||||||||||||||||||||||||||||||||||||||||||
List of characters supported by this font.
Unused or obsolete elements <glyphs>
<glyph bm="0" ch="+" origin="305,0" size="34x45" lsb="-7" aw="18" ho="0" />
<!-- ... -->
</glyphs>
| ||||||||||||||||||||||||||||||||||||||||||||
kernpairs<kernpairs> | Type: kernpair[] | Default: null | ||||||||||||||||||||||||||||||||||||||||||
Optional list of pairs of characters to ajust spacing between them (kerning).
<kernpairs>
<kernpair left="Ж" right="в" adjust="-1" />
<!-- ... -->
</kernpairs>
| ||||||||||||||||||||||||||||||||||||||||||||
Obsolete Elements
Elements that exist in the game code or vanilla SBC, but do nothing