Simon Cozens
54e307ea6c
Fix docTests
2021-09-23 08:20:51 +01:00
Simon Cozens
ed0cf2fa92
Typo
2021-09-23 08:10:00 +01:00
Simon Cozens
13f6cbdaba
Fix doctests
2021-09-22 16:41:02 +01:00
Simon Cozens
1cc8bf0827
Fix two problems when handling orthogonal lines
2021-09-22 16:28:10 +01:00
Behdad Esfahbod
7a22c0fb07
[ttFont] Add getGlyphIDMany(); use in otLayout
...
Fixes https://github.com/fonttools/fonttools/issues/1536
Superced https://github.com/fonttools/fonttools/pull/1654
Part of https://github.com/fonttools/fonttools/pull/2398
2021-08-21 11:23:11 -06:00
Behdad Esfahbod
3ec769907b
[ttFont] Add getGlyphNameMany()
...
Part of fixing https://github.com/fonttools/fonttools/pull/1654
Related https://github.com/fonttools/fonttools/issues/2334
2021-08-20 16:17:48 -06:00
Behdad Esfahbod
9988054f3c
[ttFont] Remove requireReal
...
To my knowledge this is not used by anyone.
See https://github.com/fonttools/fonttools/issues/2334#issuecomment-902789001
2021-08-20 09:59:47 -06: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
b01ea60e9e
[ttLib] when importing XML, only set sfntVersion if the font has no reader and is empty ( #2376 )
...
* Only set sfntVersion if the font has no reader and is empty
* test that sfntVersion is only set if the TTFont instance is new/empty
2021-07-24 11:12:37 +02:00
Cosimo Lupo
f05691246a
{fixed,round}Tools: factor out nearestMultipleShortestRepr
...
extract the code from fixedToStr into its own function (defined in roundTools), to be used for serializing fractional F2Dot14 angles for COLRv1 PaintRotate etc.
2021-07-06 17:35:03 +01:00
Jany Belluz
bba5e8b213
Add optional compaction of GPOS PairPos subtables in otlLib.optimize.gpos
...
See pull request: https://github.com/fonttools/fonttools/pull/2326
The new module `otlLib.optimize.gpos` provides `compact` functions that
can reduce the file size of GPOS PairPos lookups by splitting subtables
in a smart way to avoid storing zero-valued pairs.
The compaction methods are called from `otlLib.builder` and
`varLib.merger` so that static and variable fonts can benefit from the
optimization at compile time.
The new module `otlLib.optimize` is also executable, to allow running
the optimization on existing fonts.
The optimization is a trade-off because on the one hand it can reduce
significantly the byte size of the GPOS table (up to 50% in random
Google Fonts) but on the other hand it adds to the compilation time and
may make fonts very slightly bigger once compressed to WOFF2 (because
WOFF2 doesn't mind about zero values and compresses them very well).
As such, the optimization is off by default, and you can activate it by
providing the environment variable `FONTTOOLS_GPOS_COMPACT_MODE=5` for
example (values from 0 = off to 9 = max file size savings, but many more
subtables).
2021-07-05 17:28:43 +01:00
Khaled Hosny
383e70fc39
[sstruct] Accept pad byte format character
...
The list of format characters that sstruct accepts was missing “x” for
ignored pad bytes.
2021-07-05 01:33:16 +02:00
Khaled Hosny
bdd462f066
[sstruct] Accept bool format character
...
The list of format characters that sstruct accepts was missing “x” for
ignored pad booleans.
2021-07-03 13:50:08 +02:00
Khaled Hosny
617aee7f03
[sstruct] Minor
...
To reduce the noise in the next commits.
2021-07-03 13:49:53 +02:00
Behdad Esfahbod
f64f0b42f2
Consolidate bit_count / popCount methods
...
Fixes https://github.com/fonttools/fonttools/issues/2331
2021-06-04 10:15:51 -06:00
Behdad Esfahbod
d12d7fbb75
[glyf] Remove unused code
...
Also simplify bounds check.
2021-04-13 15:13:00 -06:00
Behdad Esfahbod
80069e9608
[py23] Make tobytes() always return bytes even for bytearray
2021-04-08 11:13:15 -06:00
Behdad Esfahbod
3a80b56829
[py23] Change tobytes() to accept bytearray
2021-04-08 09:41:45 -06: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
Chris Simpkins
3e252d8c87
[py23] change deprecation warning from "next release" to "future release"
2021-03-20 11:52:12 -04:00
Behdad Esfahbod
062b7c434e
Merge pull request #2214 from fonttools/varLib-round
...
[varLib] Move rounding to VariationModel, to avoid error accumulation from multiple deltas
2021-03-04 16:40:40 -07:00
Behdad Esfahbod
d56b844142
[varLib] Round outline deltas using banker's round as well
...
See https://github.com/fonttools/fonttools/pull/2214#issuecomment-790742479
2021-03-04 13:00:04 -07: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
Behdad Esfahbod
3a9a2bd4b1
[misc.roundTools] Add noRound(), maybeRound(), and roundFunc()
...
Moving out of CFF code, to be used in VariationModel().
Part of https://github.com/fonttools/fonttools/issues/2213
2021-03-04 09:20:43 -07:00
Behdad Esfahbod
abc1ba07a4
[misc.roundTools] New module; move otRound() here
...
Code relying on old place (fixedTools.otRound) still works.
2021-03-04 09:20:43 -07: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
9c9ab5ac3a
removed info-less doc string
2021-02-27 20:05:53 +01:00
justvanrossum
44b7560fe5
move Vector to its own submodule, and rewrite as a tuple subclass
2021-02-27 19:54:53 +01:00
Simon Cozens
a775b6e19c
Fix _aligment_transformation as suggested
2021-02-26 13:13:59 +00:00
Simon Cozens
60c1ee0107
Black whole module
2021-02-26 10:03:37 +00:00
Simon Cozens
1a3478da0e
Fixes from review
2021-02-26 10:03:32 +00:00
Simon Cozens
2ef7964e90
If we swapped the segments, we must swap them back when returning results
2021-02-18 22:12:20 +00:00
Simon Cozens
1795ee98b2
Address various feedback
2021-02-18 14:54:27 +00:00
Simon Cozens
fdceeee0c6
Unnecessary parens
2021-02-18 11:39:46 +00:00
Simon Cozens
c082616c6f
Make hacky uniquifying thing more explicit
2021-02-18 11:39:36 +00:00
Simon Cozens
80a3227f44
Raise error in unknown curve degrees
2021-02-18 11:39:01 +00:00
Simon Cozens
6a223e5f93
Rename parameters
2021-02-18 11:38:40 +00:00
Simon Cozens
2e211194c8
No harm in handling all segment types here
2021-02-18 11:23:24 +00:00
Simon Cozens
c17b1c9e9f
Oops, this has a different interface to the curve-based ones
2021-02-18 11:20:45 +00:00
Simon Cozens
01957a9b94
Intersection and point-at-time functions from beziers.py
2021-02-18 10:49:52 +00:00
Simon Cozens
8e42f693a7
Add function to compute bounding box area
2021-02-18 10:48:09 +00:00
justvanrossum
f416a5cb17
fix Vector division
2021-02-03 20:24:04 +01:00
Cosimo Lupo
822d3bf261
plistlib: remove unused 'type: ignore' comment to appease mypy
2021-01-25 17:42:19 +00:00
justvanrossum
186032cb10
fixed formatting
2020-11-09 15:39:21 +01:00
Nikolaus Waxweiler
0742a9bff3
Implement suggestions
2020-09-21 17:01:22 +01:00