I have annother one, in order to better understand this I converted only a single char of full NotoSans-Regular.ttf.
And then I went a step further and disected the .xfont files.
ASTC 8x8: 2 bits per pixel
mapped: !singlechar1.txt, Size: 32, ASTC auto, Compression Speed: thorough
" ê™± " - U+A671 - 0xea 0x99 0xb1
Format : COMPRESSED_RGBA_ASTC_8x8_KHR
Compressed : thorough
Layout Width : 64
Layout Height : 5
Pixel Width : 32
Pixel Height : 40
Number of characters in xfont file : 42624
Number of characters in user input file: 1
Success: 1
Fail : 0
NotoSans-Regular_32_ASTC_1.png 32 x 40 - 1 glyph
NotoSans-Regular_32_ASTC_1.glyph 86720 bytes
32*40*2 = 2560 bits -> 320 bytes
86720 / 320 = 271
NotoSans-Regular_32_ASTC_1.xfont:
0 0x0100aaff Signature
4 0x00000b1f Total size of the font block, in bytes: 2847
8 0x000093b7 Bitmap format: COMPRESSED_RGBA_ASTC_8x8_KHR
12 0x0000024a Bitmap swizzle value: 10 0100 1010
16 0x00000040 Font bitmap line stride, in bytes: 64
20 0x00000005 Font bitmap height, in pixels: 5
24 0x00000020 Font screen width, in pixels: 32
28 0x00000028 Font screen height, in pixels: 40
32 0x00800080 Pointer to font graphic data in memory, including flash: address in flash, 4096 (128 * 32)
36 0x0000a680 Total number of characters in font(N), multiple of 128: 42624
40 0x0000b2c0 Offsets to glyph data - N/128 -> 42624 / 128 = 333
...
1348 0x0000b2c0 Offset to glyph data
1352 0x00000000 Offset to glyph data
1356 0x00000000 Offset to glyph data
1360 0x00000000 Offset to glyph data
1364 0x00000000 Offset to glyph data
1368 0x000012c0 Offset to glyph data
1372 0x00000a90 Offsets to width data - - N/128 -> 42624 / 128 = 333
...
2696 0x00000a90 Offset to width data
2700 0x00000a9f Offset to width data
2704 0x00000000 Width data, one byte per character
...
2828 0x00000000 Width data, one byte per character
2832 0x0000001E Width data, one byte per character
2836 0x00000000 Width data, one byte per character
2840 0x00000000 Width data, one byte per character
2844 0x000000 Width data, one byte per character
mapped: !singlechar2.txt, Size: 32, ASTC auto, Compression Speed: thorough
"Ω" - U+03A9 - 0xce 0xa9
Format : COMPRESSED_RGBA_ASTC_8x8_KHR
Compressed : thorough
Layout Width : 64
Layout Height : 3
Pixel Width : 32
Pixel Height : 24
Number of characters in xfont file : 1024
Number of characters in user input file: 1
Success: 1
Fail : 0
NotoSans-Regular_32_ASTC_2.png 32 x 24 - 1 glyph
NotoSans-Regular_32_ASTC_2.glyph 32640 bytes
32*24*2 = 1536 bits -> 192 bytes
32640 / 192 = 170
NotoSans-Regular_32_ASTC_2.xfont:
0 0x0100aaff Signature
4 0x00000b1f Total size of the font block, in bytes: 2847
8 0x000093b7 Bitmap format: COMPRESSED_RGBA_ASTC_8x8_KHR
12 0x0000024a Bitmap swizzle value: 10 0100 1010
16 0x00000040 Font bitmap line stride, in bytes: 64
20 0x00000003 Font bitmap height, in pixels: 3
24 0x00000020 Font screen width, in pixels: 32
28 0x00000018 Font screen height, in pixels: 20
32 0x00800080 Pointer to font graphic data in memory, including flash: address in flash, 4096 (128 * 32)
36 0x00000400 Total number of characters in font(N), multiple of 128: 1024
40 0x00001f70 Offsets to glyph data - N/128 -> 1024 / 128 = 8
...
64 0x00001f70 Offset to glyph data
68 0x00000000 Offset to glyph data
72 0x0000092 Offsets to width data - - N/128 -> 1024 / 128 = 8
...
96 0x0000092 Offset to width data
100 0x0000068 Offset to width data
104 0x00000000 Width data, one byte per character
...
140 0x00000000 Width data, one byte per character
144 0x00001900 Width data, one byte per character
148 0x00000000 Width data, one byte per character
...
268 0x00000000 Width data, one byte per character
272 0x0000 Width data, one byte per character
And to check if the fonts are working I generated a flash image and fed it to ESE:
CLEAR(1, 1, 1)
CMD_SETFONT2(10, 0, 0)
CMD_SETFONT2(11,4096, 0)
CMD_TEXT(95, 213, 10, 0, "ê™±")
CMD_TEXT(140, 222, 11, 0, "Ω")
0 0x26000007 CLEAR(1, 1, 1)
1 0x0500000a BITMAP_HANDLE(10)
2 0x28000000 BITMAP_LAYOUT_H(0, 0)
3 0x07f88005 BITMAP_LAYOUT(GLFORMAT, 64, 5)
4 0x2e0093b7 BITMAP_EXT_FORMAT(COMPRESSED_RGBA_ASTC_8x8_KHR)
5 0x2f00024a BITMAP_SWIZZLE(ONE, ONE, ONE, RED)
6 0x29000000 BITMAP_SIZE_H(0, 0)
7 0x08004028 BITMAP_SIZE(NEAREST, BORDER, BORDER, 32, 40)
8 0x0500000b BITMAP_HANDLE(11)
9 0x28000000 BITMAP_LAYOUT_H(0, 0)
10 0x07f88003 BITMAP_LAYOUT(GLFORMAT, 64, 3)
11 0x2e0093b7 BITMAP_EXT_FORMAT(COMPRESSED_RGBA_ASTC_8x8_KHR)
12 0x2f00024a BITMAP_SWIZZLE(ONE, ONE, ONE, RED)
13 0x29000000 BITMAP_SIZE_H(0, 0)
14 0x08004018 BITMAP_SIZE(NEAREST, BORDER, BORDER, 32, 24)
15 0x22000000 SAVE_CONTEXT()
16 0x27000002 VERTEX_FORMAT(2)
17 0x06000000 CELL(0)
18 0x0500000a BITMAP_HANDLE(10)
19 0x1f000001 BEGIN(BITMAPS)
20 0x01800580 BITMAP_SOURCE(0x800000 | 1408)
21 0x40be0354 VERTEX2F(380, 852)
22 0x23000000 RESTORE_CONTEXT()
23 0x22000000 SAVE_CONTEXT()
24 0x27000002 VERTEX_FORMAT(2)
25 0x06000000 CELL(0)
26 0x0500000b BITMAP_HANDLE(11)
27 0x1f000001 BEGIN(BITMAPS)
28 0x01800c66 BITMAP_SOURCE(0x800000 | 3174)
29 0x41180378 VERTEX2F(560, 888)
30 0x23000000 RESTORE_CONTEXT()
Okay, there is a correlation between the number of chars in the .xfont file and the Unicode number of the char.
U+A671 -> 42609 -> 42609 / 128 = 332,8 -> 333 blocks of 128 needed
U+03A9 -> 937 -> 937 / 128 = 7,3 -> 8 blocks of 128 needed
So the higher the number the last char in the set is, the longer the .xfont file gets.
But how do we get to the glyph?
a671
1010 0110 0111 0001
101001100 1110001 -> block number 332, glyph number 113th ?
glyph offsets:
0-327: 0x0000b2c0
328-331: 0x00000000
332: 0x000012c0
And now I am lost.
This directly addresses the glyph:
17 0x06000000 CELL(0)
20 0x01800580 BITMAP_SOURCE(0x800000 | 1408)
The "1408" is in units of 32 bytes.
This works fine as well:
CMD_SETBITMAP(0x800000 | 1408, COMPRESSED_RGBA_ASTC_8x8_KHR, 32, 40)
VERTEX2F(1600, 100)
But how does the glyph-offset in the .xfont file lead to this address?
Regarding the sizes, it looks like there are actually three images in this .glyph file?
And the one that contains the actual glyph needs to be larger than the glyph itself since
its absolute address is calculated somehow from the lower 7 bits of its Unicode number?
That explains the size of the .glyph file, unclear math or not, the .xfont only has information about blocks
of 128 glyphs and calculates the absolute address of a glyph from the offset-address of the block, the lower 7 bits of the Unicode number and probably the character widths.
This means the .glyph file itself has to be bigger than the glyph to allow for that structure.
So adding more glyphs to a group that already is present does not make the .glyph bigger?
mapped: !CharMap2.txt, Size: 32, ASTC auto, Compression Speed: thorough
" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ £°±²³µ¼½¾ÄÖ×Üßäöü"
Format : COMPRESSED_RGBA_ASTC_8x8_KHR
Compressed : thorough
Layout Width : 96
Layout Height : 6
Pixel Width : 48
Pixel Height : 48
Number of characters in xfont file : 256
Number of characters in user input file: 113
Success: 113
Fail : 0
NotoSans-Regular_32_ASTC.png 48 x 5424 - 113 glyphs
NotoSans-Regular_32_ASTC.glyph 145472 bytes
48*48*2 = 4608 bits -> 576 bytes
145472 / 576 = 252,5
That theory seems to be holding some water as the size of the .glyph is exactly the same as with the !Charmap.txt file from my earlier post that has ten glyphs less.
So the glyphs for the not existing codepoints are of the same width and height but empty?
The .xfont file also has the same size, the extra ten glyphs probably had no impact on the width data.
That leaves the potential issue that empty pages seem to take up quite some space in the .glyph file as well.
Oh yes, and that "Full Unicode Characters" does not convert the glyphs that are contained in the font but
generates a file with 65535 glyphs is odd as well.
In any case, working with a charmap-file works a lot better than stripping unicode-ranges from a given font and doing a full-convert on that stripped font.
And it is a lot faster.