Issue with Unicode code points above 16bit max 65536
See original GitHub issueExpected Behavior
When testing download of Microsoft Stix font, the resulting file is not validated by OTS-Sanitize and produces errors in the browser. The resulting font should load normally.
Current Behavior
Both OTS-Sanitize and chrome report : OTS parsing error: cmap: Out of order end range (54272 <= 65533)
.
It seems that the CMAP table creation function may have a problem with code points above 16bits / 65536. I’m not certain, but glyphs with unicode values over 65536 seem to be bit shifted to drop their first bit. For example, in the error above code point 54272 is listed as glyph id 2297 in the opentype.js web font inspector. However the correct code point is 119808. If you remove the first bit of 119808 it becomes 54272. I haven’t been able to parse the table creation functions completely enough to understand how they are working, but I suspect their may be an issue with bitshifting 32 bit numbers, possibly something to do with the sign.
Steps to Reproduce (for bugs)
- Get a copy of the Stix font from http://www.stixfonts.org/
- Load the font with opentype.js
- use the download method to output font back out.
- try to load font in browers or test with OTS-sanitize.
Your Environment
- Version used: 0.7.3
- Font used: Stix
- Browser Name and version: chrome 62.0.3202.94
- Operating System and version (desktop or mobile): OS X 10.11.6
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@Jolg42 - I’ve tested your format 12 implementation with the Stix font. It passes OTS-sanitize and loads in the browser with no problem. From my POV the pull request looks great. Great work! and thank you.
Fixed by #315