Centurion Font

From ModdingWiki
Jump to: navigation, search
Centurion Font
Centurion Font.png
Format typeTileset
HardwareVGA
Max tile count96
PaletteExternal
Tile names?No
Minimum tile size (pixels)0×0
Maximum tile size (pixels)8×? (no real height limitation, but also no real way to use custom-height fonts in-game)
Plane count1
Plane arrangementLinear
Transparent pixels?Palette-based
Hitmap pixels?No
Metadata?None
Supports sub-tilesets?No
Compressed tiles?No
Hidden data?No
Games

The font format used in Centurion: Defender of Rome is a 1-bpp format which starts at index 0x20 and has 0x60 (96) symbols. It defines individual widths per symbol, and supports Y-offsets, but contains no real header.

When drawing text, the game automatically adds a single pixel between all symbols, meaning there are no padding pixels around the symbols in the font.

Font extraction

The game's two fonts are inside the OVL0.OVL file. Not much is known about the format, but the fonts can be found at the following offsets:

  • 8x6: 0x154B4 -> 0x157B4 (768 bytes)
  • 8x8: 0x1509C -> 0x1545C (960 bytes)

Since the font's data size is based on its height, the fonts can perfectly be extracted, edited and re-inserted into the same space, as long as the overall font height is not changed. Given the fact these fonts have no header, changing their height is useless anyway, unless the data defining what heights the game uses for them is found and edited.

File format

The font has no header, always contains 96 symbols, and does not support widths greater than 8 pixels.

The structure of the file is the following:

Offset Data type Name Description
0x00 UINT8[0x60] SymbolWidths Array of bytes indicating the width of each symbol, in pixels.
0x60 UINT8[0x60] SymbolYOffsets Array of bytes indicating the Y-offset of each symbol, in pixels.
0xC0 BYTE[0x60*height] SymbolData Symbol data.

Since the combined length of the two arrays at the start is always 0x0C bytes, and each line of graphics is always exactly one byte, the overall font height can be calculated as (FileSize - 0xC0) / 0x60. Once you have the height, the whole file can be parsed.

An extra check that can be done for accurate format detection is to see that none of the data in the SymbolWidths array exceeds value '8'.

Image data

The actual images in the font are simple one bit per pixel raster bitmaps, cut off at the width defined in the widths list. The Y-offset allows shifting them down to get a larger overall font height without needing extra bytes for the empty lines at the top.

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 WindowsYesYesYesN/AN/A Created by Nyerguds