のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

truetype fixed 16.16

Data type Description
shortFrac 16-bit signed fraction
Fixed 16.16-bit signed fixed-point number
F2Dot14 16-bit signed fixed number with the low 14 bits representing fraction.
F2Dot14
1.999 0x7FFF 32767
-2.0 0x8000 -32768
1.0 0x4000 16384
-1.0 0xC000 -16384

The TrueType Font File

2^14 = 2^4 *2^10 = 16*1024 = 16384

1/16384 = 0.00006103515625
16383/16384 = 0.99993896484375
0.000061 * 16384 = 0.999424
0.999939 *16384= 16383.000576
Decimal Value Hex Value Integer Fraction
1.999939 0x7fff 1 16383/16384
1.75 0x7000 1 12288/16384
0.000061 0x0001 0 1/16384
0.0 0x0000 0 0/16384
-0.000061 0xffff -1 16383/16384
-2.0 0x8000 -2 0/16384
0b01
0b00
0b11
0b10
1.999939 0x7fff 1+ 16383/16384 = 16384/16384 + 16383/16384 = 32767/16384
= =
0.000000 0x0000 0+ 00000/16384 = 00000/16384 + 00000/16384 = 00000/16384
-0.000061 0xffff -1+ 16383/16384 = -16384/16384 + 16383/16384 = -00001/16384
-0.000122 0xfffe -1+ 16382/16384 = -16384/16384 + 16382/16384 = -00002/16384
-0.000183 0xfffd -1+ 16381/16384 = -16384/16384 + 16381/16384 = -00003/16384
-0.000244 0xfffc -1+ 16380/16384 = -16384/16384 + 16380/16384 = -00004/16384
= =
-0.999939 0xc001 -1 + 00001/16384 = -16384/16384 + 00001/16384 = -16383/16384
-1.000061 0xc000 -1 + 00000/16384 = -16384/16384 + 00000/16384 = -16384/16384
0xbfff -2 + 16384/16384 = -32768/16384 + 16384/16384= -16385/16384
0xbffe -2 + 16384/16384 = -32768/16384 + 16383/16384= -16386/16384
0xbffd -2 + 16384/16384 = -32768/16384 + 16382/16384= -16387/16384
0xbffc -2 + 16384/16384 = -32768/16384 + 16381/16384= -16388/16384
0xbffb -2 + 16384/16384 = -32768/16384 + 16380/16384= -16389/16384
= =
-1.999939 0x8001 -2 + 00001/16384 = -32768/16384 + 00001/16384 = -32767/16384
-2.0 0x8000 -2 + 00000/16384 = -32768/16384 + 00000/16384 = -32768/16384


docs.microsoft.com

stackoverflow.com