opentype.js
opentype.js copied to clipboard
Possible Issue in `parse.mjs::getFixed()`
The function getFixed which deals with Fixed-Point representation (16.16) is implemented as follows:
function getFixed(dataView, offset) {
const decimal = dataView.getInt16(offset, false);
const fraction = dataView.getUint16(offset + 2, false);
return decimal + fraction / 65535; // ⚠ Are you sure of that divider?
}
I can't figure out why the low uint16 part (fraction) is divided by 65535 (0xFFFF) rather than 65536 (0x10000). This means that the Fixed-Point 0000.FFFF will be converted to 1 (!) while it should be 0.9999847412109375 (i.e. 65535/65536) according to this conversion tool.
Do I miss something obvious? (Sorry if I'm wrong and thanks in advance for any clarification.)