OBD:TSGA: Difference between revisions

215 bytes added ,  7 December 2023
m
changed family
mNo edit summary
m (changed family)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{OBD_File_Header | type=TSGA | prev=TSFT | next=TStr | name=Glyph Array | family=Global | align=center}}
{{OBD_File_Header | type=TSGA | prev=TSFT | next=TStr | name=Glyph Array | family=Interface | align=center}}




Every TSGA file contains 256 elements of 20 bytes each, thus taking up 5,120 bytes without the header. Together with the 8-byte header and 32-byte padding, each TSGA takes up 5,152 bytes in a .dat (another 20 bytes are taken up in the instance descriptor array).
Every TSGA file contains 256 elements of 20 bytes each, thus taking up 5,120 bytes without the header. Together with the 8-byte header and 32-byte padding, each TSGA takes up 5,152 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 an ASCII-based [[wp:code page|code page]]:
For Western languages, a TSFT has only one TSGA which corresponds to an ASCII-based [[wp:Code page|code page]]:
*the first 32 symbols (0 to 31) are non-printable control characters, so these elements are always all zero;
*the first 32 symbols (0 to 31) are non-printable control characters, so these elements are always all zero;
*the next 96 symbols (32 to 127) correspond to standard US-ASCII (except that 127 is usually non-printable);
*the next 96 symbols (32 to 127) correspond to standard US-ASCII (except that 127 is usually non-printable);
Line 16: Line 16:


----
----
[[image:tsga_a.gif]]
[[Image:tsga_a.gif]]




Line 36: Line 36:




A glyph is basically a grayscale bitmap which is (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 in use and the 8-bit pixels are either fully black or fully white).
A glyph is basically a grayscale bitmap which is (width * height) pixels in size. The [[OBD:TSFT|TSFT]] file stores each pixel as a byte, with 256 degrees of brightness/opacity, which in theory allows for rather subtle antialiasing. In practice, for the smallest font size there is no antialiasing at all (the 8-bit pixels are either fully black or fully white, and are suitable for 1-bit storage), and larger font sizes actually use only 17 degrees of brightness/opacity - from 0xFF to 0x0F, and then 0x00 - which the engine further posterizes to proper 4-bit when rendering.


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. a new row of pixels 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. The end of a glyph is padded with 0xDEAD.
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., a new row of pixels 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. The end of a glyph is padded with 0xDEAD.




Line 53: Line 53:




{{OBD_File_Footer | type=TSGA | prev=TSFT | next=TStr | name=Glyph Array | family=Global}}
{{OBD_File_Footer | type=TSGA | prev=TSFT | next=TStr | name=Glyph Array | family=Interface}}


{{OBD}}
{{OBD}}