Cosimo Lupo
638a16ceb8
Merge pull request #3345 from fonttools/recordingPen-draw
...
[RecordPen] Add draw() and drawPoints() as alias to replay()
2023-11-20 10:14:47 +00:00
Behdad Esfahbod
c7694d5877
[statisticsPen] Remove redundant code
2023-11-19 12:31:28 -07:00
Behdad Esfahbod
1e514fce80
[statisticsPen] Handle zero area
...
This was dropped in the previous commit.
2023-11-19 12:22:40 -07:00
Behdad Esfahbod
4eebdf4f0d
[statisticsPen] Add StatisticsControlPen
...
It uses the control box and discrete statistics instead
of using the Green's theorem.
Works better on contours that have no area.
Surprisingly, this seems to be slower than StatisticsPen.
Perhaps because MomentsPen is Cythonized.
2023-11-19 12:03:23 -07:00
Behdad Esfahbod
21864fc26a
[statisticsPen] Another bandaid
...
Sigh. I'm probably doing something wrong but I don't understand.
2023-11-19 11:09:39 -07:00
Behdad Esfahbod
0d28975708
[statisticsPen] If area=0, use control-box samples
...
Slower because we have to remember the nodes, but
more accurate. Particularly useful in varfonts
where they intentionally collapse a contour to
zero area.
2023-11-19 10:58:04 -07:00
Behdad Esfahbod
6e0b9c615f
[statisticsPen] Another bandaid :-(
2023-11-19 08:25:32 -07:00
Behdad Esfahbod
d43617c2e3
[statisticsPen] If area is zero, report controlbox meanX/Y
...
Before we were returning all zeros.
This reduces false-positives in interpolatable.py
Three new members are also added to the pen:
sumNodesX, sumNodesY, numNodes.
2023-11-18 13:21:43 -07:00
Behdad Esfahbod
e12d3dd2b6
[RecordPen] Add draw() and drawPoints() as alias to replay()
...
Fixes https://github.com/fonttools/fonttools/issues/3342
2023-11-17 18:53:44 -07:00
Behdad Esfahbod
efd74adadd
[statisticsPen] Adjust docstring
2023-11-16 14:04:29 -07:00
Behdad Esfahbod
290c3333f9
[statisticsPen] Variance and standard-deviation are non-negative
...
I don't know why I get negative values there, but add an
abs() for now.
This fixes varLib.interpolatable false-negatives with
NotoSansEthiopean's `koa.eth` glyph.
2023-11-16 11:00:54 -07:00
Behdad Esfahbod
4d640046b2
[svgPathPen] Accept float axis locations
2023-11-14 09:10:09 -07:00
Cosimo Lupo
335a1e56ec
re-run black v23.10 on all .py files
2023-11-03 10:25:15 +00:00
Behdad Esfahbod
c7e3348904
[statisticsPen] Micro-optimize
2023-10-19 12:20:51 -06:00
Behdad Esfahbod
ad6c5eb89c
black
2023-07-24 13:01:57 -06:00
Behdad Esfahbod
20585ac05b
[statisticsPen] Add -q,--quiet
2023-07-24 12:53:15 -06:00
Behdad Esfahbod
050370764a
[statisticsPen,svgPathPen] Add -y for face-index
2023-07-24 12:48:57 -06:00
Behdad Esfahbod
2ef075050a
[statisticsPen] Add --variations
2023-07-24 12:42:53 -06:00
Behdad Esfahbod
ab2aac58d5
[statisticsPen] Report slant in angles too
2023-07-24 12:35:04 -06:00
Behdad Esfahbod
133f907cbc
[statisticsPen] Report perceptual weight/slant average
2023-07-24 12:32:06 -06:00
Behdad Esfahbod
3f46e67e8b
[statisticsPen] Report font-wide slant
2023-07-19 20:03:38 -06:00
Behdad Esfahbod
8707a1da58
[statisticsPen] Report font glyph-average weight/width
2023-07-19 19:55:32 -06:00
Cosimo Lupo
5c0f05cc42
allow to pass 'round' parameter in ttGlyphPen, optimize for noRound
2023-06-08 11:41:07 +01:00
Cosimo Lupo
97e626b23e
ttGlyphPen: drop implied before rounding, allow not to round at all
...
We want to be able to compute implied oncurves both before coordinates have been rounded to integer and afterwards.
Also when ufo2ft builds interpolatable master TTFs, we want to turn off the rounding so that varLib can call dropImpliedOnCurvePoints on the un-rounded coordinates, so we need an option to disable rounding the coordinates in the ttGlyphPens
2023-06-07 17:55:56 +01:00
Cosimo Lupo
b6bb9dfef0
ttGlyphPen: only call dropImpliedOnCurvePoints for simple glyphs after fully formed
2023-06-02 13:53:00 +01:00
Cosimo Lupo
b7f4e9b83e
move dropImpliedOnCurvePoints function to glyf table module
...
so it can be used by client code on multiple glyf Glyph objects regardles of TTGlyphPen
2023-06-01 16:49:29 +01:00
Cosimo Lupo
a73abc6b87
make drop_implied_oncurves work with multiple interpolatable glyphs
2023-06-01 16:49:29 +01:00
Cosimo Lupo
3bbc19abb1
TTGlyphPen: do not error with empty contours, simply ignore them
...
Fixes https://github.com/googlefonts/fontmake/issues/1001
2023-05-31 11:58:14 +01:00
Cosimo Lupo
39c9783bf8
add filter pen that explicitly emits closing line when lastPt != movePt
...
it can be useful when comparing two paths and testing whether then contain the same number/types of segments
2023-05-02 14:56:56 +01:00
Cosimo Lupo
0df4997661
prevent cython.compiled raise AttributeError if cython not properly installed
...
It's possible sometimes that 'import cython' does not fail but then 'cython.compiled' raises AttributeError.
It actually happened in our internal production environment...
Similar issue to https://github.com/pydantic/pydantic/pull/573 and https://github.com/ipython/ipython/issues/13294
2023-03-02 17:43:38 +00:00
Behdad Esfahbod
e72d195583
[qu2cu] Adjust stats to match cu2qu
2023-02-22 09:18:49 -07:00
Behdad Esfahbod
8f89a435ac
[ttGlyphPen] Rename preserveTopology to dropImpliedOnCurves
2023-02-22 09:08:39 -07:00
Behdad Esfahbod
7580fc7e24
[cu2quPen] Remove unnecessary check
2023-02-22 07:44:13 -07:00
Cosimo Lupo
c7fa0e6f26
Cu2QuPointPen: minor refactoring of _drawPoints method
2023-02-22 12:03:04 +00:00
Behdad Esfahbod
58f9245115
[ttGlyphPen] Refactor code into function
2023-02-21 21:16:27 -07:00
Behdad Esfahbod
9c60b86b46
[cu2quPen] Add all_quadratic=True
2023-02-21 14:52:15 -07:00
Behdad Esfahbod
82e0536beb
[glyf] Support cubic curves
...
https://github.com/harfbuzz/boring-expansion-spec/issues/41
2023-02-21 13:01:49 -07:00
Behdad Esfahbod
085b489012
[qu2cuPen] Change stats
...
To count number of quadratic vs cubic segments.
2023-02-21 13:01:41 -07:00
Behdad Esfahbod
94ee47c6e4
[qu2cu] Add a test and fix a bug
2023-02-20 12:22:16 -07:00
Behdad Esfahbod
41732b5904
[qu2cu] Use math.isclose
2023-02-20 12:02:09 -07:00
Behdad Esfahbod
f87a897c7f
Merge pull request #2993 from fonttools/qu2cu
...
qu2cu
2023-02-20 11:04:48 -07:00
Behdad Esfahbod
d0896ac296
[qu2cu] Simplify API
...
Drop the one that was special-case of the other.
2023-02-20 10:03:30 -07:00
Behdad Esfahbod
efed2550be
[qu2cu_pen] Respect all_cubic for oncurveless curves
2023-02-20 09:10:07 -07:00
Behdad Esfahbod
336cfc3e8f
[qu2cu_pen] Respect all_cubic
2023-02-20 09:05:58 -07:00
Behdad Esfahbod
8427e6dd18
[ttGlyphPen] Add preserveTopology=True
...
If False, perform implicit-oncurve elimination.
2023-02-18 15:45:27 -07:00
Behdad Esfahbod
84cd10d666
[qu2cuPen] Don't add implicit points for cubics
...
We can't since that would be interpretted as a superBezier.
2023-02-18 09:46:56 -07:00
Behdad Esfahbod
86aff322b9
[qu2cuPen] Drop quadratic implicit oncurves too
2023-02-18 09:46:56 -07:00
Behdad Esfahbod
c11682ca85
[qu2cuPen] Drop cubic implicit oncurves
2023-02-18 09:46:56 -07:00
Behdad Esfahbod
ea8ae8f399
Black
2023-02-18 09:46:56 -07:00
Behdad Esfahbod
ceae682246
[qu2cu] Add all_cubic parameter
2023-02-18 09:46:56 -07:00