42 Commits

Author SHA1 Message Date
Behdad Esfahbod
089afcbccd [arrayTools] Allow None bounds in updateBounds 2023-10-13 13:13:26 -04:00
Cosimo Lupo
92fbac8a64
[arrayTools] add quantizeRect 2023-03-08 19:03:50 +00:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Behdad Esfahbod
d12d7fbb75 [glyf] Remove unused code
Also simplify bounds check.
2021-04-13 15:13:00 -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
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
justvanrossum
44b7560fe5 move Vector to its own submodule, and rewrite as a tuple subclass 2021-02-27 19:54:53 +01: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
Simon Cozens
76902b7129
[docs] fontTools.misc.* part 1 (#1956)
* Document misc.arrayTools
* Document misc.bezierTools
* Document cliTools
* Document eexec
2020-05-19 09:51:17 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +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
Cosimo Lupo
f1049dcaa5 [arrayTools] fix undefined name in Vector._unaryOp
Thanks Miguel
ab02ce49d3 (commitcomment-25599266)
2017-11-14 11:23:12 +00:00
Cosimo Lupo
8afa763ad2 [arrayTools] fix mixed indentation
This particual file originally contained spaces, so we revert to that...
sorry.
2017-10-11 21:13:23 +01:00
Cosimo Lupo
558dad9028 [arrayTools] add function to iterate over pairs in iterable 2017-10-11 20:43:08 +01:00
Behdad Esfahbod
ab02ce49d3 Implement more ops for arrayTools.Vector
Would be nice to add tests for these...
2017-10-10 13:06:15 +02:00
Behdad Esfahbod
c91f0323db Rename CVTValues to arrayTools.Vector
This is generic, and useful in other cases.
2017-10-10 12:43:15 +02:00
Cosimo Lupo
e634005bd9
[arrayTools] no need to cast round(v) to int()
as we are using python3 round
2017-01-17 13:39:34 +00:00
Behdad Esfahbod
e53764a16d In calcIntBounds(), round values
The glyph coordinates in glyf table are going to be rounded when
writing out, so we should use the same mode of conversion to
integers.  Otherwise the xMin of a glyph might end up being
different from its actual minimum X.
2016-06-07 15:47:02 -07:00
Behdad Esfahbod
b30e12ae00 More whitespace 2015-04-26 02:01:01 -04:00
Behdad Esfahbod
bd67253118 Some more whitespace fixes from pep8 tool 2015-04-26 01:59:01 -04:00
Behdad Esfahbod
e02b9ea05b Fix tests to return failures 2015-03-03 10:47:40 -08: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
dc87372c88 Use True/False instead of 1/0 2013-12-04 21:28:50 -05:00
Behdad Esfahbod
153ec40209 Fix a few pychecker warnings
Fixes https://github.com/behdad/fonttools/issues/58
2013-12-04 01:15:46 -05:00
Behdad Esfahbod
f2c2b4d38b Improve composite glyph bounds calculation
Extend GlyphCoordinates to transparently support float coordinates.
As a result, transformed glyph components now don't have their
coordinates rounded anymore.  This slightly changes bounding box
calculations.

There's also code added, but disabled, to calculate exact glyph
bounding box, but we don't seem to actually want that.
2013-12-01 13:36:09 -05: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
3a9fd30180 2to3 equivalent to --fix=tuple_params
I hope I got this all right...
2013-11-27 03:30:21 -05:00
Behdad Esfahbod
843ffd8c79 Port glyf coordinates from numpy to custom type 2013-08-19 14:17:11 -04:00
Behdad Esfahbod
4f033683ca Port glyf transform from numpy to lists 2013-08-19 14:17:11 -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
1b7d54fedc converted usage of Numeric to numpy
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@537 4cde692c-a291-49d1-8350-778aa11640f8
2008-03-04 15:25:27 +00:00
jvr
41144b9306 - moved Numeric import to top
- converted tests to doctest


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@534 4cde692c-a291-49d1-8350-778aa11640f8
2008-03-04 14:47:11 +00:00
jvr
fc3879e463 - renamed all l,t,r,b tuff to xMin, yMin, xMax, yMax
- added ome more doc strings
- added some minimal test code


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@441 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-29 19:29:46 +00:00
jvr
182a7ba7be two new functions
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@395 4cde692c-a291-49d1-8350-778aa11640f8
2003-06-29 18:18:54 +00:00
Just
deb3b632f4 Two new functions:
- vectorLength(vector): calculate the length of a vector
- asInt16(): round and cast any array (or number) to 16 bit ints


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@69 4cde692c-a291-49d1-8350-778aa11640f8
2000-01-26 19:32:45 +00:00
Just
02a739a0d5 new functions: unionRect() and rectCenter()
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@67 4cde692c-a291-49d1-8350-778aa11640f8
2000-01-23 19:10:27 +00:00
Just
b3026bad35 added intRect() function. Turn any rect into a rect using ints only.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@66 4cde692c-a291-49d1-8350-778aa11640f8
2000-01-22 00:26:07 +00:00
Just
be7163c428 added a bunch of rectangle tools that mimic some Qd.*Rect functions, like Qd.InsetRect.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@62 4cde692c-a291-49d1-8350-778aa11640f8
2000-01-18 22:29:39 +00:00
Just
470b5050ee yet another reorganization round...
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@58 4cde692c-a291-49d1-8350-778aa11640f8
2000-01-16 20:37:11 +00:00