364 Commits

Author SHA1 Message Date
Behdad Esfahbod
e037cea726 [cython] Simplify COMPILED variables 2024-11-27 22:53:16 -07:00
Nathan Williis
d05cdcf21f Docs: black 2024-09-11 15:48:09 +01:00
Nathan Williis
7d93689aca Docs: workaround doctest-vs-Sphinx syntax highlighting. 2024-09-11 15:45:46 +01:00
Nathan Williis
6914070e00 Docs, minor: remove trailing whitespace. 2024-09-04 17:36:48 +01:00
Nathan Williis
f771c37149 Docs: fix code-example blocks in pens. 2024-09-03 17:52:02 +01:00
Nikolaus Waxweiler
bdbc470f9f Revert "[svgPen] Write two digits after decimal by default"
This reverts commit 42d6b6b4fedf51dd741d3134da74df04339335b4.
2024-05-30 10:31:53 -07:00
Behdad Esfahbod
0bf67cc0c9 [statisticsPen] Fix __start_point access
Fixes https://github.com/fonttools/fonttools/issues/3527
2024-05-25 09:38:39 -06:00
Behdad Esfahbod
38d190a3cc Black 2024-05-22 18:46:06 -06:00
Behdad Esfahbod
42d6b6b4fe [svgPen] Write two digits after decimal by default 2024-05-22 18:45:28 -06:00
Cosimo Lupo
3e949ed07c
recordingPen: add DecomposingRecordingPointPen to __all__ list for star imports 2024-03-14 09:51:38 +00:00
Cosimo Lupo
d84c74c2ab
[filterPen] add decomposing filter pens 2024-03-05 15:58:41 +00:00
Cosimo Lupo
cccc358c79
[recordingPen] Add DecomposingRecordingPointPen, test new decomposing pen options 2024-03-05 15:58:41 +00:00
Cosimo Lupo
c0074ee26f
[pointPen] add DecomposingPointPen, point-pen eqivalent to DecomposingPen 2024-03-05 15:18:39 +00:00
Cosimo Lupo
e7bd486766
[basePen] add reverseFlipped=False option to DecomposingPen
decomposed components with flipping transform have their path direction reversed, possibly causing dropouts if they overlap other components; this option ensures they will get reversed as they are decomposed (similar to what ufo2ft DecomposeComponentsFilter or Glyphs.app does when decomposing flipped components).

Also we allow specific instances of to set skipMissingComponents differently from the class default value, and add an alias to MissingComponentError so one doesn't need to import it explicitly but can the pen's class attribute.
2024-03-05 15:18:39 +00:00
Khaled Hosny
cf08265cd5 Black 2024-02-06 15:47:35 +02:00
Behdad Esfahbod
0572f78718 [svgPathPen] Add --glyphs 2024-01-30 13:45:25 -08:00
Jens Kutilek
7cdac78423
Add transformRoundFunc parameter to RoundingPens (#3426)
* Add optional transformRoundFunc to RoundingPen and RoundingPointPen
* Add tests
* Add doc about comparing UFO to TTF glyphs
* Use floatToFixedToFloat for example with rounding
2024-01-23 18:59:09 +01:00
Behdad Esfahbod
9afac79105 [lerp_recording] Make into a generator 2023-12-07 04:49:59 -07:00
Behdad Esfahbod
4f6c739181 Move LerpGlyphSet and lerp_recordings to more prominent places
Fixes https://github.com/fonttools/fonttools/issues/3361
2023-12-07 04:49:59 -07:00
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