question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[subset] Subr subsetting fails on some CID-keyed CFF

See original GitHub issue

Recently an issue with --no-hinting was fixed in #709, but I’m getting another error when subsetting a CID-keyed CFF:

$ pyftsubset OurAwesomeUnreleasedFont.otf --no-hinting --text="情"
Traceback (most recent call last):
  File "/Users/mnakamura/.pyenv/versions/fonttools-2.7.13/bin/pyftsubset", line 11, in <module>
    load_entry_point('fonttools', 'console_scripts', 'pyftsubset')()
  File "/Users/mnakamura/.ghq/github.com/mashabow/fonttools/Lib/fontTools/misc/loggingTools.py", line 372, in wrapper
    return func(*args, **kwds)
  File "/Users/mnakamura/.ghq/github.com/mashabow/fonttools/Lib/fontTools/subset/__init__.py", line 2975, in main
    subsetter.subset(font)
  File "/Users/mnakamura/.ghq/github.com/mashabow/fonttools/Lib/fontTools/subset/__init__.py", line 2789, in subset
    self._prune_post_subset(font)
  File "/Users/mnakamura/.ghq/github.com/mashabow/fonttools/Lib/fontTools/subset/__init__.py", line 2772, in _prune_post_subset
    retain = table.prune_post_subset(self.options)
  File "/Users/mnakamura/.ghq/github.com/mashabow/fonttools/Lib/fontTools/subset/__init__.py", line 2281, in prune_post_subset
    subr.subset_subroutines (local_subrs, font.GlobalSubrs)
  File "/Users/mnakamura/.ghq/github.com/mashabow/fonttools/Lib/fontTools/subset/__init__.py", line 1917, in subset_subroutines
    p[i-1] = subrs._used.index(p[i-1] + subrs._old_bias) - subrs._new_bias
AttributeError: 'list' object has no attribute '_used'

According to Lib/fontTools/subset/__init__.py#L2266-L2281, when processing the GlobalSubrs, the value of local_subrs is always [] even if there are actually some local subrs. This seems to cause the error in subr.subset_subroutines().

Note that this font hasn’t been released yet, so unfortunately we cannot provide samples for now.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
miguelsousacommented, Mar 2, 2017

Team work \o/

1reaction
behdadcommented, Mar 2, 2017

But if any of the global subroutines in turn contains a callsubr command, the call to subr.subset_subroutines method fails because it expects that these local_surbs have _used attribute, which of course they can’t have.

Ah, you just successfully debugged https://github.com/fonttools/fonttools/issues/656 ! Thank you!!! Let me think about this a bit.

Read more comments on GitHub >

github_iconTop Results From Across the Web

NEWS.rst - third_party/fonttools - Git at Google
[feaLib] Have ``fontTools feaLib`` script exit with error code when build fails (#2459) ... [subset] Speed up subsetting of large CFF fonts (#2467)....
Read more >
fonttools [python-library] - Occam :: Details
[merge] Support merging CFF tables (CID-keyed CFF is still not supported) (#2447). ... [subset] Fix subsetting COLRv1 clip boxes when font is loaded...
Read more >
fonttools - Python Package Health Analysis - Snyk
[subset] Speed up subsetting of large CFF fonts (#2467). ... Keep advance widths when stripping ".notdef" glyph outline in CID-keyed CFF fonts (#845) ......
Read more >
History of Ghostscript versions 6.n - UnixWare 7 Documentation
(ziodevsc.c [1.2]: 2001/03/27 09:37:10 ghostgum) - Avoid rangecheck error when character code exceeds 255. Support zero-size bitmap used by some fonts for ...
Read more >
https://jira.reactos.org/secure/attachment/21159/f...
+ + Some large packages using FreeType have to use a broken (deficient) + ... + + * src/cff/cffobjs.c (remove_subset_prefix): Update length after...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found