Behdad Esfahbod
220ff2b238
[pens.areaPen] Clean up a bit
...
Based on discussion in
https://github.com/behdad/fonttools/pull/618#issuecomment-226105824
2016-06-15 14:10:44 +04:00
Behdad Esfahbod
b3414e9ffd
[symfont] Use AreaPen from fontTools
...
It's about 20% faster.
2016-06-14 01:26:39 -04:00
Behdad Esfahbod
acbd3df647
[symfont] Add function to print function sources for caching
2016-06-14 01:23:40 -04:00
Behdad Esfahbod
1a48fc27a1
[symfont] Remove one level of function call
2016-06-14 01:16:57 -04:00
Behdad Esfahbod
b0b049774c
Implement analytical curve length for quadratic beziers
...
This is multiple times faster, and tolerance-independent.
I'll explain how I arrived at this later.
2016-06-13 20:08:50 -04:00
Behdad Esfahbod
56c27f45c9
Speed up perimeterPen
...
It's still too slow, but an improvement.
Also, remove duplicate copy from symfont.
2016-06-13 18:50:01 -04:00
Behdad Esfahbod
71fb49962a
Improve perimeterPen tests
...
The tolerance on the pen is set to 0.5%, so it does not make sense
to test for accuracy for anything more than integers given the
values.
2016-06-13 18:47:03 -04:00
Behdad Esfahbod
b7cf54aef1
[symfont] Minor
2016-06-13 18:20:42 -04:00
Cosimo Lupo
04c19fda80
Merge pull request #619 from miguelsousa/pen-tests
...
AreaPen and PerimeterPen unit tests
2016-06-13 06:23:00 +01:00
Miguel Sousa
9efcaf05e4
Unit tests for AreaPen and PerimeterPen
2016-06-12 15:46:52 -07:00
Miguel Sousa
92e8455259
perimeterPen.py: make glyphset the first argument (like in all other pens)
2016-06-12 15:46:04 -07:00
Cosimo Lupo
b73b432add
Merge pull request #618 from anthrotype/area-pen
...
Area and Perimeter pens
2016-06-12 12:51:09 +01:00
Cosimo Lupo
c5ed6c6456
perimeterPen.py: handle implied lineTo in closePath
2016-06-12 11:49:00 +01:00
Cosimo Lupo
d51b88a234
areaPen.py: remove unused 'interpolate' function; call polygon_area directly in closePath
2016-06-12 11:37:02 +01:00
Cosimo Lupo
39f919f1f1
areaPen.py: calculate area under quadratic curve directly, using Green theorem
2016-06-12 03:14:09 +01:00
Cosimo Lupo
5f0e48e649
areaPen.py: make sure the first and last points of contour overlap
2016-06-12 03:13:32 +01:00
Cosimo Lupo
38359b054d
areaPen.py: invert sign of area (CCW is now positive)
2016-06-12 03:12:02 +01:00
Cosimo Lupo
c08e47ed47
perimeterPen.py: copy PerimeterPen from symfont.py
2016-06-11 23:07:23 +01:00
Cosimo Lupo
eb7e193773
areaPen.py: typo
2016-06-11 23:07:23 +01:00
Cosimo Lupo
76dc5d2607
areaPen.py: use tabs for indentation as that's the norm in fontTools
...
(despite I prefer spaces)
2016-06-11 23:07:23 +01:00
Cosimo Lupo
2dc88be8a7
areaPen.py: remove unused 'distance' function
2016-06-11 23:07:23 +01:00
Cosimo Lupo
2cb93ee7dd
areaPen.py: hook up quadratic_curve_area to AreaPen._qCurveToOne method
2016-06-11 23:07:23 +01:00
Cosimo Lupo
ac3b30e0db
areaPen.py: add default __future__ imports
2016-06-11 23:07:23 +01:00
Cosimo Lupo
ad4b94f4b9
areaPen.py: use regular tuples for points instead of namedtuple
2016-06-11 23:07:23 +01:00
Cosimo Lupo
046333dda5
areaPen.py: pen to calculate the area of a glyph (by Behdad)
...
https://github.com/behdad/fonttools/issues/617#issuecomment-225029592
2016-06-11 23:07:23 +01:00
Behdad Esfahbod
be27acbbd2
[varLib] Fix thinko
2016-06-10 19:49:45 -07:00
Behdad Esfahbod
c34739760c
[symfont] Handle closePath()
...
Apparently some draw() implementations expect closePath() to
draw a line to the contour beginning.
In fact, looks like fontTools's TrueType draw() always does the
lineTo() before closePath(), but the CFF draw() doesn't.
As raised in
https://github.com/behdad/fonttools/pull/618#issuecomment-225314022
2016-06-10 16:06:22 -07:00
Behdad Esfahbod
7822958fa5
[symfont] Negate sign in green() function
...
Following the theorem declaration:
https://en.wikipedia.org/wiki/Green%27s_theorem
we should negate the result. Ie, for a counter-clockwise curve,
the area must be positive.
Raised in
https://github.com/behdad/fonttools/pull/618#issuecomment-225205335
2016-06-10 15:58:56 -07:00
Behdad Esfahbod
78c29bc5a1
Some more solveCubic() work
...
Should be stable again now.
2016-06-08 18:56:31 -07:00
Behdad Esfahbod
93d08d4188
[mtiLib] Accept "u " as well as "U " in Unicode glyph references
...
Fixes https://github.com/googlei18n/fontmake/issues/86
2016-06-08 15:17:08 -07:00
Behdad Esfahbod
b2bd15d580
Make solveCubic() more robust
...
Also, return duplicate roots multiple times.
Part of https://github.com/behdad/fonttools/issues/617
2016-06-08 14:54:23 -07:00
Behdad Esfahbod
b1474a3993
Minor
2016-06-07 16:21:43 -07:00
Behdad Esfahbod
c4f8cbb6a1
[varLib/mutator.py] Update hmtx lsb after updating glyf bounds
2016-06-07 15:51:54 -07:00
Behdad Esfahbod
e53764a16d
In calcIntBounds(), round values
...
The glyph coordinates in glyf table are going to be rounded when
writing out, so we should use the same mode of conversion to
integers. Otherwise the xMin of a glyph might end up being
different from its actual minimum X.
2016-06-07 15:47:02 -07:00
Behdad Esfahbod
d1424e9d5a
Improve solveCubic() against rounding issues
...
Might fix https://github.com/behdad/fonttools/issues/617
2016-06-07 14:16:42 -07:00
Behdad Esfahbod
c794ff85d6
Fix typo in comments
2016-06-06 22:06:33 -07:00
Cosimo Lupo
62a6222652
Merge pull request #614 from moyogo/fixunescape
...
[feaLib]: fix unescape_mac_name_string() and unescape_windows_name_string()
2016-06-01 18:06:36 +01:00
moyogo
70a60433f8
[feaLib]: fix unescape_mac_name_string() and unescape_windows_name_string()
2016-06-01 17:33:15 +01:00
justvanrossum
123d7c10b6
Found a font that has an empty SingleSubst mapping. While that's silly, it's not necessarily illegal. FontTools, however, would crash with an AssertionError upon compilation. Fixed.
2016-05-28 22:20:31 +09:00
Behdad Esfahbod
18f70c75c5
[varLib] Add interpolation functions
...
Untested.
2016-05-26 13:34:37 -07:00
Behdad Esfahbod
84d34353e3
Merge pull request #608 from khaledhosny/file-attribute
...
Check for file attribute before deleting it
2016-05-19 20:01:06 +01:00
Khaled Hosny
f88c43d105
Check for file attribute before deleting it
...
I don’t know why this is happening, but I’m getting attribute error when
I build https://github.com/khaledhosny/mada with compreffor
optimisations on.
2016-05-19 20:50:10 +02:00
Cosimo Lupo
ca8e49b6f5
subset: fix typo
...
Ouch.
2016-05-16 17:05:46 +01:00
Cosimo Lupo
920c6a8249
subset: set maxp.maxStorage to 0 when --no-hinting option is passed
...
'maxStorage' is the maximum number of Storage Area locations used.
If there's no hinting, it should be 0.
2016-05-16 15:57:17 +01:00
Cosimo Lupo
6c1c2a44d1
cffLib: use tostr() when getting SID of indexed string (or we end up with duplicates in py3)
...
I noticed this issue while porting compreffor to py3. In my test fonts, the binary
CFF tables as generated with python 2 sometimes were slightly different from the
ones generated with python 3, although the TTX dump was identical!
It turns out, when running in Python 3, cffLib adds extra entries to the
list of CFF indexed strings, because of bytes vs str.
The `IndexedStrings.getSID` method takes an input string 's' and and returns
the SID integer for that string. If it's a new string, it gets appended to the
list, as well as to an internal strings-to-SID mapping, so that the same SID
value is returned for any given string.
The problem with python 3 was that, if the input string was of `bytes` type
instead of `str`, then the test for inclusion (the dict's `__contains__`)
would return False, and as a result the "same" string (e.g. "Regular" and
b"Regular") could be encoded twice in the list of CFF strings.
(yes, we desperately need unit tests for cffLib...)
2016-05-16 13:11:46 +01:00
justvanrossum
650aae7cf3
making error and warning consistent #604
2016-05-13 07:10:47 +02:00
justvanrossum
1394416821
Better error message for broken hmtx/vmtx table, addressing #604 .
2016-05-13 07:07:52 +02:00
Behdad Esfahbod
26bb99e1c3
[subset] Whitespace
2016-05-12 13:40:14 +02:00
Behdad Esfahbod
cd914c9575
[subset] Protect against some more prematurely-short arrays
2016-05-12 13:40:14 +02:00
Behdad Esfahbod
85750a864a
[subset] Protect against prematurely-short arrays GPOS
2016-05-12 13:40:14 +02:00