Thread: Font in LineAge
View Single Post
Old 21.10.2006, 02:53   #60
ANRDaemon
Архивный участник
 
Join Date: Feb 2006
Posts: 158
Default

Hmmm..
Glyph file structure really simple, but slightly different from Aysen's description.
I'll try to describe it in comparison.
First look here.
Quote:
Originally Posted by reijii View Post
In it gly all is estimated in dwords. First two words - width and height of a texture with fonts. It's not very importlant values.
The "structure" begins with 4 dword. Such "structures" in such file can be a several. And so the third dword is a quantity of such "structures".
Each such structure describes consistently certain symbols (width height and position on a structure). The first dword in it is about a code of a symbol with which the description begin, the second dword - quantity of described symbols in this structure.
Then the description of symbols in such order (all in dwords) begins:
X-?oordinate position of a symbol on texture
width of a symbol
Y-?oordinate position of a symbol on texture
height of a symbol.
Example. If you need to describe numerals.
1st dword - texture width.
2nd dword - texture height.
3d dword - quantity of "structures" (in that example only one).
4th dword - begining from "0", 0x39 there.
5th dword - In total 10 figures, 0x0A there.
-- Describe "0" --
6th dword - position the image of zero on a texture on x-coordinate (if this coordinate is equal 0 write in dword 0xFFFFFFFF don't 0)
7th dword - zero image width on texture.
8th dword - position the image of zero on a texture on y-coordinate
9th dword - zero image height on texture.
Further describing other figures are in the same way.
In the end shit is written:
in smallfont-e.gly i wrote 0, 1, 4, 0x3BA6B24E, 0
in largefont-e.gly: 0, 1, 4, 0x765608F7, 0

(c)Ayzen (i post his patches upper)
Really... Look.. In a better tradition of MySQL documentation, here is an overview of file structure:
.gly file: HEADER CHARSET [, CHARSET [...] ]
CHARSET: FIRST_CHARACTER CHARACTERS_COUNT GLYPH [, GLYPH [...]]

12 bytes of glyph HEADER starts from beginning:
0x00: 4 bytes texture width (1024 = 0x00000400)
0x04: 4 bytes texture height (128 = 0x00000080)
0x08: 4 bytes charsets count (1 for LargeFont-e, 2 or more to describe national character sets: first set for ASCII characters, and 2..n for UNICODE symbols)

That's all for header. Next, we have only "count" of "character sets".
Each character set starts immediately after end of previous block.
Let's take a look in CHARSET structure. It also begins with 8 bytes header:
+0x00: 4 bytes FIRST_CHARACTER code (i.e. 0x0020 for Space character, 0x0410 for Cyrillic Capital Letter A, etc.)
+0x04: 4 bytes CHARACTERS_COUNT (96 for printable ASCII set (95 used in LargeFont-e), 64 (32*2) for restricted cyrillic set)
Charset header follows with array of GLYPH descriptions.

Each 16 bytes GLYPH descriptor contains:
+0x00: 4 bytes x coorginate (0xFFFFFFFF to indicate zeroes!)
+0x04: 4 bytes glyph width
+0x08: 4 bytes y coordinate (0xFFFFFFFF to indicate zeroes!)
+0x0C: 4 bytes glyph height

File ends with some "tail". His structure unknown, but dummy copy+paste from other glyph works well for me.

Quote:
Originally Posted by ANRDaemon View Post
Anyone know how to make a linebreak characters?
In some glyfs I have line wrapped at the each character, in some - at the space character only...
It depends only from NWindow.dll version, I think now.
ANRDaemon is offline