167 Commits

Author SHA1 Message Date
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01: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
76ba3b423f [ttc] Move to fontTools.ttLib.ttCollection
TTCollection can still be imported from fontTools.ttLib.
2018-01-23 15:46:51 -08:00
Behdad Esfahbod
28cf254c24 [TTFont] Remove explicit closeStream
Not needed.  Python takes care of closing files for us just fine.
2018-01-23 14:22:19 -08:00
Behdad Esfahbod
759c021aab [sfnt] Minor 2018-01-23 13:49:49 -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
1c25445e7b [ttc] Remove hash hack 2018-01-23 13:44:56 -08:00
Behdad Esfahbod
c2d5d87a7c [ttc] Implement minimal list-like methods 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
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
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
justvanrossum
7af33134a2 getBestCmap(): Expanded the list of cmap subtables to search for. Not sure how to implement the rest of Behdad's suggestions from #1092 2017-11-04 07:45:11 +01:00
justvanrossum
4e8295920a return None if no unicode cmap subtables were found 2017-11-03 16:19:48 +01:00
justvanrossum
113f9cc498 add (0, 4) to default cmaps to search for; add getBestCmap() to TTFont as well; added test for the latter 2017-11-03 16:01:45 +01:00
Bill Amidei
b5edc7e9f5 Add ability to split glyphs to 1 glyph per ttx file. Addresses Issue #153 2017-08-23 12:33:25 -07:00
Masaya Nakamura
994337ffe2 [ttLib] Update recalcBBoxes description 2017-08-01 10:51:48 +09:00
Miguel Sousa
9aa3247603 [ttLib] Support CFF2 in getGlyphSet() 2017-07-13 01:13:46 -07:00
justvanrossum
8327d73dee Edge case: Fix logic in choosing CFF vs glyf so we get the correct error if the font has neither. 2017-04-01 14:30:17 +02:00
justvanrossum
5ccc1ec59c removed unneeded slice/copy, leftover when upgrading from .sort() to sorted() 2017-03-31 00:07:03 +02:00
Cosimo Lupo
6ac3523d74
[_TTGlyphSet] fetch height and tsb from vmtx if available
The width and lsb from hmtx are already there

Fixes #893

https://github.com/fonttools/fonttools/pull/880#issuecomment-288558012
2017-03-23 12:51:16 +00:00
Cosimo Lupo
8af488a1b3
Revert "explicitly require 'head' table in TTFont.save()"
This reverts commit b39f3b613c861539f9ae6e18f5064979f7ad6365.

Requiring 'head' makes it hard to build partial fonts

See https://github.com/fonttools/fonttools/pull/854#issuecomment-283177719
2017-02-28 22:48:28 +00:00
Cosimo Lupo
b39f3b613c
explicitly require 'head' table in TTFont.save()
it's implicitly required anyway, e.g. by ttx's ttCompile, maxp's recalc, OS/2 compile, etc.
2017-02-21 12:57:34 +00:00
justvanrossum
9de3d1a5ae tweak comment 2017-02-21 13:47:30 +01:00
justvanrossum
c5aa43238f Make sure to load the 'head' table when recalculating the time stamp. Fixes #847. 2017-02-21 13:45:50 +01:00
Cosimo Lupo
63f5253ec7
[ttLib] don't close stdout in TTFont.saveXML()
otherwise when dumping multiple TTX to standard output it raises:

ValueError: I/O operation on closed file
2017-01-18 12:06:46 +00:00
Cosimo Lupo
d235e124b4 [ttLib] add 'newlinestr=None' kwarg to TTFont.saveXML, passed on to XMLWriter instances 2016-10-20 16:54:31 +01:00
Cosimo Lupo
b1fae3fe32 ttx/ttLib: use from fontTools import version as before 2016-10-10 15:26:04 +01:00
Cosimo Lupo
e0a10698aa [ttLib] must cast 'sfntVersion' to native string type (bytes on py2, str on py3) to normalize repr() output 2016-09-28 18:08:08 +01:00
Cosimo Lupo
5dabba6699 [ttLib] get 'ttLibVersion' from fontTools.version.__version__, but only write MAJOR.MINOR
otherwise it risks changing too often... ;)
2016-09-27 00:28:01 +01:00
Cosimo Lupo
f998cf1126 [ttLib] use boolean instead of int
I know it's same, but this looks more 'pythonic'
2016-02-02 18:26:50 +00:00
Cosimo Lupo
84d6f076a3 [ttLib] call XMLWriter.close() only if 'fileOrPath' is a path, not when it's a file
This allows to call `TTFont.saveXML` with an already open file/stream (e.g. sys.stdout or a StringIO) without it being abruptly closed at the end.

We do the same elsewhere when we reiceive file handles instead of path names, so we might do it here too.
2016-02-02 18:25:43 +00:00
Cosimo Lupo
769efc3d0d [ttLib] replace print statements with logger; deprecate 'quiet' and 'verbose' arguments; deprecate 'debugmsg' func
Previously, when TTX was run in verbose mode, the messages printed to the console would also show the time
each one was logged -- e.g. "blah blah  (15:23:24)" -- using the 'debugmsg' function which is defined here.
Even though the logging package would allow to do the same thing (via 'datefmt' and "%(asctime)s"), I decided
drop this, as I think it's not very interesting...
I'll replace it with the overall elapsed time in seconds, in a follow-up commit.
2016-01-27 19:01:12 +00:00
Cosimo Lupo
81b290a47b [ttLib] raise if saving TTFont to the same input file when lazy is True 2016-01-25 10:21:09 +00:00
Cosimo Lupo
3f7c67ed50 [ttLib] skip reading the whole file in memory if lazy == True
As discussed in #482.
2016-01-25 10:06:52 +00:00
Cosimo Lupo
8bc30bc4d2 ttLib.__init__: replace '>>>' with '>>' in docstring to avoid triggering pytest doctests discovery
the docstring references an example 'afont.ttf' file which obviously doesn't exist.
2015-12-12 18:11:59 +00:00
Cosimo Lupo
9049d5f866 Merge pull request #425 from anthrotype/xmlreader-fileobj
make XMLReader accept file objects
2015-12-08 13:08:19 +00:00
Ben Kiel
e53d2068ca Update doc
Added text for woff2
2015-12-07 13:26:16 -06:00
Cosimo Lupo
af62ebf2b6 ttLib: rename 'fileName' arg to 'fileOrPath' in importXML function for consistency with saveXML method 2015-12-07 18:26:48 +00:00
Cosimo Lupo
d7f6e1df00 [ttLib] remove 'haveMacSupport' flag, allow other platforms to read sfnt resources (from data fork)
On non-Mac filesystems the resource fork is absent.
2015-10-26 03:34:03 +00:00
Cosimo Lupo
e1e2178a52 [ttLib] drop support for pre-OSX "mac" platform
- only check for 'darwin' for 'haveMacSupport'
- remove 'makeSuitcase' arg from TTFont.save();
- don't setMacCreatorAndType
2015-10-25 14:42:43 +00:00
Sascha Brawer
07458f62dd Support non-BMP characters for synthetic glyph names
When a font supplies no glyph names in its 'post' table, fontTools
builds synthetic glyph names by reversing the 'cmap' table.
After this change, the library looks at all 'cmap' subtables for
Unicode, irrespective of format or platform. For example, glyph #4
in NotoSansOldItalic-Regular.ttf gets now named "u10300" instead of
"glyph00004".

Moved the code for building a reversed 'cmap' table into the cmap class,
for easier testing.
2015-09-04 12:20:54 +02:00
Cosimo Lupo
18d02aece9 [ttLib] convert KeyView object to list for py23 compatibility 2015-08-19 17:57:37 +01:00
Cosimo Lupo
3142e3319e add reordersTables() method to SFNTWriter and WOFF2Writer (return True for the latter) 2015-08-19 17:56:46 +01:00
Cosimo Lupo
4fe88a41f3 [TTFont] fix reorderTable logic 2015-08-19 15:47:07 +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
6ba67ab699 [TTFont] changed behaviour of 'reorderTables' argument of save function
Reorder to OT spec recommended order if reorederTables == True (default).
Don't reorder if reorderTables == None.
Keep the input font original table order if reorderTables == False (and
the font has a reader object from which to get the original order).
2015-08-19 14:36:58 +01:00
Miguel Sousa
a7aef47695 fix "indentation contains mixed spaces and tabs" errors reported by Landscape 2015-08-09 00:33:50 -07:00