Skip to content

ValueError: cmap format 4 subtable overflowed; sort glyph order by unicode to fix. #3230

Answered by behdad
TakWolf asked this question in Q&A
Discussion options

You must be logged in to vote

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,

Replies: 5 comments 22 replies

Comment options

You must be logged in to vote
2 replies
@justvanrossum
Comment options

@TakWolf
Comment options

Comment options

You must be logged in to vote
4 replies
@TakWolf
Comment options

@behdad
Comment options

@justvanrossum
Comment options

@behdad
Comment options

Answer selected by TakWolf
Comment options

You must be logged in to vote
12 replies
@TakWolf
Comment options

@behdad
Comment options

@TakWolf
Comment options

@behdad
Comment options

@behdad
Comment options

Comment options

You must be logged in to vote
4 replies
@TakWolf
Comment options

@justvanrossum
Comment options

@TakWolf
Comment options

@justvanrossum
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants