38 Commits

Author SHA1 Message Date
Behdad Esfahbod
3eef446efe [ttFont] Address review comments 2021-08-23 16:06:18 -06:00
Behdad Esfahbod
ca06c9530c [ttFont] Assume GlyphOrder is never modified after setting
See https://github.com/fonttools/fonttools/pull/2398#discussion_r694271551
2021-08-23 14:59:11 -06:00
Behdad Esfahbod
d5de11d805 [ttFont] Make setGlyphOrder() clear reverseGlyphOrderMap
Part of https://github.com/fonttools/fonttools/pull/2398
2021-08-23 14:01:26 -06:00
Behdad Esfahbod
e5bf2a7f1a [ttFont] Apply review comments 2021-08-22 04:09:29 -06: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
322a7b2ead [ttFont] Remove allowVID
Leave the parameter intact for back compat.

Part of https://github.com/fonttools/fonttools/pull/2398
Fixes https://github.com/fonttools/fonttools/issues/2334
2021-08-20 10:01:51 -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
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
bf1b480064
Merge pull request #2251 from justvanrossum/improve-ttfont-getitem
[ttLib] Refactored TTFont.__getitem__ somewhat
2021-04-01 12:04:44 +02:00
justvanrossum
c7e736790f TTFont.save: create file on disk only after compilation to tmp stream succeeded. This fixes #536 2021-03-31 15:38:39 +02:00
justvanrossum
6ff4444c41 refactored TTFont.__getitem__ somewhat: don't do major work in an exception handler; factor reading table from file into separate function 2021-03-30 21:26:54 +02: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
0faf01d5f1 [otlLib] Generate Value1 / Value2 if respective formats are non-zero
Previously otlLib was generating None if the values themselves were
empty even if the value format was non-empty.  This happened to work
for compiling to binary since the compiler handles Value=None.

But this was confusing varLib.merger module (as in when building
variable fonts from such otlLib-built master GSUB/GPOS tables, without
roundtripping to OTF/TTF binary first), because in varLib.merger,
a None means "this master doesn't provide that info; skip it"; whereas
in a PairPos table a None as generated by otlLib simply meant "all
values are zero", which is different from "this master doesn't
provide this value".

This fixes that, such that ufo2ft can build variable-font without
saving masters to binary.

Part of https://github.com/googlefonts/ufo2ft/pull/486
2021-03-19 13:59:27 -06:00
Simon Cozens
9cb126b10a Document expected arguments for _TTGlyphSet, _TTGlyph and TTGlyphPen 2021-02-08 11:30:39 +00:00
Caleb Maclennan
7e3c4acfde
Use 0 not False to disable checkChecksums as documented and used
While False does get the job done, the value is not always treated as
a boolean. It is overloaded so that 1 or greater is True, but more than
1 has a different meaning than 1. Hence usage should always be as an
integer as documented so that it's clear(er) this isn't just an on/off
toggle.
2020-09-10 16:41:30 +03:00
Just van Rossum
9064e53c7a
Add registry for custom table packer/unpacker classes (#2055)
* Add custom table packer/unpacker registry

* fix documentation for getTableClass(): it will never return None

* add unregisterCustomTableClass(), mostly for testing
2020-09-09 11:35:06 +02:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Khaled Hosny
e0b517a6e7 A couple ufoLib.pointPen → pens.pointPen 2019-02-14 23:38:11 +02:00
Jens Kutilek
76e7b7a786
Add PointPen support to TT Glyph objects (#1334)
* Add drawPoints method to _g_l_y_f.Glyph
* Add drawPoints method to ttFont._TTGlyph
2018-10-18 11:52:38 +02:00
bgermann
d438f15118
Add missing import 2018-06-28 14:07:14 +02:00
Cosimo Lupo
ca92b172f5
ttFont: allow to build glyph order without post nor cmap, just maxp.numGlyphs
could be useful to read in incomplete sfnt fonts e.g. containing only GPOS or GSUB tables
and a bare maxp table with the numGlyphs
2018-05-06 15:33:18 +01:00
Jens Kutilek
ae4472860f No need to use .keys() 2018-05-04 13:37:59 +02:00
Jens Kutilek
4a16d1839d Add __len__ method to TTFont._TTGlyphSet 2018-05-04 13:12:18 +02:00
Andy Zickler
1e2ee8e15e Add context guard to ttfont 2018-04-03 18:08:52 -04:00
Cosimo Lupo
6473cc9349
add more tests for userNameToFilename function
plus minor whitespace
2018-02-28 12:26:52 +00:00
Cosimo Lupo
232e2b8467
Revert "Merge pull request #1130 from anthrotype/temp-revert-split-glyphs"
This reverts commit 060f856f92e0fb2d8e60f6be080c89c08528bacb, reversing
changes made to 1e42224af741fac73e20f7193d8115cfda7d3594.
2018-02-28 11:24:19 +00:00
Chris Simpkins
5f36f03311 [ttFont] fixes xmlWriter import error in _saveXML method with ttx split tables requests 2018-02-21 12:33:01 -05:00
Behdad Esfahbod
c99a731adb [ttc] Implement saveXML() 2018-01-25 17:50:03 -08:00
Behdad Esfahbod
f82128f25d Kill progress argument
Fixes https://github.com/fonttools/fonttools/issues/1008

Doesn't touch xmlReader / xmlWriter modules.
2018-01-25 17:30:23 -08: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
Cosimo Lupo
1c5e892894
revert closeStream to try fix failing pypy tests
reverts commit 28cf254c
2018-01-24 15:41:19 -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