OBD:TSGA: Difference between revisions

1,319 bytes added ,  11 July 2021
m
no edit summary
mNo edit summary
mNo edit summary
Line 2: Line 2:




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 complete zero.
Every TSGA file contains 256 elements of 20 bytes each, thus takes up 5120 bytes without the header. Together with the 8-byte header and 32-byte padding, each TSGA takes up 5152 bytes in a .dat (another 20 bytes are taken up in the instance descriptor array).


For Western languages, a TSFT has only one TSGA which corresponds to a more or less standard ASCII encoding table:
*the first 32 symbols (0 to 31) are non-printable control characters, so these elements are always complete zero.
*the next 96 symbols (32 to 127) correspond to standard printable ASCII; these elements all have a glyph (including the nont-quite-printable "Delete" character, 127)
*the upper half of the table (128 to 255) is filled with non-standard punctuation and characters other than basic Latin:
**in Western European versions (and in some English versions), there are characters with diacritics (extended Latin)
**in Eastern European versions (e.g., Russian), Cyrillic characters are provided instead of extended Latin


[[image:tsga_a.gif]]
[[image:tsga_a.gif]]
Line 25: Line 31:




A glyph is basically a monochrome bitmap width * height pixels in size. Each pixel is stored in one byte in the [[OBD:TSFT|TSFT]] file (fonts are antialiased so shades of gray are needed rather than storing each pixel in one bit) so each element in the TSFT file contains 4 pixels. Rows of pixels are not 4 bytes aligned so a row can start inside an element.
A glyph is basically a monochrome bitmap width * height pixels in size. Each pixel is stored in one byte in the [[OBD:TSFT|TSFT]] file (fonts are antialiased so shades of gray are needed rather than storing each pixel in one bit; although for the smallest font size there is no antialiasing and the 8-bit pixels are either fully black or fully white).
 
The pixels stored in TSFT (packed 4 by 4 as little-Endian unsigned int32s) are treated as a scanline, row major, top to bottom and left to right. The width of a glyph is not always a multiple of 4 pixels, so the scanline can wrap around, i.e. intermediate rows of a glyph can start in the middle of a 4-byte element. The start of a glyph, however, is always aligned on a 4-byte element of the TSFT array, i.e., the first row of a glyph is necessarily aligned on a 4-byte multiple. The end of a glyph is padded with 0xDEAD.