We now correctly handle nameid statements with surrogate pairs and
old-style macOS-encoded names (provided that fonttools supports the
specified encoding).
Resolves https://github.com/fonttools/fonttools/issues/842.
Also fixes a bug where glyph alternates in MTI feature files were
wrongly sorted by glyph name. After this change, the output is using
the same ordering as in the input MTI feature file.
Fixes https://github.com/fonttools/fonttools/issues/833.
When reduce() receives an empty sequence, it raises TypeError, unless it is given a third 'initializer' argument
ValueFormat values should default to 0, so we shall use that as initializer.
Also, the reduce() built-in is no longer available on Python 3.
It's still accessible for both py2 and py3 from functools.
Fixes https://github.com/googlei18n/fontmake/issues/241
On python2.7, the fonttools py23 module registers a 'lastResort' StreamHandler
similar to the one found in python3's logging module, that always writes
to the current value `sys.stderr`.
This also applies to any python library that imports from fontTools.misc.py23
under python2.7.
The logging module has a 'shutdown' atexit handler that flushes all the
logging handlers' streams just before the python interpreter exits.
Sometimes (e.g. when calling `python setup.py test` as in MutatorMath's test
suite), the interpreter termination ends with a traceback, which is
triggered by the atexit handler failing to flush the lastResort handler's
stream, sys.stderr
AttributeError: None has no attribute 'stderr'
This is because during module teardown, the globals (in this case 'sys')
are set to None, and the order in which modules are deleted is not
guaranteed.
See 58531934a8
We are using unicode_literals in this module since 329261b.
Because of that, on py27 sometimes a TTFont glyphOrder may end up with
a mix of `str` and `unicode` glyph names.
While I'd love to change every single 'text' string to unicode, maybe
in this case it makes sense to use the native `str` type (`bytes` on
py2, unicode string on py3) for the UV2AGL and AGL2UV dictionaries, as
glyph names can only contain ascii characters anyway.
See https://github.com/fonttools/fonttools/pull/774#discussion_r98327429
In the latest PyPI release 3.6.0, an incosistency in the title levels between
README.rst and NEWS.rst caused PyPI to not correctly format the reStructuredText
document.
I've fixed the PKG-INFO manually for the current release:
https://pypi.python.org/pypi/FontTools/3.6.0
The next release should be fine.
When a subroutine contains no explicit hint stem operators (has_hint=False),
but it contains a hintmask operator which, in the context of the calling
charstring, would be understood as implying a vstemhm, then we need to set
has_hint=True on the subroutine, and update the last_hint index.
Otherwise, the drop_hints function leaves behind the arguments of the implicit
vstemhm operator.
This case is exemplified in the test font Tests/subset/data/Lobster.subset.ttx,
for charstrings "B" and "B.salt", and subroutine index="2".
--- /Users/cosimolupo/Documents/Github/fonttools/Tests/subset/data/expect_no_hinting_CFF.ttx
+++ /var/folders/jb/rjz76yw92w7144mwqg119jnm0000gn/T/tmpO_XOWh/tmp3.ttx
@@ -47,7 +47,7 @@
107 return
</CharString>
<CharString index="2">
- 230 636 rmoveto
+ 119 230 636 rmoveto
-136 -636 rlineto
144 hlineto
return
@@ -94,7 +94,7 @@
endchar
</CharString>
<CharString name="B">
- 187 -105 callsubr
+ 187 6 93 362 139 -119 101 -101 -105 callsubr
82 383 rlineto
2 18 20 1 8 hhcurveto
73 22 -57 -70 hvcurveto
@@ -109,7 +109,7 @@
endchar
</CharString>
<CharString name="B.salt">
- 185 -105 callsubr
+ 185 6 93 350 149 -119 105 -105 -105 callsubr
6 30 rlineto
-41 39 41 -17 39 hhcurveto
125 110 175 136 72 -32 62 -82 15 hvcurveto
_DehintingT2Decompiler now inherits from T2WidthExtractor, so we can save
the charstring width and insert it back after we dropp the hints.
This avoids the need to do an extra .draw() just for the sake of
extracting the width.
We shall reuse it as base class for the _DehintingT2Decompiler in subset module,
as we need to save the width in order to re-insert it after dropping the hints.