60 Commits

Author SHA1 Message Date
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
Behdad Esfahbod
4fec016862 [cff] Fix calcBound when seac-like components happen in endchar
I'm also unimpressed by the copy-pasted bounds logic in hhea and vhea,
and the fact that that's coded in there instead of calling a function
on CFF / glyf tables respectively.
2018-01-26 17:41:53 -08:00
Cosimo Lupo
56a84ae905 Temporarily revert PR #1035 bamidei/split_g_l_y_f_to_one_per_file
The split-glyf-to-one-glyph-per-file feature is only partially implemented,
as it was discussed here:

https://github.com/fonttools/fonttools/issues/153#issuecomment-346677171

I need to cut a bugfix release today, but I don't want to ship this as is.
I prefer to temporarily rever, tag a release from master branch, then
revert it again to its present state so that bamidei can complete his
work.

---

Revert "[glyf] make splitGlyphs output more compact"

This reverts commit d08d635a93289982b028aacd3b9039fbe742f3e8.

Revert "more whitespace"

This reverts commit bd030f61c6b360fd360632bbc6c19abb057c9a24.

Revert "minor whitespace"

This reverts commit f2a8c787b13b92ae0e0f61477e584316144747c7.

Revert "Merge pull request #1035 from bamidei/split_g_l_y_f_to_one_per_file"

This reverts commit 17b89d9dde7691dbbb6815efba92eff446af62ac, reversing
changes made to b8482d9666f08d3603ee93d3ca52931550f715fc.
2017-12-18 12:00:43 +00:00
Cosimo Lupo
bd030f61c6 more whitespace 2017-11-23 19:05:05 +01:00
Cosimo Lupo
f2a8c787b1 minor whitespace 2017-11-23 18:39:11 +01:00
Cosimo Lupo
17b89d9dde
Merge pull request #1035 from bamidei/split_g_l_y_f_to_one_per_file
Add ability to split glyphs to 1 glyph per ttx file.  Issue #153
2017-11-23 18:30:54 +01:00
Bill Amidei
818a4a2d1e Review comment update: Updated white-space and removed unused test data 2017-11-23 07:51:05 -08:00
Bill Amidei
de94613e08 Updates based upon review feedback for glyf to individual files; include table name in contentOnly file; Remove unnecessary parameters from toXML - leaving only the splitGlyphs optional additional parameter 2017-11-23 07:17:35 -08:00
Cosimo Lupo
d3251241be [py23] Add backports for redirect_stdout/stderr context managers 2017-11-07 11:54:28 +00:00
Bill Amidei
11bfd82854 Added xmlReader test for sub_file 2017-10-03 09:07:07 -07:00
Cosimo Lupo
2e4b1d05df [timeTools_test] use pytest.raises to catch ValueError 2017-10-02 14:19:01 +01:00
Khaled Hosny
4b3a2eb1d9 Respect SOURCE_DATE_EPOCH for time stamp
For reproducible builds, check the presence of SOURCE_DATE_EPOCH
environment variable and use it for the time stamp. This affects the
head.modified (and head.created in merge.py).

See https://reproducible-builds.org/specs/source-date-epoch/
2017-10-02 11:37:00 +02:00
Masaya Nakamura
3708f2c8d3 Don't cache charString bounds
https://github.com/fonttools/fonttools/pull/970#discussion_r117903692
2017-08-01 10:54:47 +09:00
Masaya Nakamura
a68bfc2458 [psCharStrings] Add recalcBounds() to T2CharString 2017-08-01 10:51:47 +09:00
Behdad Esfahbod
f056c124e5 [misc.classifyTools] Make classification order stable
Sets don't have a welldefined comparison function, so sort them...

Not the most efficient implementation, but good enough.

Fixes https://github.com/fonttools/fonttools/issues/927
2017-04-18 15:57:14 -07:00
Cosimo Lupo
cca1d20b0e
[loggingTools] added LogMixin class
This is useful to quickly add logging functionality to classes, and
to reduce boilerplate.

It adds a 'log' property to the class inheriting from it, which uses
logging.getLogger to get a logging.Logger (sigleton) object named after
<module>.<class> of self.
2017-04-11 18:40:52 +01:00
Cosimo Lupo
8df708269f
[loggingTools_test] give more time to TimerTest::test_split
timers can be capricious...

https://travis-ci.org/fonttools/fonttools/jobs/195116432#L1265-L1278
2017-01-25 10:07:09 +00:00
Cosimo Lupo
98013fe526
[loggingTools_test] don't assert exact clock times
Windows timer can be imprecise:
https://ci.appveyor.com/project/fonttools/fonttools/build/1.0.419/job/vlpd9qv07384w5sl
2017-01-17 14:12:14 +00:00
Cosimo Lupo
cf5807bb94
[Tests] covert transform doctests into transform_test.py 2017-01-17 13:39:36 +00:00