cmap 4 idDelta is a signed short
See original GitHub issueI just got sent a font file which fails MS fontval validation due to problems with the cmap table. It’s a CJK font and has lots of glyphs scattered around lots of codepoints. Debugging this, I noticed one immediate problem:
int16 | idDelta[segCount] | Delta for all character codes in segment.
https://docs.python.org/3/library/struct.html:
Format | C Type | Python type | Standard size | Notes |
---|---|---|---|---|
h | short | integer | 2 | (2) |
H | unsigned short | integer | 2 | (2) |
That should be “h”, right?
Issue Analytics
- State:
- Created a year ago
- Comments:13 (3 by maintainers)
Top Results From Across the Web
How to correctly understand TrueType cmap's subtable ...
Can idDelta and idRangeOffset both be non zero in TrueType fonts? 1 · character encoding for TrueType format 0 cmap tables? 1 ·...
Read more >fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable ...
See the License for the specific language governing permissions and ... void initSubtable(CmapTable cmap, int numGlyphs, TTFDataStream data) throws ...
Read more >cmap - Character To Glyph Index Mapping Table ...
Each segment is described by a startCode and endCode, along with an idDelta and an idRangeOffset, which are used for mapping the character...
Read more >fonttools/_c_m_a_p.py at main
first determine the subtable format (if in doubt use format 4 for glyphs within ... idDelta is a short, and must be between...
Read more >Implementing a Font Reader and Rasterizer from Scratch, ...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15. typedef unsigned char u8; typedef char i8; typedef...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Correct - I tried that.
The Apple specification lists it as
UInt16
, so MS seems to have changed this.https://docs.microsoft.com/en-us/typography/opentype/spec/cmap
Both specs say “The idDelta arithmetic is modulo 65536”. Not sure how this affects the issue.