Generated 'cmap' format 12.0/13.0 subtable lost the first map entry
See original GitHub issueI tried generating a font with this snippet for the cmap table:
def generateCmapTable():
cmap = table__c_m_a_p('cmap')
cmap.tableVersion = 0
cmapSubtable = CmapSubtable.newSubtable(12)
cmapSubtable.format = 12
cmapSubtable.reserved = 0
cmapSubtable.platformID = 0
cmapSubtable.platEncID = 4
cmapSubtable.language = 0
cmapSubtable.cmap = {0x1F44C: 'u1F44C', 0x1F44D: 'u1F44D'}
cmap.tables = [cmapSubtable]
cmapSubtable.length = 0
cmapSubtable.nGroups = 0
return cmap
The only
And with the generated .ttf
, I use ftxdumperfuser --table cmap --auto-dump test.ttf
to dump the cmap
table, and inside it I found only one entries of 0x1F44D
, the 0x1F44C
one is missing. I tested other codepoint as well, basically in all combinations, the first map entry is missing.
I also used FTXViewer
to lookup table content from the font directly, and observed the same thing. And the codepoint that is missing from the cmap
table also cannot be shown when you use the font.
<ft:FTFontTable_cmap xmlns:ft="http://developer.apple.com/fonts/" versionMajor="1" versionMinor="0">
<ft:cmapSubtable encodingID="0"
format="12"
platformID = "0" platformName="Unicode" scriptID="4" scriptName="3.1 or later (surrogates)" languageID="-1" >
<ft:map charValue="0x1F44D" glyphRefID="1"/>
</ft:cmapSubtable>
</ft:FTFontTable_cmap>
However, the test._c_m_a_p.ttx
file I generated by using ttx -s test.font
can output all map entries correctly.
<?xml version="1.0" encoding="UTF-8"?>
<ttFont ttLibVersion="3.0">
<cmap>
<tableVersion version="0"/>
<cmap_format_12 platformID="0" platEncID="4" format="12" reserved="0" length="28" language="0" nGroups="1">
<map code="0x1f44c" name="u1F44C"/><!-- ???? -->
<map code="0x1f44d" name="u1F44D"/><!-- ???? -->
</cmap_format_12>
</cmap>
</ttFont>
Here is the test font I generated: Test 64.ttf.zip
I also tested format 13.0
, get the same results. I’m not sure if it’s an issue on FontToolbox.framework
and Apple Font Tool Suite
, or an issue from fonttools
😢
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
I guess nothing to be done here.
Yes. It is implied in OpenType that glyph0 is notdef. Some of the cmap subtables explicitly use this property; ie. they encode a gid=0 when a character is not covered. My change simply uniformly applied that to all subtables. I’m not 100% happy about it, but happy enough to let it be the way it is now.