question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issue with Unicode code points above 16bit max 65536

See original GitHub issue

Expected 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)

  1. Get a copy of the Stix font from http://www.stixfonts.org/
  2. Load the font with opentype.js
  3. use the download method to output font back out.
  4. 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:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
halmoscommented, Dec 4, 2017

@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.

0reactions
Jolg42commented, Dec 22, 2017

Fixed by #315

Read more comments on GitHub >

github_iconTop Results From Across the Web

UTF-16 - Wikipedia
UTF-16 (16-bit Unicode Transformation Format) is a character encoding capable of encoding all 1,112,064 valid code points of Unicode The encoding is ...
Read more >
Why does utf-16 only support 2^20 code points?
Unicode 1.1 aligned to UCS (so we have Unicode v1.0 names, and then stable Unicode names), but keeping with 16-bit size), and later...
Read more >
Surrogate pairs and variation selectors - Globalization
With the Unicode 16-bit encoding system, over 65,000 characters can be encoded (2 16 = 65,536). However, the total number of characters that ......
Read more >
Char() function returns incorrect results - Claris Community
The code points 55296 (0xD800) and 56385 (0xDC41) are Surrogates (U+D800 through U+DFFF). They do not represent any Unicode character if used ...
Read more >
Max. bytes in a UTF-8 char? - Stijn de Witt
[…] stored in a single byte. The code points 128 and above are stored using 2, 3, in fact, up to 4 bytes....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found