KORT Font

From ModdingWiki
Jump to: navigation, search
KORT Font
KORT Font.png
Format typeTileset
HardwareVGA
Max tile count96
PaletteExternal
Tile names?No
Minimum tile size (pixels)0×0
Maximum tile size (pixels)255×255
Plane count1
Plane arrangementLinear
Transparent pixels?Palette-based
Hitmap pixels?No
Metadata?None
Supports sub-tilesets?No
Compressed tiles?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 FontWidthBytes Maximum amount of bytes used for the 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 FontWidthBytes * 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[FontWidthBytes * 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 FontWidthBytes * FontHeight, making the different symbols easy to fetch using calculated addresses.

However, despite the font reserving the full byte width for each character, characters still use the minimum amount of needed bytes per line of pixels. So if the font has a byte width 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 amount of bytes to read per pixel line 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 Created by Nyerguds