Skip to content

Fonttools unable to read Noto CJK TTC files #541

@roozbehp

Description

@roozbehp

It seems that ToT fonttools cannot read ToT noto-cjk TTC files.

Here's what I run and what I get:

$ PYTHONPATH=$HOME/src/fonttools/Lib python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from fontTools import ttLib
>>> ttLib.TTFont('NotoSansSC-Regular.otf')
<fontTools.ttLib.TTFont object at 0x7f06c16a1790>
>>> ttLib.TTFont('NotoSansCJK-Regular.ttc')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/ttLib/__init__.py", line 180, in __init__
    self.reader = sfnt.SFNTReader(file, checkChecksums, fontNumber=fontNumber)
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/ttLib/sfnt.py", line 62, in __init__
    raise ttLib.TTLibError("specify a font number between 0 and %d (inclusive)" % (self.numFonts - 1))
fontTools.ttLib.TTLibError: specify a font number between 0 and 7 (inclusive)
>>> ttLib.TTFont('NotoSansCJK-Regular.ttc', 0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/ttLib/__init__.py", line 180, in __init__
    self.reader = sfnt.SFNTReader(file, checkChecksums, fontNumber=fontNumber)
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/ttLib/sfnt.py", line 62, in __init__
    raise ttLib.TTLibError("specify a font number between 0 and %d (inclusive)" % (self.numFonts - 1))
fontTools.ttLib.TTLibError: specify a font number between 0 and 7 (inclusive)
>>> ttLib.TTFont('NotoSansCJK-Regular.ttc', 2)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/ttLib/__init__.py", line 164, in __init__
    file = macUtils.SFNTResourceReader(file, res_name_or_index)
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/ttLib/macUtils.py", line 42, in __init__
    reader = ResourceReader(path)
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/misc/macRes.py", line 32, in __init__
    self._readFile()
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/misc/macRes.py", line 52, in _readFile
    self._readTypeList()
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/misc/macRes.py", line 93, in _readTypeList
    resources = self._readReferenceList(resType, refListOffset, numRes)
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/misc/macRes.py", line 102, in _readReferenceList
    res.decompile(refData, self)
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/misc/macRes.py", line 186, in decompile
    dataLength, = struct.unpack(">L", reader._read(4, absDataOffset))
  File "/usr/local/google/home/roozbeh/src/fonttools/Lib/fontTools/misc/macRes.py", line 67, in _read
    raise ResourceError('Cannot read resource (not enough data)')
fontTools.misc.macRes.ResourceError: Cannot read resource (not enough data)
>>>

fonttools version: 87d1388
noto-cjk version: notofonts/noto-cjk@f36eda0
/cc @dougfelt @kenlunde

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions