Nathan Williis
21d04842f8
Docs: fix code-example blocks in ttLib.
2024-09-03 17:55:02 +01:00
Cosimo Lupo
335a1e56ec
re-run black v23.10 on all .py files
2023-11-03 10:25:15 +00:00
Ben Kiel
d11a67010f
privData needs to pad with bytes not str
2023-05-25 10:30:28 -05:00
Nikolaus Waxweiler
d584daa8fd
Blacken code
2022-12-13 11:26:36 +00:00
Behdad Esfahbod
a639516c4c
[ttLib] Add main
...
Just opens font files from commandline.
2022-11-01 11:18:56 -06:00
Simon Cozens
e0dc30aa2d
[docs] Improve documentation for fontTools.ttLib.ttFont ( #2442 )
2021-11-18 13:06:02 +00:00
Antonio Cavedoni
e3338bc837
Removed comment about missing “start” optional argument to calcChecksum
2021-11-11 10:09:19 +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
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