opentype.js
opentype.js copied to clipboard
Should use sfntVersion to pick glyph outlines
OpenType.js should look at the sfntVersion field in the sfnt offset table to determine whether to use PostScript or TrueType outlines.
Expected Behavior
In the Unicode test suite for text rendering engines, test case SFNT-1 should pass.
Current Behavior
Test case SFNT-1 is failing.
Possible Solution
If a font contains both CFF and glyf tables, look at the sfntVersion field in the sfnt offset table to decide which one to use.
Steps to Reproduce (for bugs)
- On the OpenType.js site, load test font TestSFNTOne.otf and enter
ABas string to display. - Expected to see
CFFunderneathAandB; instead got this:

I'm pretty sure that the test in question made the wrong assumption about what should happen in this particular case. Looking at the OpenType definition for sfntVersion, we see this clarification:
OpenType fonts that contain TrueType outlines should use the value of 0x00010000 for the sfntVersion. OpenType fonts containing CFF data (version 1 or 2) should use 0x4F54544F ('OTTO', when re-interpreted as a Tag) for sfntVersion.
Rather than saying "which data to use based on the version", the only prescription here is for "which version to use, based on the data".
At best we can only conclude that, because the sfntVersion field cannot be two values at once, whatever software generated this font did so incorrectly, giving us a font that is inconsistent with respect to the spec, and so should not even be accepted as a valid font (and someone needs to fix it).
I’ve asked the community (at [email protected]) whether or not they’d like to have the test case, cc’ing you. Let’s discuss there. Personally I have no opinions here; it seems like a rather theoretical problem anyway.
Was this ever resolved? Should we look at this or not?
@brawer seeing you were recently active - any update on this?