KORT Font

From ModdingWiki
Jump to navigation Jump to search
KORT Font
KORT Font.png
Format typeFont
Max glyph count96
Minimum glyph size (pixels)0×0
Maximum glyph size (pixels)255×255
Access modeIndexed
Metadata?None
Bitmap glyphs?Yes
Vector glyphs?No
Compressed glyphs?No
Hidden data?Yes
Games

The font used in King Arthur's K.O.R.T. is a 1-bpp font which starts at index 0x20 and has 0x60 (96) characters. It defines individual widths per character, and supports Y-offsets.

File format

Header

Offset Data type Name Description
0x00 UINT8 FontStride Maximum amount of bytes used for each font symbol line. Multiply by 8 to get the actual maximum font symbol width.
0x01 UINT8 FontHeight Font symbol height, in pixels.
0x02 UINT8[0x60] SymbolWidths Array of bytes indicating the width of each symbol, in pixels. This can never contain values larger than FontStride * 8.
0x62 UINT8[0x60] SymbolYOffsets Array of bytes indicating the Y-offset, from the bottom up. This means the value has to be subtracted from the global height to get the real Y offset.
0xC2 BYTE[FontStride * FontHeight * 0x60] SymbolData Symbol data.

As you see, the symbol width is in bytes, not in pixels. This should give a theoretical maximum of 8*255 as symbol width, but this is negated by the fact the symbol widths array is saved in bytes.

Image data

The image data is an array of 96 entries, each one with a size of FontStride * FontHeight, making the different symbols easy to fetch using calculated addresses.

However, despite the font reserving the maximum space for each character, the character data itself still uses the minimum stride necessary for its width. So if the font has a stride of 2 and a symbol height of 11, it will reserve 2*11 bytes for each symbol, even for those that are less than 8 pixels wide, and such a character will not use two bytes per line, but only one, using up only half of the reserved space, and leaving the second half empty. This means that, to correctly visualize the data, the stride needs to be recalculated for each symbol using the data in the SymbolWidths array, with the formula symbolStride = (SymbolWidths[index] + 7) / 8.

The Y-offsets found in the SymbolYOffsets array are inverted: they indicate how many pixels to move the symbol up from the bottom line. This means that a normal unshifted symbol will have a Y value identical to the FontHeight, while a symbol with Y-value '0' will be shifted completely under the bottom line.

The actual font data are simple one bit per pixel raster bitmaps, as also found in the Dynamix fonts.

Tools

The following tools are able to work with files in this format.

Name PlatformView images in this format? Convert/export to another file/format? Import from another file/format? Access hidden data? Edit metadata? Notes
Westwood Font Editor WindowsYesYesYesNoN/A