202 Commits

Author SHA1 Message Date
Behdad Esfahbod
2abacb9366 [pens.t2CharString] Bump CFF2 stack size from 193 to 513
That's happening in the next version of OpenType spec (and maxstack
operator deprecated.)
2017-05-06 13:14:25 -06:00
Behdad Esfahbod
4b5c1be29b [pens.t2CharStringPen] Add CFF2 mode 2017-05-06 04:54:07 -06:00
Behdad Esfahbod
72ec474f74 [pens.t2CharStringPen] Simplify drastically 2017-05-06 04:50:24 -06:00
Behdad Esfahbod
c8cf233e26 [pens.t2CharStringPen] Hook up to cffLib.specializer
Tests are failing now, as cffLib.specializer combines operations whereas
previous pen didn't.  I checked all failures and they all look like the
expectation needs to be updated to me.

Fixes https://github.com/fonttools/fonttools/issues/403
2017-05-05 21:21:30 -06:00
Miguel Sousa
70c695f8f6 [t2CharStringPen] Make it more clear that the variables hold offsets 2017-04-28 03:34:41 -07:00
Miguel Sousa
c757cf7b70 [t2CharStringPen] Support more path construction operators 2017-04-28 03:26:37 -07:00
Behdad Esfahbod
b4827ae965 Add recordingPen.replayRecording 2017-04-20 14:54:13 -07:00
Cosimo Lupo
94c88f56cb
[recordingPen] add DecomposingRecordingPen
Uses the DecomposingPen as mixin, and raise KeyError on missing glyphs

See https://github.com/fonttools/fonttools/pull/880#issuecomment-288558012
2017-04-13 14:22:39 +01:00
Cosimo Lupo
b438dbeee5
[basePen] add LoggingPen and DecomposingPen, subclass BasePen from DecomposingPen
This is so we can reuse addComponent with the recording pen, without having to
inherit from the BasePen (which also splits curveTo and qCurveTo commands).

Log warning message on missing glyphs by default, optionally raise KeyError
if skipMissingComponents = False
2017-04-13 14:22:29 +01:00
Cosimo Lupo
980ac7d415
[transformPen] use FilterPen as the base class instead of AbstractPen 2017-04-12 14:17:15 +01:00
Cosimo Lupo
107bf48ffe
[filterPen] add FilterPen base class
Can be useful for others, e.g.:
https://github.com/googlei18n/ufo2ft/issues/120#issuecomment-288503784
2017-04-12 14:17:15 +01:00
Adrien Tétar
a03eb1137b pens: add a wx pen 2017-04-07 20:50:20 +02:00
Miguel Sousa
e2d4fe9da8 minor 2017-03-17 07:48:22 -07:00
Miguel Sousa
4de5af36cb Add usage example of RecordingPen 2017-03-17 02:19:12 -07:00
Behdad Esfahbod
c2033cb095 Document new pens 2017-02-26 10:41:11 -08:00
Behdad Esfahbod
19ab2c96cc Fix typo
Who knew __all__ does not actually hide symbols not listed from
importing by name?
2017-02-26 10:33:58 -08:00
Behdad Esfahbod
a02a429573 [StatisticsPen] Some more (probably over-) optimization 2017-02-24 15:20:38 -08:00
Behdad Esfahbod
8335af0d1d [statisticsPen] Micro-optimize 2017-02-24 14:06:58 -08:00
Behdad Esfahbod
8879318c0b Move RecordingPen to fontTools.pens.recordingPen 2017-02-21 12:11:36 -06:00
Behdad Esfahbod
55e529f7a3 Add fontTools.pens.teePen 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
6face10ca3 [basePen] Default glyphset to None 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
f3bfea12c6 Add __all__ to pens that didn't have it 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
69f38605d1 [transformPen] 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
621759b3a8 [symfont] Add endPath() 2017-02-21 12:01:10 -06:00
Behdad Esfahbod
d8e8a657fa [areaPen] Remove unnecessary docstrings 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
f3224d7d34 Move StatisticsPen into fontTools.pens.statisticsPen 2017-02-20 13:19:35 -06:00
Behdad Esfahbod
a8db22a077 Move MomentsPen into fontTools.pens.momentsPen 2017-02-20 12:33:12 -06:00
Behdad Esfahbod
8712c20156 [perimeterPen] Use Gauss-Legendre instead of Lobatto-Gauss for qudratic
Uses one fewer point and is no uglier.
2017-02-20 11:16:12 -06:00
Behdad Esfahbod
6738305fb1 [perimeterPoint] Minor 2017-02-20 11:09:14 -06:00
Behdad Esfahbod
3d4bd76a76 [perimeterPen] Add Gauss-Lobatto implementation for quadratic Bezier as well
Is twice faster than the exact algorithm.
2017-02-20 10:17:07 -06:00
Behdad Esfahbod
9f1067a991 [perimeterPen] Optimize Lobatto code 2017-02-20 10:17:07 -06:00
Cosimo Lupo
a226c4772b
[perimeterPen] move source encoding declaration to the first line
Otherwise I get this error on python2.7:

SyntaxError: Non-ASCII character '\xc2' in file perimeterPen.py on line 87, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
2017-02-19 20:08:57 -08:00
Behdad Esfahbod
3e74798499 [perimeterPen] Add Gauss-Lobatto quadrature approximation implementation
Is about 30 percent faster than recursive approach for the default .005
error tolerance.  To be optimized more.
2017-02-19 16:08:21 -06:00
Cosimo Lupo
78ad48eaf3
Move all *_test.py modules and test data to external Tests/ folder 2017-01-16 09:14:12 +00:00
Cosimo Lupo
29f0a99a06
[t2CharStringPen] add docstring to T2CharStringPen to explain how 'roundTolerance' works 2017-01-14 12:11:21 +00:00
Cosimo Lupo
8891f4185e
[t2CharStringPen] allow tolerance to be > 0.5
See https://github.com/fonttools/fonttools/pull/804#issuecomment-272559973
2017-01-13 22:32:10 +00:00
Cosimo Lupo
456e159a5a
[t2CharStringPen] raise ValueError if tolerance not in range 0 <= t <= 0.5 2017-01-13 09:34:42 +00:00
Cosimo Lupo
0a9800b109
[t2CharStringPen] use abs() instead of math.fabs()
abs ends up calling fabs for floats anyway, and is a bit faster if 'number' is an int
2017-01-13 09:25:49 +00:00
Cosimo Lupo
3165fa9703
[t2CharStringPen] always round the advance widths regardless of roundTolerance
hmtx only can have integer values, so it would be weird to have widths as float in CFF...
2017-01-12 22:38:28 +00:00
Cosimo Lupo
adac78591d
[t2CharStringPen] restore default rounding; tolerance must be between 0 and .5 2017-01-12 21:34:59 +00:00
Cosimo Lupo
20375ca41c
[t2CharStringPen_test] add tests for coordinate rounding and basic pen commands 2017-01-12 19:53:38 +00:00
Cosimo Lupo
834d0d4cca
[t2CharStringPen] disable rounding coordinates; add 'roundTolerance' argument
Rounding of coordinates is now disabled by default.

The pen now accepts an optional 'roundTolerance' float, with values between
0 and 1 (default is 0).

Values >= 0.5 mean round all coordinates to integers.

Values between 0 and 0.5 mean round only when the absolute difference
between the original float and the rounded integer is within the tolerance

Fixes #769
2017-01-12 19:48:55 +00:00
Cosimo Lupo
49bcbb916b
consistently do sys.exit(unittest.main()) in all test modules
So that when run as scrips they report test failures with exit code

Follow up on b7bb391033ef3255c90134da3d7aef50d2d5326d
2017-01-11 13:05:35 +00:00
Behdad Esfahbod
25083502e4 [perimeterPen] Update check for cusps
If p1 coincides with p0 or p2, we still can use the lineTo()
code.
2016-11-08 16:39:38 -08:00
Behdad Esfahbod
a71faf9322 [perimeterPen] 5x speed-up cubic by using complex numbers as points 2016-10-30 14:28:38 +02:00
Behdad Esfahbod
c5538eaccf [perimeterPen] Speed up quadratic by using complex numbers for points 2016-10-30 14:28:33 +02:00
Behdad Esfahbod
a284865851 Remove unused line 2016-10-30 14:28:07 +02:00