Caleb Maclennan
705b9663d2
Default checkChecksums to off for SFNT Reader
2020-09-10 16:41:30 +03:00
Cosimo Lupo
02e51072a4
sfnt: must import SimpleNamespace
...
Thanks Zachary for reporting this
7ca42f6623 (commitcomment-39299386)
Amazingly we have no tests for reading TTCs
2020-05-20 09:16:06 +01:00
Cosimo Lupo
72f9e7794a
SFNTReader: define __getstate__/__setstate__ to reopen external file
...
Instead of copying to BytesIO, we can return the file name in getstate and reopen the file in setstate. This keeps the TTFont truly lazy as it avoids the extra copy
2020-05-18 12:41:25 +01:00
Cosimo Lupo
942fbfe07a
sfnt: custom __deepcopy__ not needed with __getstate__
...
also, we only need to copy file to stream when self.file is _not_ already an io.BytesIO.
2020-05-18 11:57:03 +01:00
Cosimo Lupo
d767061e8d
sfnt: add __getstate__ to SFNTReader to make it pickelable
...
Fixes https://github.com/fonttools/fonttools/issues/1962
2020-05-18 11:33:50 +01:00
Simon Cozens
253de13377
Use inheritance to avoid repeated code in WOFF2FlavorData initializer
2020-05-07 21:04:52 +01:00
Nikolaus Waxweiler
01328213c7
Remove __future__ imports
2019-08-09 12:20:13 +01:00
Cosimo Lupo
ce86397f8f
[sfnt] allways copy file data to BytesIO, not just if deepcopy failed
...
on py27, calling deepcopy on a file object doesn't raise TypeError, but leaves
the duplicated file object in an inconsistent state:
https://travis-ci.org/fonttools/fonttools/jobs/474811063#L714
any operations on it will fail with 'ValueError: I/O operation on uninitialized object'.
Thus, for semplicity for now we always do a manual copy the file contents into an
in-memory BytesIO stream, rather than attempting to call deepcopy first.
2019-01-03 11:53:28 +00:00
Cosimo Lupo
560c7558c8
SFNTReader: try deepcopy'ing first, if fails do manual copy of file contents
2018-12-20 14:28:17 +00:00
Cosimo Lupo
4001ded199
override SFNTReader __deepcopy__ for 'file' isn't copyable; use it in varLib
2018-12-20 14:18:59 +00:00
Cosimo Lupo
e02055e070
[sfnt] TTCTag is a str
...
https://github.com/fonttools/fonttools/issues/1207
2018-03-06 10:46:01 +01:00
Cosimo Lupo
e7494cba5b
[sfnt] restore backward compat with 'numFonts' on SFNTReader instance
...
Fixes #1181
2018-02-16 18:15:52 +00:00
Behdad Esfahbod
370368d8c2
[ttc] Implement table sharing in save()
2018-01-25 17:08:30 -08:00
Behdad Esfahbod
0daed6eb59
[ttc] Implement TTCollection.save()
...
Doesn't share tables currently.
2018-01-25 15:33:30 -08:00
Behdad Esfahbod
bd06ecce7c
[ttc] Towards saving TTCs, prep work
2018-01-25 15:08:31 -08:00
Behdad Esfahbod
764e27556d
[ttc] Move tag check
2018-01-25 14:50:46 -08:00
Behdad Esfahbod
49b6004040
Move TTFont into fontTools.ttLib.ttFont
...
Users can still import TTFont from fontTools.ttLib. It was for
cleaning up only.
2018-01-23 16:12:46 -08:00
Behdad Esfahbod
3635926341
[ttc] Drop tableCache from SFNTReader
...
We just need it in TTFont layer itself.
2018-01-23 13:44:56 -08:00
Behdad Esfahbod
22c971aa99
[ttc] Implement object-sharing in TTC loading if sharedTables=True
2018-01-23 13:44:56 -08:00
Behdad Esfahbod
233e46ca38
[ttc] Add fontTools.ttLib.TTCollection()
...
Opens TTC files, no object sharing.
2018-01-23 13:44:56 -08:00
Behdad Esfahbod
524b62a1b2
Add fontTools.ttLib.sfnt.readTTCHeader()
2018-01-23 13:44:56 -08:00
Cosimo Lupo
46d487c728
the Zopfli bindings are finally available from PyPI, change url in the docstring
2017-03-01 14:01:15 +00:00
Cosimo Lupo
2bbc62d371
sfnt.py: drop WOFFDirectoryEntry.zlibCompressionLevel
; use global ZLIB_COMPRESSION_LEVEL
instead
...
Fixes https://github.com/fonttools/fonttools/issues/686
2016-10-02 12:42:54 +01:00
Cosimo Lupo
7fafe1f9a7
[sfnt] add compress function to optionally use zopfli instead of zlib
2016-01-31 14:20:17 +00:00
Cosimo Lupo
967b994449
[sfnt] replace print with logger
2016-01-27 19:01:12 +00:00
Cosimo Lupo
8019069f7c
[sfnt] make SFNTReader.tables an OrderedDict sorted by table offset
...
Fixes https://github.com/behdad/fonttools/issues/408
2015-11-13 17:38:50 +00:00
Cosimo Lupo
3142e3319e
add reordersTables() method to SFNTWriter and WOFF2Writer (return True for the latter)
2015-08-19 17:56:46 +01:00
Behdad Esfahbod
9aed8e1e9d
Merge pull request #270 from anthrotype/woff2_14
...
implement WOFF2 encoder/decoder as standalone module
2015-08-19 15:33:44 +01:00
Cosimo Lupo
099c260b36
[sfnt] use OrderedDict for SFNT{Reader,Writer}.tables dictionaries
2015-08-19 14:36:51 +01:00
Miguel Sousa
a7aef47695
fix "indentation contains mixed spaces and tabs" errors reported by Landscape
2015-08-09 00:33:50 -07:00
Cosimo Lupo
2996c2e308
[sfnt] ovveride __new__ methods of SFNTReader and SFNTWriter to return flavor-compatible instances
2015-08-07 18:23:41 +01:00
Cosimo Lupo
c9ee926356
[sfnt] raise TTLibError if there aren't enough bytes to unpack header
...
Fixes https://github.com/behdad/fonttools/issues/239
2015-05-17 11:07:42 +01:00
Cosimo Lupo
73b9acb5a2
[sfnt] fixed typo: 'checksum' -> 'checkSum'
2015-05-11 17:35:52 +01: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
Cosimo Lupo
4c4c65fac0
[sfnt] fix WOFF checksum adjustment calculation
...
Use 'origLength' and 'origChecksum', instead of 'length' and
'checksum', to calculate the checksum adjustment of WOFF.
2015-04-01 10:25:06 +01:00
Behdad Esfahbod
e02b9ea05b
Fix tests to return failures
2015-03-03 10:47:40 -08:00
Behdad Esfahbod
f192400039
Fix checks; add run-tests.sh
2015-03-03 09:57:41 -08:00
Behdad Esfahbod
b1a8f7f8ec
Remove support for overwriting a table twice in SFNTWriter
...
Was slightly broken already. Remove it as there's no reason
to allow that.
2014-12-01 13:33:19 -08:00
Behdad Esfahbod
62dd7b2a0e
Refactor getSearchRange()
2014-05-27 16:01:47 -04:00
Behdad Esfahbod
9fed95216a
Fix rangeShift calculations for count=0 in sfnt, cmap, and kern
2014-05-27 15:54:04 -04:00
Behdad Esfahbod
6338375bd8
Allow loading zero-length tables
...
Fixes https://github.com/behdad/fonttools/issues/106
2014-01-30 16:48:11 -05: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
9e6ef94b55
Use "is None" instead of "== None"
...
The latter hits the __eq__ method and can fail because we now
do not allow comparing objects of different types.
For example, was failing subsetting Andika-R.ttf.
2013-12-04 16:35:10 -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
e388db566b
py23 Use new-style classes
...
Such that we get the same semantics in both Python 2 and 3.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
821572c9a9
py23 Add bytesjoin()
2013-11-28 17:32:43 -05:00
Behdad Esfahbod
5cf4008336
py23 tostr()/tobytes() and using them
...
ttf->xml seems to be mostly working now.
2013-11-28 17:32:43 -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