table 'cmap' precedes table 'name'
george_thompson
Posts: 32
I have a font that gets this error message in Font Validator: "table 'cmap' precedes table 'name'", but the ttx dump shows 'name' coming before 'cmap.' What am I missing?
George
George
0
Comments
-
I think the error message is a statement of how things should be, not of how they are in the file. In the table directory, the entry for 'cmap' should precede the entry for 'name'.
0 -
Tried that, didn't work and screwed up encoding. Is there a master list for the order?0
-
So there are a couple of different things to bear in mind with regard to table order in sfnt (TT and OT) fonts. One is the actual order in which the tables are stored in the binary, and the other is the order in which the tables are recorded in the Table Directory in the font header. The latter is a case-sensitive alphabetical sort (so Apple all-caps tables precede Microsoft and other all-lowercase tables) with offset and length records for each table. But the actual order in which the tables are stored in the binary is technically arbitrary but there are processing benefits to storing at least some of the table before others. Microsoft used to make available a command line tool called fastfont that sorted the tables in the optimum order for processing, and using this tool supressed the kind of FontValidator warning (not error) you report. With the speed of today’s CPUs, I expect this kind of optimised table order, like many other processing speed optimisations, is moot.2
-
When FontTools saves a font, tables are reordered by default: https://github.com/fonttools/fonttools/blob/69fc06a1af6a3108b6983b8bf96935327b873916/Lib/fontTools/ttLib/ttFont.py#L159
Maybe if you rebuild the font with TTX it will reorder the tables too, but I can't find traces in the code and have nothing to test it.1 -
Thanks all for the help. Now I can quit worrying and go back to my regular life.0
-
Cesare G. said:When FontTools saves a font, tables are reordered by default: https://github.com/fonttools/fonttools/blob/69fc06a1af6a3108b6983b8bf96935327b873916/Lib/fontTools/ttLib/ttFont.py#L1590
-
Thomas Phinney said:Cesare G. said:When FontTools saves a font, tables are reordered by default: https://github.com/fonttools/fonttools/blob/69fc06a1af6a3108b6983b8bf96935327b873916/Lib/fontTools/ttLib/ttFont.py#L159
def reorderFontTables(inFile, outFile, tableOrder=None, checkChecksums=False): """Rewrite a font file, ordering the tables as recommended by the OpenType specification 1.4. """ inFile.seek(0) outFile.seek(0) reader = SFNTReader(inFile, checkChecksums=checkChecksums) writer = SFNTWriter(outFile, len(reader.tables), reader.sfntVersion, reader.flavor, reader.flavorData) tables = list(reader.keys()) for tag in sortedTagList(tables, tableOrder): writer[tag] = reader[tag] writer.close()
0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 799 Font Technology
- 1K Technique and Theory
- 617 Type Business
- 444 Type Design Critiques
- 541 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 483 Typography
- 301 History of Typography
- 114 Education
- 68 Resources
- 498 Announcements
- 79 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 269 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports