Distinction between hintmask bits and an operator in charstring
See original GitHub issueWhile subsetting I got an error raised in op_or()
, although this font has no or
operators, of course.
$ pyftsubset font.otf --text=島 --no-hinting
Traceback (most recent call last):
File "/Users/mnakamura/.pyenv/versions/subset-2.7.13/bin/pyftsubset", line 11, in <module>
load_entry_point('fonttools', 'console_scripts', 'pyftsubset')()
File "/Users/mnakamura/.ghq/github.com/fonttools/fonttools/Lib/fontTools/misc/loggingTools.py", line 372, in wrapper
return func(*args, **kwds)
File "/Users/mnakamura/.ghq/github.com/fonttools/fonttools/Lib/fontTools/subset/__init__.py", line 2971, in main
subsetter.subset(font)
File "/Users/mnakamura/.ghq/github.com/fonttools/fonttools/Lib/fontTools/subset/__init__.py", line 2785, in subset
self._prune_post_subset(font)
File "/Users/mnakamura/.ghq/github.com/fonttools/fonttools/Lib/fontTools/subset/__init__.py", line 2768, in _prune_post_subset
retain = table.prune_post_subset(self.options)
File "/Users/mnakamura/.ghq/github.com/fonttools/fonttools/Lib/fontTools/subset/__init__.py", line 2208, in prune_post_subset
decompiler.execute(c)
File "/Users/mnakamura/.ghq/github.com/fonttools/fonttools/Lib/fontTools/subset/__init__.py", line 2001, in execute
psCharStrings.T2WidthExtractor.execute(self, charString)
File "/Users/mnakamura/.ghq/github.com/fonttools/fonttools/Lib/fontTools/misc/psCharStrings.py", line 303, in execute
rv = handler(index)
File "/Users/mnakamura/.ghq/github.com/fonttools/fonttools/Lib/fontTools/misc/psCharStrings.py", line 375, in op_or
raise NotImplementedError
NotImplementedError
This glyph has fifteen stems, and contains a sequence hintmask 0110111101110010
in its charstring. Since the mask bits 0110111101110010
(= 6f72
in hex) can be decoded as a string “or” in ASCII-compatible encodings, the sequence is stored as [..., 'hintmask', 'or', ...]
in charString.program
, and eventually it’s impossible to distinguish the bits from an or
operator.
Workaround
Use Python 3.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
The CFF2 CharString Format (OpenType 1.8.3) - Microsoft Learn
Specifies the counter spaces to be controlled, and their relative priority. The mask bits in the bytes, following the operator, reference the ...
Read more >The Type 2 Charstring Format - GitHub Pages
A Type 2 charstring program is a sequence of unsigned 8-bit bytes that encode numbers and operators. The byte value.
Read more >fonttools/psCharStrings.py at main - GitHub
A library to manipulate font files from Python. Contribute to fonttools/fonttools development by creating an account on GitHub.
Read more >Source code for fontTools.misc.psCharStrings - Read the Docs
"""psCharStrings.py -- module implementing various kinds of CharStrings: CFF dictionary ... index value = self.handle_operator(operator) return value, index.
Read more >July 2015 - Project Zero
This talk discussed the exploitation process of a vulnerability found in the implementation of a BLEND Charstring instruction, discovered in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I’ve fixed the issue in https://github.com/fonttools/fonttools/commit/c0d672ba70ba6907759b086d59f110496d79c606 Could you please check it works now? Also it would be nice if you could provide a minimal font the reproduces the issue so we can add to our regression tests (one glyph would be enough).
@mashabow Thank you! 😄