90 Commits

Author SHA1 Message Date
Behdad Esfahbod
5a06247ef8 [interpolatable] Derive RecordingPen from AbstractPen, not BasePen 2017-02-21 12:08:07 -06:00
Behdad Esfahbod
f0584a8507 [interpolatable] Change RecordingPen.draw to replay 2017-02-21 12:02:04 -06:00
Behdad Esfahbod
55e529f7a3 Add fontTools.pens.teePen 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
69c11928a2 [interpolatable] Minor 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
63c283a3c8 [interpolatable] Remove use of perimeter again 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
c935118072 [interpolatable] Add TeePen
Used to combine StatisticsPen and PerimeterPen into one pen for example.
Though, that example to be removed again.
2017-02-21 12:01:10 -06:00
Behdad Esfahbod
d4d12d255c [interpolatable] Minor 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
d748db59cc [interpolatable] Minor 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
14b46cf7a6 [symfont] Move symfont to fontTools.misc.symfont 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
724e6dab4e [symfont] Minor 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
08755ea1a4 [symfont] Move code around 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
ba4d63ea1c [symfont] Fixup for 1fe8d9f0d149d571626dd3f9121953fd71ebcc2c 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
621759b3a8 [symfont] Add endPath() 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
a690907243 [symfont] Minor 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
821ea7385f Minor 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
0a2c5ef7ae [symfont] Write generator code as main function in printPen() output 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
628b1c99aa [symfont] Remove stale docstring 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
7bd0081368 [symfont] Remove printCache()
It wasn't updated, and not working, for ages.
2017-02-21 12:01:10 -06:00
Behdad Esfahbod
087d865831 [symfont] Use dict.__missing__ trick for memoize 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
f13fbdae63 [symfont] Shuffle 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
03e8f2e461 [interpolatable] Minor 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
65e5c257ed [interpolatable] Remove stale commit and uncomment code 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
f3224d7d34 Move StatisticsPen into fontTools.pens.statisticsPen 2017-02-20 13:19:35 -06:00
Behdad Esfahbod
5cbfaa2792 [symfont] Change GlyphStatistics object into StatisticsPen
It's a simple pen now.  To be moved to fontTools.pens next.
2017-02-20 13:02:52 -06:00
Behdad Esfahbod
c14aad81f4 [symfont] Rename 2017-02-20 12:46:55 -06:00
Behdad Esfahbod
5132bbe411 [symfont] Remove glyph perimeter from GlyphStatistics
It's not technically statistics the same way the other properties are, and
we have a separate pen for it, so remove. Goal is to turn GlyphStatistics
into a pen.

Also remove perimeter from interpolatable.py contour characteristics vector.
Shouldn't be needed, given all the stats we already include.
2017-02-20 12:36:15 -06:00
Behdad Esfahbod
a8db22a077 Move MomentsPen into fontTools.pens.momentsPen 2017-02-20 12:33:12 -06:00
Behdad Esfahbod
d9bccb8609 [symfont] Simplify GlyphStatistics; just compute everything upfront
Our MomentsPen is sooooooooo fast now, there's no point trying to
make it lazy.
2017-02-20 11:28:44 -06:00
Behdad Esfahbod
a94e0f4e52 [symfont] Remove unused CovarianceMatrix 2017-02-20 10:17:07 -06:00
Behdad Esfahbod
da4b81e9ab Add momentsPen as generated by symfont:printPen()
To be moved to proper place soon.

Using this in interpolatable.py makes the core of the computation over an
order of magnitude faster.
2017-02-20 10:17:07 -06:00
Behdad Esfahbod
78637fb8c8 [symfont] Allow printing to files 2017-02-20 10:17:07 -06:00
Behdad Esfahbod
afe3407ca5 [symfont] More 2017-02-20 10:17:07 -06:00
Behdad Esfahbod
aaa950ea59 [symfont] Remove unused _Eigen method 2017-02-20 10:17:07 -06:00
Behdad Esfahbod
c8a82dcfee [symfont] Protect against math errors
Note that because our contours can overlap arbitrarily, our variance can end up
being negative, so, allow for that.
2017-02-20 10:17:07 -06:00
Behdad Esfahbod
c8e68b2f4c [interpolatable] Report bad contour in case of math error 2017-02-20 10:17:07 -06:00
Behdad Esfahbod
c3b2e533e9 [interpolatable] Minor 2017-02-20 10:17:07 -06:00
Behdad Esfahbod
223ecc6453 Revert "[symfont] Make sure variance is never negative (float precision issue)"
This reverts commit 5c025c6a03cca2ebe3390671a81aaca28492e71c.

Investigating why I'm seeing non-negligible negative variance.
2017-02-20 10:17:07 -06:00
Behdad Esfahbod
8869a5b343 [symfont] Minor 2017-02-19 13:59:56 -06:00
Behdad Esfahbod
5f82438206 [symfont] Write code to write optimized code for green-derived pens
Eg.:
printPen('MomentsPen',
         [('area', 1),
          ('momentX', x),
          ('momentY', y),
          ('momentXX', x*x),
          ('momentXY', x*y),
          ('momentYY', y*y)])
2017-02-19 02:50:06 -06:00
Behdad Esfahbod
aceabc032f [symfont] Minor 2017-02-19 00:10:41 -06:00
Behdad Esfahbod
5c025c6a03 [symfont] Make sure variance is never negative (float precision issue) 2017-02-17 19:44:32 -06:00
Behdad Esfahbod
67fdff238b [symfont] Optimize generated expression a bit 2017-02-17 19:44:32 -06:00
Cosimo Lupo
5d6995d317
[Snippets/interpolatable] scipy returns numpy arrays; convert them back to list 2017-01-19 15:39:48 +00:00
Behdad Esfahbod
179b8b5794 [Snippets/interpolatable] Use Hungarian algorithm from munkres or scipy when available
Fixes https://github.com/fonttools/fonttools/issues/815
2017-01-19 07:21:08 -08:00
Cosimo Lupo
ff07d30c33
[Snippets] remove apply-feature-file; this is now feaLib/__main__.py 2017-01-13 11:26:50 +00:00
Cosimo Lupo
2a4b3d5814
[Snippets] add otf2ttf.py using cu2qu for CFF -> TrueType conversion
See discussion at https://github.com/fonttools/fonttools/issues/802

Derived from:
https://github.com/googlei18n/cu2qu/issues/47
2017-01-12 11:02:41 +00:00
Cosimo Lupo
b7bb391033
don't use sys.exit(...) inside main(), but only under if __name__ == "__main__"
The convention is that sys.exit(...) is called only if a module is run as a script,
and that main() entry points use return statements to report exit codes: 0 (or None)
for successful execution, or any non-zero integer for errors.

E.g. see the console scripts generated when installing with pip.
2017-01-11 12:10:58 +00:00
Sascha Brawer
1d28abdb65 [gvar] Rename GlyphVariation to TupleVariation
In the OpenType 1.8 specification, this is called TupleVariation
so let's be consistent with the spec. (The initial implementation
in fonttools pre-dates OpenType 1.8).
2017-01-04 12:41:55 +01:00
Behdad Esfahbod
e90f9b7d58 [symfont] Minor 2016-12-22 16:11:04 -06:00
Behdad Esfahbod
4868a631b9 [Snippets/interpolatable] Improve error reporting
Also enable full vector.  It's necessary for accurate report.
2016-11-07 20:30:57 -08:00