36 Commits

Author SHA1 Message Date
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
df43ae3684 [basePen] Add addVarComposite() to DecomposingPen
Also change AbstractPen's.
2023-02-03 12:37:40 -07:00
Behdad Esfahbod
2e20e47473 [transform] Rename VarTransform to DecomposedTransform 2023-02-03 09:05:55 -07:00
Behdad Esfahbod
69966aa5d7 [BasePen] Add addVarComponent() 2023-02-02 15:25:09 -07:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
22fd6f3eeb [momentsPen] Remove manual editions
Move OpenContourError to basePen.
2022-07-28 14:01:31 -06:00
Simon Cozens
0f03e6529a
[docs] Fix sphinx warnings (#2453)
* Add default auto doc options

* Ensure all references are unique

* Use anonymous links to avoid duplicate references

* Remove default options, fix wrong module name

* Don’t index repeated class

* Remove repeated classes included through automodule

* Fix warnings

* We don’t use our own static directory

* Correctly format XML in docs

* Fix indentation

* Fix overline

* Bring TOC to top

* Fix definition list

* Offset definition lists and examples

* Fix erroneous markup

* Fix markup

* Already included in automodule

* Fix args markup

* Correct markup for example

* Don’t reindex repeated module

* Correct XML code block markup

* Fix markup errors, change example to doctest

* Correct list markup

* Make ttx docstring both valid RST and valid help output

* Various other boring markup fixes

* Fix example indenting

* Make docstring valid RST and valid help output

* Mock import for reportlab

* It’s ok if manual links don’t appear in toctrees

* Oops typo, I guess doctests are useful
2021-12-02 15:31:49 +00:00
Nikolaus Waxweiler
2831096eeb Introduce PenError, use instead of asserts 2021-04-30 17:19:40 +01:00
Just van Rossum
5fc65d7168
Misc py23 cleanups (#2243)
* Replaced all from ...py23 import * with explicit name imports, or removed completely when possible.
* Replaced tounicode() with tostr()
* Changed all BytesIO ans StringIO imports to from io import ..., replaced all UnicodeIO with StringIO.
* Replaced all unichr() with chr()
* Misc minor tweaks and fixes
2021-03-29 11:45:58 +02:00
justvanrossum
2429a187fc Revert ABC changes to Pens, fixes #2198 2021-02-26 20:18:37 +01:00
Nikolaus Waxweiler
8a55182f37 Make NullPen inherit from AbstractPen 2021-02-21 10:20:48 +00:00
Nikolaus Waxweiler
ab1883da1d Turn AbstractPen and AbstractPointPen into ABCs plus typing 2021-02-21 10:20:37 +00:00
Nikolaus Waxweiler
a3acb1426b Remove py23 import 2021-01-29 22:23:27 +00:00
Nikolaus Waxweiler
e0de5a8413 Add MissingComponentError for pens 2021-01-12 15:26:57 +00:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +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
Behdad Esfahbod
6face10ca3 [basePen] Default glyphset to None 2017-02-21 12:01:10 -06:00
Miguel Sousa
a7aef47695 fix "indentation contains mixed spaces and tabs" errors reported by Landscape 2015-08-09 00:33:50 -07:00
Behdad Esfahbod
1ae29591ef from __future__ import absolute_import
Such that our Python 2 is closer to Python 3.

Part of https://github.com/behdad/fonttools/issues/77
2014-01-14 15:07:50 +08:00
Behdad Esfahbod
32c10eecff py23 from __future__ import division and adjust divisions 2013-11-28 17:32:42 -05:00
Behdad Esfahbod
30e691edd0 py23 from __future__ import print_function 2013-11-27 17:27:45 -05:00
Behdad Esfahbod
7ed91eca1e py23 import in all nontrivial source files and unused import cleanup 2013-11-27 15:25:00 -05:00
Behdad Esfahbod
3ec6a25823 2to3 --fix=print with manual fixup 2013-11-27 04:57:33 -05:00
Behdad Esfahbod
cd5aad92f2 2to3 --fix=raise 2013-11-27 02:42:28 -05:00
Behdad Esfahbod
285d7b81d3 [subset] Fixup CFF hint stripping
Two things:

1. Put back glyph width after stripping hints,

2. Ignore what I believe is broken fonts.

I still see glyph width messup.  Debugging.
2013-09-10 20:30:47 -04:00
jvr
91bca42442 merging fixes & changes from delft-sprint-2012
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@611 4cde692c-a291-49d1-8350-778aa11640f8
2012-10-18 12:49:22 +00:00
jvr
a5c92986dd avoid glyphSet.get(): not all glyphsets in use implement it.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@498 4cde692c-a291-49d1-8350-778aa11640f8
2005-04-10 13:18:42 +00:00
jvr
2e4cc02ca3 BasePen should not fail if a base glyph does not exist in the glyph set; added get() method to _TTGlyphSet class
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@497 4cde692c-a291-49d1-8350-778aa11640f8
2005-03-08 09:50:56 +00:00
jvr
23cb200532 Factored out the SuperBezier and TT-implied-point algorithms, as the
may be useful separately from pens.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@448 4cde692c-a291-49d1-8350-778aa11640f8
2003-09-07 09:41:28 +00:00
jvr
40cde70f16 - added endPath() method to the Pen protocol, as a counterpart for
closePath() for *open* sub paths. This allows pen implementations
  to reliably detect the end of a sub path.
- improved various doc strings.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@447 4cde692c-a291-49d1-8350-778aa11640f8
2003-09-06 16:00:03 +00:00
jvr
49b5521f2e ensure that the current point is always set correctly
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@446 4cde692c-a291-49d1-8350-778aa11640f8
2003-09-05 14:18:26 +00:00
jvr
934fe5fb8f - added support for quadratic contours that have NO on-curve points.
- more doco and comments.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@438 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-28 19:30:46 +00:00
jvr
382102645a small tweak
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@415 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-24 17:23:34 +00:00
jvr
82ef2a52c9 wrapped some long lines
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@411 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-23 20:24:42 +00:00
jvr
b369ef33fc Pen stuff, see http://just.letterror.com/cgi-bin/wypy?PenProtocol
Only lightly tested, component support is not tested at all.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@410 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-23 20:19:33 +00:00