28 Commits

Author SHA1 Message Date
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
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
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
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
52b28f9022 [statisticsPen] Avoid division-by-zero 2022-08-12 14:00:27 -06:00
Behdad Esfahbod
4139d8914a [statisticsPen] By default report all glyphs 2022-07-12 16:39:56 -06:00
Nikolaus Waxweiler
a3acb1426b Remove py23 import 2021-01-29 22:23:27 +00:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Behdad Esfahbod
c2033cb095 Document new pens 2017-02-26 10:41:11 -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
f3bfea12c6 Add __all__ to pens that didn't have it 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