Fonttools: Double-byte Unicodes?

Created on 17 Jul 2018  Â·  8Comments  Â·  Source: fonttools/fonttools

Hi –

It looks like TTX can't handle double-byte Unicodes. I dumped a TTF, edited a few Unicodes, and then when going back to TTF, I won this error:

Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/fontTools/ttx.py", line 398, in main process(jobs, options) File "/usr/local/lib/python3.6/site-packages/fontTools/ttx.py", line 372, in process action(input, output, options) File "/usr/local/lib/python3.6/site-packages/fontTools/misc/loggingTools.py", line 372, in wrapper return func(*args, **kwds) File "/usr/local/lib/python3.6/site-packages/fontTools/ttx.py", line 290, in ttCompile ttf.save(output) File "/usr/local/lib/python3.6/site-packages/fontTools/ttLib/ttFont.py", line 172, in save writer_reordersTables = self._save(tmp) File "/usr/local/lib/python3.6/site-packages/fontTools/ttLib/ttFont.py", line 211, in _save self._writeTable(tag, writer, done, tableCache) File "/usr/local/lib/python3.6/site-packages/fontTools/ttLib/ttFont.py", line 632, in _writeTable tabledata = self.getTableData(tag) File "/usr/local/lib/python3.6/site-packages/fontTools/ttLib/ttFont.py", line 650, in getTableData return self.tables[tag].compile(self) File "/usr/local/lib/python3.6/site-packages/fontTools/ttLib/tables/_c_m_a_p.py", line 118, in compile chunk = table.compile(ttFont) File "/usr/local/lib/python3.6/site-packages/fontTools/ttLib/tables/_c_m_a_p.py", line 829, in compile charCodeArray = array.array("H", endCode + [0] + startCode) OverflowError: unsigned short is greater than maximum

All 8 comments

You probably need to change the cmap subtable as well, since characters beyond basic multilingual plane can’t be represented by older subtables, see cmap documentation.

Correct

The only place to change encoding in this font is in the cmap, and I changed both (0,3,0 and 3,1,0), and it's the only thing I changed, so I dunno where else you think I could've changed it.

You need a cmap subtable format that supports characters beyond the BMP, like format 12

Oh, duh. Sorry! Thanks.

No problem!

Isn't this only supported in the format 12 subtable?

On Tue, Jul 17, 2018, 1:51 PM Micah Stupak notifications@github.com wrote:

The only place to change encoding in this font is in the cmap, and I
changed both (0,3,0 and 3,1,0), and it's the only thing I changed, so I
dunno where else you think I could've changed it.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/fonttools/fonttools/issues/1295#issuecomment-405669270,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABQVmKujrkxQC7XM6wHhu3Q9P01rdF5Eks5uHiQKgaJpZM4VTJGb
.

Could there be a more informative error message?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jenskutilek picture jenskutilek  Â·  7Comments

madig picture madig  Â·  10Comments

behdad picture behdad  Â·  5Comments

KatjaSchimmel picture KatjaSchimmel  Â·  5Comments

justvanrossum picture justvanrossum  Â·  3Comments