78 Commits

Author SHA1 Message Date
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
31e6bcfc31 [visitor_test] Test defaultStop=True 2022-08-17 14:30:13 -06:00
Behdad Esfahbod
d6bdae1369 [visitor_test] Test enums 2022-08-17 14:27:58 -06:00
Behdad Esfahbod
8fdf4d160e [visitor_test] Add visitor tests 2022-08-16 12:28:26 -06:00
Behdad Esfahbod
fcc4a875dd Rename visitor_test to Snippets/scale-font.py 2022-08-15 12:51:07 -06:00
Behdad Esfahbod
3e82ce1e2d [visitor_test] Take scaleFactor 2022-08-15 12:50:16 -06:00
Behdad Esfahbod
be7df107e2 [visitor_test] Implement glyf table visiting 2022-08-15 12:47:17 -06:00
Behdad Esfahbod
a0686e8d2e [visitor] Add register_attr(s) example 2022-08-15 12:37:38 -06:00
Behdad Esfahbod
e31b214089 [visitor_test] Make it into the start of a font rescaler 2022-08-14 14:43:28 -06:00
Behdad Esfahbod
8fe672c6a2 Add misc.visitor.py
Fixes https://github.com/fonttools/fonttools/issues/1959
2022-07-31 12:27:09 -06:00
Cosimo Lupo
a3f402e036 move build_n_ary_tree to misc/treeTools.py module
so I can import from varLib.merger as well
2022-07-04 23:08:14 +01:00
Cosimo Lupo
af6804bed5 make USE_HARFBUZZ_REPACKER a 3-state option, defaults to auto
if explicitly enabled, it will raise ImportError if uharfbuzz is not found, and will propagate the uharfbuzz error instead of silently falling back to the pure-python serializer
2022-04-21 18:11:20 +01:00
Cosimo Lupo
e9bec87d1a [configTools] Make Option eq=False so cmp/hash by id 2022-04-21 16:21:53 +01:00
Jany Belluz
268fbac85c [config] Add tests 2022-04-14 15:23:22 +01:00
Just van Rossum
169731c7f5
[CFF/T2] Ensure that pen.closePath() gets called for CFF2 charstrings (#2577)
* [CFF/T2] Make sure to call pen.closePath() at the end of a CFF2/T2 charstring. Fixes #2455

* Add test case to verify pen.closePath() behavior
2022-04-09 14:50:59 +02:00
Simon Cozens
d9ce420967 Test for typo case 2021-09-23 08:15:57 +01:00
Simon Cozens
1cc8bf0827 Fix two problems when handling orthogonal lines 2021-09-22 16:28:10 +01:00
Khaled Hosny
232b2ccbc4 Move the rest of py23 module to textTools
Change all imports to use textTools module, except the test_py23.py test
which is kept until we decide to remove the module (if ever).
2021-08-20 01:29:45 +02:00
Cosimo Lupo
9c37862087 add Transform.transformVector method
Adds a transformVector and transformVectors methods to the Transform class. Useful for things like https://github.com/googlefonts/ufo2ft/pull/515
2021-08-03 11:49:44 +02:00
Cosimo Lupo
094a40ca2e Revert "Deprecate and ignore newlinestr"
This reverts commit 5af178ac8eb2da79b965be5c6cee693dad602c65.
2021-08-03 10:00:13 +02:00
Khaled Hosny
5af178ac8e Deprecate and ignore newlinestr 2021-07-30 04:31:19 +02:00
Khaled Hosny
000bf81700 Default to "\n" for newlinestr instead of None
If newlinestr is None, os.linesep is used, bu it is the third millennium
and we don’t need or want different line endings per-platform.
2021-07-30 04:12:33 +02: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
Chris Simpkins
7abf2e4c75
transition basestring to str
https://github.com/fonttools/fonttools/issues/2232
2021-03-27 10:23:29 -04:00
Cosimo Lupo
d80779d71e
py23_test: remove py27 test always skipped now 2021-03-11 18:23:26 +00:00
Just van Rossum
6a8821d91c
Revert "Use Vector in some places where it improves the clarity of the code" (#2215)
* Revert most of "Use Vector in some places where it improves the clarity of the code (#2206)"

This reverts most of commit 0d3ce2cafc6f604fc46d4d3bfbab34a5bc59e27b.
2021-03-04 20:15:24 +01:00
Just van Rossum
0d3ce2cafc
Use Vector in some places where it improves the clarity of the code (#2206)
* Use Vector in some places where it improves the clarity of the code

* add __all__ to vector.py

* turned some list comprehensions into generator expressions: there's no need for an intermediate list in these cases

* Add empty __slots__ to Vector, so we don't waste space on a __dict__.

* add some tests for segmentPointAtT
2021-03-04 15:32:45 +01:00
justvanrossum
44b7560fe5 move Vector to its own submodule, and rewrite as a tuple subclass 2021-02-27 19:54:53 +01:00
justvanrossum
f416a5cb17 fix Vector division 2021-02-03 20:24:04 +01:00
Christof Kaufmann
edbfe95f45 Add test for non-localized date parsing 2020-02-25 20:36:02 +01:00
Nikolaus Waxweiler
641058ead2 Remove PY2 conditional and unicode import 2019-10-12 12:20:22 +01:00
Nikolaus Waxweiler
969df8303b Remove some Python 2 era import gaming 2019-10-11 22:36:33 +01:00
Cosimo Lupo
8500dfca71
psCharStrings_test: test load/dump fixed point numbers 2019-10-08 13:40:04 +01:00
Cosimo Lupo
6fd31d47ec
fixedTools: use simple divison in fixedToFloat; add floatToFixedToStr, strToFixedToFloat, etc.
Fixes #737
2019-10-08 13:40:03 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
1fc1d2f529
[loggingTools] remove unused backport of LastResortLogger
we are not in the business of logging.
2019-06-11 13:39:59 +01:00
Cosimo Lupo
80306037b7
arrayTools: calcIntBounds should use otRound, not round3
Somehow we forgot to replace round -> otRound in arrayTools.calcIntBounds.
This function is used by glyf table to compute the glyphs' bounding boxes.
We already use otRound (aka 'int(math.floor(v + .5))') to round glyph
coordinates upon compiling glyf table. So the use of python3's round
in calcIntBounds was producing inconsistent roundings between the glyph
coordinates and the glyph bbox (sometimes, i.e. only when the glyf table
contains float coordinates, e.g. after instantiating with varLib.mutator).
2019-04-04 12:38:54 +01:00
Miguel Sousa
ddff29cb5d Fix DeprecationWarning: invalid escape sequence 2019-04-01 14:04:14 -07:00
justvanrossum
e22453c933 followup to #1531 2019-03-06 16:47:16 +01:00
Sascha Brawer
6a7e299c09 Fix “DeprecationWarning: invalid escape sequence” in Python 3.7 2019-01-22 16:36:15 +01:00
Rasmus Andersson
4c72b8f781 Change precision to 8 digits to match AFDKO 2019-01-05 11:06:59 -08:00
Rasmus Andersson
768f8ec171 Fixes bug in misc.psCharStrings.encodeFloat and adds test 2019-01-04 15:48:14 -08:00
Nikolaus Waxweiler
3b2bfcf29a Treat Mapping objects as dicts 2018-12-13 15:44:25 +00:00
Cosimo Lupo
081b0fc090
keep fontTools.ufoLib.plistlib compatibility shim
the old readPlist, writePlist are only kept in fontTools.ufoLib.plistlib,
not in fontTools.misc.plistlib
2018-10-18 11:11:34 +01:00
Cosimo Lupo
0cef799a08
move test_{etree,plistlib}.py to misc/{etree,plistlib}_test.py 2018-10-17 17:46:37 +01:00
Miguel Sousa
8d7774a3e8 [pscharstrings] Optimize the charstring's bytecode
by encoding as integers all float values that have no decimal portion.

This optimization is expected to reduce the file size of CFF2 fonts that have intermediate masters.

Related to https://github.com/adobe-type-tools/afdko/issues/444

Many thanks to @cjchapman for the help on the fixed point math
2018-06-29 09:54:00 -07:00
Cosimo Lupo
d9d30c819a
loggingTools: move here the LastResortLogger from py23
and add a small test
2018-06-19 16:54:50 +01:00
Cosimo Lupo
6473cc9349
add more tests for userNameToFilename function
plus minor whitespace
2018-02-28 12:26:52 +00:00
Bill Amidei
ccae4687cc
Moving userNameToFileName to its own file, adding unit test 2018-02-28 11:30:33 +00:00
Cosimo Lupo
232e2b8467
Revert "Merge pull request #1130 from anthrotype/temp-revert-split-glyphs"
This reverts commit 060f856f92e0fb2d8e60f6be080c89c08528bacb, reversing
changes made to 1e42224af741fac73e20f7193d8115cfda7d3594.
2018-02-28 11:24:19 +00:00