3767 Commits

Author SHA1 Message Date
Cosimo Lupo
8bc5526715
Update changelog 2017-02-06 13:22:28 +00:00
Behdad Esfahbod
ef0eb9dc8f [varLib] Move code around 2017-02-05 18:52:27 -08:00
Behdad Esfahbod
b5c34ceb15 [varLib] Fix building variation of PairPosFormat2
I broke this with a738464f775c190bf70e26d0a32ff2344ec43201
Ouch!
2017-02-05 18:48:15 -08:00
Behdad Esfahbod
e45297bf4b Populate defaults even for tables that have postRead
Implement custom populateDefaults for them.
2017-02-03 14:33:57 -08:00
Behdad Esfahbod
b887860b65 Fix compiling of MultipleSubstFormat1 with zero out glyphs
str.split('') returns [''], whereas we expect [].
Fix that.
2017-02-02 15:49:09 -08:00
Cosimo Lupo
41099fd376
Bump version: 3.6.2 → 3.6.3.dev0 2017-01-30 17:25:52 +00:00
Cosimo Lupo
d67135852f
Release 3.6.2 2017-01-30 17:24:57 +00:00
Cosimo Lupo
4f8f64e14e Merge pull request #827 from anthrotype/reduce-empty-sequence
[varLib.merger] set initializer for reduce() to handle empty sequences
2017-01-30 17:17:40 +00:00
Cosimo Lupo
3717dc6549
[varLib.merger] set initializer for reduce() to handle empty sequences; import reduce from functools for py3
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
2017-01-30 16:51:41 +00:00
Cosimo Lupo
1cf852bb3f
Bump version: 3.6.1 → 3.6.2.dev0 2017-01-28 16:16:25 +00:00
Cosimo Lupo
0617123053
Release 3.6.1 2017-01-28 16:01:32 +00:00
Cosimo Lupo
17cf2f262a
Update changelog 2017-01-28 16:01:22 +00:00
Cosimo Lupo
972b3e6a15
[py23] handle exception at shutdown in 'lastResort' logging handler
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
2017-01-28 14:18:29 +00:00
Cosimo Lupo
d8c40583d1
[agl] ensure AGL glyph names are 'str' type
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
2017-01-28 11:48:51 +00:00
Cosimo Lupo
93b97510bc
[README.rst] fix issue with inconsistent RST title level
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.
2017-01-27 14:46:39 +00:00
Cosimo Lupo
a9dcf1c1b0
Bump version: 3.6.0 → 3.6.1.dev0 2017-01-26 19:52:25 +00:00
Cosimo Lupo
18b6459ce2
Release 3.6.0 2017-01-26 19:50:17 +00:00
Cosimo Lupo
fe3c08b373
Update changelog 2017-01-26 19:49:49 +00:00
Cosimo Lupo
2b76efb4ad
[subset] set has_hint if a subr contains hintmask acting as implicit vstemhm
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
2017-01-26 12:23:51 +00:00
Cosimo Lupo
dcaf27d726
[subset] set the width on _DehintingT2Decompiler and avoid extra draw()
_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.
2017-01-26 12:09:37 +00:00
Cosimo Lupo
3bb50b9b7f
[psCharStrings] split width-extracting part of T2OutlineExtractor into T2WidthExtractor
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.
2017-01-26 11:55:13 +00:00
Behdad Esfahbod
a738464f77 [varLib] Let VariationMerger use AligningMerger for PairPos
VariationMerger now has all the intelligence of AligningMerge.
Should be good for a while...
2017-01-25 23:34:28 -08:00
Behdad Esfahbod
dd6fb82d66 [varLib] Move common code into a parent merger 2017-01-25 20:43:00 -08:00
Behdad Esfahbod
fece08bc32 [varLib] Enable subclassing of mergers
Theoretically diamond shapes and mixins should work as well.
2017-01-25 20:39:21 -08:00
Behdad Esfahbod
a34a7c906e [varLib] Towards making subclassed mergers working 2017-01-25 20:30:44 -08:00
Behdad Esfahbod
5e1be9e5e7 [varLib] Move code around 2017-01-25 20:11:35 -08:00
Behdad Esfahbod
2532fac11f [varLib] Improve assert fail breadcrumbs 2017-01-25 19:00:08 -08:00
Cosimo Lupo
c234e3606c
[data/expect_no_hinting_TTF.ttx] adjust data using empty instructions elements 2017-01-25 15:35:16 +00:00
Cosimo Lupo
3b7124757c
[subset] draw charstrings with NullPen to set the width before dropping hints
This is the same patch as PR #606

Quoting myself:
```
It seems that the horizontal advance of hinted charstrings gets lost when the CFF hinting is stripped with '--no-hinting' option...

T2CharString objects only get assigned a 'witdh' attribute after their 'draw' method is called.

The subsetter's drop_hints function attempts to insert the width back at the beginning of the de-hinted charstring's program, but can do that only if the charstring does have a 'width' attribute:

c63fea0f8f/Lib/fontTools/subset/__init__.py (L1928)

Hence, we must 'draw' the charstring (with a NullPen) before stripping the hints.
```

Now this method fixes the issue (advances are kept) when doing _both_ --no-hinting and --desubroutinize (the test_no_hinting_desubroutinize should now pass, while it was failing before).

However, when one only does does --no-hinting, this method raises an error:

AttributeError: 'NoneType' object has no attribute 'nominalWidthX'
Lib/fontTools/misc/psCharStrings.py:282: AttributeError

(this is reflected in the failing `test_no_hinting_CFF`)
2017-01-25 15:31:54 +00:00
Cosimo Lupo
99303de5c5
[subset_test] add tests for desubroutinize and no-hinting options using Lobster subset
The following test cases are expected to fail because the current implementation of drop_hints
also strips the charstrings' advance widths:

Tests/subset/subset_test.py::SubsetTest::test_no_hinting_CFF
Tests/subset/subset_test.py::SubsetTest::test_no_hinting_desubroutinize_CFF
2017-01-25 15:31:54 +00:00
Cosimo Lupo
8df708269f
[loggingTools_test] give more time to TimerTest::test_split
timers can be capricious...

https://travis-ci.org/fonttools/fonttools/jobs/195116432#L1265-L1278
2017-01-25 10:07:09 +00:00
Cosimo Lupo
100304a445 Merge pull request #819 from jenskutilek/master
Indent XML output for TT assembly instructions
2017-01-25 09:51:29 +00:00
Jens Kutilek
a97bddc180 Summarize changes 2017-01-25 10:21:06 +01:00
Jens Kutilek
8a5b4dc65f Merge pull request #3 from anthrotype/xml-instructions
don't write newline at end of fpgm/prep and revert test data changes
2017-01-25 10:11:26 +01:00
Cosimo Lupo
385c6d8f4f
[data/expect_keep_colr.ttx] adjust empty instructions elements in test data 2017-01-24 18:34:55 +00:00
Cosimo Lupo
3c46a4280f
[_g_l_y_f] use short empty element notation for glyf instructions 2017-01-24 18:33:57 +00:00
Cosimo Lupo
0918f7cf3e
[_g_l_y_f] factor out code for writing instructions in toXML 2017-01-24 17:33:53 +00:00
Cosimo Lupo
0aa086a94b
[_f_p_g_m] remove writer.newline() as it's now implied by self.program.toXML()
this also applies to table_p_r_e_p
2017-01-24 17:27:01 +00:00
Cosimo Lupo
e8527bcb48
[data/TestCLR-Regular.ttx] revert unnecessary changes from 337dd1d 2017-01-24 16:39:02 +00:00
Jens Kutilek
5e35056504 Merge pull request #2 from anthrotype/fix-xml-eol
Revert c043cfb and explicitly use newlinestr='\n' to fix failing Windows tests
2017-01-24 16:48:22 +01:00
Jens Kutilek
a8151d46c2 Revert "Now with correct test program file"
This reverts commit ff9c046299ae016adf19a8e327efbe3093d11c33.
2017-01-24 16:30:13 +01:00
Jens Kutilek
5d3b4eb4c0 Tell XMLWriter what newline character to use 2017-01-24 16:23:06 +01:00
Jens Kutilek
ff9c046299 Now with correct test program file 2017-01-24 16:22:45 +01:00
Cosimo Lupo
e85dd38a01
Revert c043cfb and explicitly use newlinestr='\n' to fix failing Windows tests 2017-01-24 15:21:05 +00:00
Jens Kutilek
2135ef25e6 Revert "No newline at end of file"
This reverts commit c043cfbb4698b7cb54fe236b9fed52e5857776ab.
2017-01-24 16:06:10 +01:00
Jens Kutilek
c043cfbb46 No newline at end of file 2017-01-24 16:01:44 +01:00
Jens Kutilek
22391398b0 Fix merge conflict 2017-01-24 15:46:40 +01:00
Jens Kutilek
5b40c4f257 Merge pull request #1 from anthrotype/xml-indent
PR819 fixes: don't write empty <assembly> elements
2017-01-24 15:37:23 +01:00
Cosimo Lupo
7e1f56a645
[data/expect_keep_colr.ttx] adjust expected data in SubsetTest.test_subset_clr 2017-01-24 14:35:55 +00:00
Cosimo Lupo
12b8e9284e
[data/ttProgram.ttx] add newline at the end of XML file to match b83b358 2017-01-24 14:35:55 +00:00