XML:TSFF

From OniGalore
Jump to navigation Jump to search
TSFF : Font Family
XML modding tips
  • See HERE to start learning about XML modding.
  • See HERE if you are searching for information on how to handle object coordinates.
  • See HERE for some typical modding errors and their causes.
XML.png
XML

TRSC << Other file types >> TURR

switch to OBD page

General information

  • TSFF is a singleton global resource found in level0_Final.dat.
  • It describes a font family that Oni can use. The only font family available is Tahoma.
  • You can visualize the data in OniBrowser. Be sure to also install the XNA package from Microsoft's website.

Hierarchy

TSFF instance
 |
 +-- TSFL instance
 |
 +-- TSFT instances
      |
      +-- TSGA instances

TSFF tag

XML tag Content type Description
<TSFF> - Parent tag
<Language> link Link to TSFL file (there is only one in Oni, TSFLRoman)
<Fonts> - List of instance links for TSFT files representing each style and size (there are 15 available)
<Link> # + instance number

TSFL tag

The TSFL file (the only one in Oni, TSFLRoman) is extracted to a separate file from the rest of the tags on this page, but we consider it here.

XML tag Content type Description
<TSFL id="0"> Parent tag
<Offset_0008> string Unused
<Breaking> string What characters a line can break on. There is only a space character here.
<Offset_0088> string Unused
<Offset_00C8> string Unused
<Offset_0108> string Unused

TSFT tags

The TSFT is where the actual pixel data for the glyphs is stored, however the TSGAs underneath this tag define the bounds of each glyph's pixels within the data blob.

XML tag Content type Description
<TSFT> Parent tag
<FontSize> int16
<FontStyle> int16
0 - normal font
1 - bold font
2 - italic font
<AscenderHeight> int16
<DescenderHeight> int16
<LeadingHeight> int16
<Offset_001A> int16
<Glyphs> List of links to TSGAs
<Link>
<GlyphBitmaps> Elements of pixel data
<Int32> int32 Once each element is split into 4 individual bytes, each byte can be read as a hex color code for a pixel.

Here's the list of available Tahoma sizes and styles in the TSFTs:

ID 2, FontSize 7, FontStyle 1
ID 3, FontSize 7, FontStyle 0
ID 4, FontSize 7, FontStyle 2
ID 5, FontSize 14, FontStyle 1
ID 6, FontSize 14, FontStyle 0
ID 7, FontSize 14, FontStyle 2
ID 8, FontSize 10, FontStyle 1
ID 9, FontSize 10, FontStyle 0
ID 10, FontSize 10, FontStyle 2
ID 11, FontSize 12, FontStyle 1
ID 12, FontSize 12, FontStyle 0
ID 13, FontSize 12, FontStyle 2
ID 14, FontSize 9, FontStyle 1
ID 15, FontSize 9, FontStyle 0
ID 16, FontSize 9, FontStyle 2

TSGA tags

XML tag Content type Description
<TSGA>
<Glyphs> Glyph array for character codes 0-255 (ASCII)
<TSGAGlyph>
<Index> int16
<Width> int16 What is the difference of Width and GlyphWidth? Picture please.
<GlyphWidth> int16
<GlyphHeight> int16
<GlyphXOrigin> int16
<GlyphYOrigin> int16
<GlyphBitmapOffset> int32

Every TSGA file contains 256 elements. One element stands for one of the 256 signs of the ASCII table. The first 32 signs are reserved control characters, so these elements are always all-zero.

A glyph is basically a monochrome bitmap that's (width * height) pixels in size. Each pixel is stored in one byte in the TSFT file. (Fonts are antialiased, so shades of gray are needed rather than storing each pixel in one bit.) Each element in the TSFT file, being 32-bits, contains 4 pixels. The rows are not 32-bit aligned, so a new row of pixels can start inside an element.