MicrosoftDocs / typography-issues

Creative Commons Attribution 4.0 International
45 stars 21 forks source link

Suggestions for the data type Fixed and head.fontRevision in the doc #930

Closed LIXiangChen closed 2 years ago

LIXiangChen commented 2 years ago

About the data type: Fixed, I found some people confused with how to get it.

In the process of calculating it, Int32 is incorrectly divided by 0xffff instead of 0x10000 in some code (e.g. [1]).

So I suggest providing a tip in the doc, like this:

// how to get data type: Fixed

var fixed = data.getInt32(offset) / 0x10000;

// note: need to divide by 0x10000 (65536), not 0xffff (65535)

And there is another thing: Adobe's doc mentions that head.fontRevision should have three significant decimals [2], but Microsoft's doc doesn't say it. I think this should be made clear in the spec.

[1] https://github.com/opentypejs/opentype.js/blob/88f7c1755ceec3326cdac4de53bc5ec89d38a615/src/parse.js#L33 [2] https://github.com/adobe-type-tools/afdko/blob/develop/docs/OpenTypeFeatureFileSpecification.md#9.c

PeterCon commented 2 years ago

The "three significant decimals" is referring to Adobe's AFDKO representations, not to OpenType.

As for the other suggestion, it's out of scope to provide guidance to developers as to how to process font data using their programming language of choice.

devosb commented 2 years ago

I am confused by both posts. @LIXiangChen says "but Microsoft's doc doesn't say it" I thought Microsoft does state this as a recommendation, at least since version 1.4.

PeterCon commented 2 years ago

Ah, good catch @devosb. But still no change needed.