-
What does this mean? What should I sort? Should I sort I found an article:https://zhuanlan.zhihu.com/p/20100737
Is it related to this? Because if I set this:
Compile without error, but the fonts will not support windows: (Not a valid font file) By the way, in my case, all cmap code_point are < 0xFFFF. I don't understand the essence of the problem right now. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 22 replies
-
Format 4 cmap uses some sort of segmented format, which works best if the glyph order is somewhat sorted by unicode. It will allow to compactly store runs of sequential code points that map to sequential glyph IDs. Unfortunately, there are cases with large cmaps and "unsorted" glyph IDs where this principle apparently degenerates (I'm not even sure of the details) and an overflow occurs. Having more of the glyph order sorted by unicode generally helps. |
Beta Was this translation helpful? Give feedback.
-
Does this patch help? diff --git a/Lib/fontTools/ttLib/tables/_c_m_a_p.py b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
index 6c00aaf63..6ecdf3807 100644
--- a/Lib/fontTools/ttLib/tables/_c_m_a_p.py
+++ b/Lib/fontTools/ttLib/tables/_c_m_a_p.py
@@ -1029,7 +1029,7 @@ class cmap_format_4(CmapSubtable):
header = struct.pack(
cmap_format_4_format,
self.format,
- length,
+ min(length, 0xFFFF),
self.language,
segCountX2,
searchRange, |
Beta Was this translation helpful? Give feedback.
-
In this code:
I think the latter should have plat/enc of 3,10; not 3,1. No? That might be why Windows doesn't accept the font. @justvanrossum |
Beta Was this translation helpful? Give feedback.
-
Neither fonttools decompile nor ots-sanitize like this cmap. Maybe we abort the idea. @justvanrossum can you check my suggestion in #3230 (reply in thread) ? I can send a PR. |
Beta Was this translation helpful? Give feedback.
-
You may be correct there, if I read the cmap recommendations:
|
Beta Was this translation helpful? Give feedback.
Does this patch help?