33 Commits

Author SHA1 Message Date
Behdad Esfahbod
7fadfa4e81 Revert "refactor: pass isfinal argument spelled-out not a number"
This reverts commit 6d65a87301b6c746ae0ec1dc1cf0df75c0c21d63.

https://github.com/fonttools/fonttools/pull/3669#issuecomment-2428475144
2024-10-22 01:34:48 -06:00
Robin
6d65a87301 refactor: pass isfinal argument spelled-out not a number 2024-10-22 01:28:05 -06:00
Robin
505c6e1fa3 set isfinal to true to enable xml parser to free resources 2024-10-22 01:28:05 -06:00
Nikolaus Waxweiler
d584daa8fd Blacken code 2022-12-13 11:26:36 +00:00
Cosimo Lupo
ade9ce1173 [testTools] FakeFont needs a cfg attribute too 2022-04-21 15:56:11 +01:00
Cosimo Lupo
7ee2c9d891 testTools: factor our method to strip variable items from ttx dumps
it was scattered here and there, so define it once and reuse everywhere needed
2022-04-05 18:34:30 +01:00
Cosimo Lupo
8d6a7617a2 minor: fix 4-space indentation from PR 2441 2021-11-08 12:27:26 +00:00
Rod S
7dd3488732 Traverse when there is no layer list 2021-11-06 14:26:27 -07: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
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
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
justvanrossum
f7f01b3c1a add getGlyphNames() to FakeFont 2020-04-29 16:31:30 +02:00
Nikolaus Waxweiler
969df8303b Remove some Python 2 era import gaming 2019-10-11 22:36:33 +01:00
Nikolaus Waxweiler
01328213c7 Remove __future__ imports 2019-08-09 12:20:13 +01:00
Cosimo Lupo
9557c6a229
fix deprecation warnings when using ABC from collections module 2018-10-18 18:12:43 +01:00
Miguel Sousa
432d9b4034 [misc.testTools] boilerplate unittest classes 2018-02-23 03:02:06 -08:00
Miguel Sousa
603e942f4c [misc.testTools] tabs to spaces 2018-02-23 03:02:06 -08:00
Miguel Sousa
dd5b52404c [misc.testTools] minor 2018-02-23 03:02:06 -08:00
Sascha Brawer
57f01b27cb [morx] Preliminary code for writing AATLookups
Needs more work.
2017-08-14 21:34:15 +02:00
Sascha Brawer
e8530360bd [name] Add helper for building multi-lingual names
Fixes https://github.com/fonttools/fonttools/issues/921.
2017-04-19 02:26:32 +08:00
Sascha Brawer
155ec67ae6 [cvar] Implement cvar table 2017-01-10 17:57:04 +01:00
Behdad Esfahbod
6c140cbba1 [testTools] Move MockFont from mtiLib to testTools
This is useful for testing beyond just mtiLib.
2016-12-26 14:34:29 -05:00
Cosimo Lupo
dd5e9a8a28
testTools: fix failing tests on Python 3.4
Apparently b"string %s" % (b"interpolation") works on Python 3.5 but not on 3.4.

We whall maybe start thinking about dropping support for 3.4, now that 3.6 is out next week...
2016-12-21 14:12:43 +00:00
Cosimo Lupo
540f0c32b4
testTools: getXML returns a list of strings; parseXML also accepts both a string or list of strings
When writing unit tests for XML data, it is more convenient to compare
list of lines, instead of a single string without newlines.

This helps identifying which lines in the diff printed on the console
don't match the expected result.

So, getXML now returns a list of lines,

To allow passing the same list of lines to the complementary parseXML
function in the roundtrip tests, parseXML now also accepts a list of
strings, as well as a single string.

We also use unicode_literals, and ensure that if the test modules passes
unicode str, we first encode to UTF-8 before passing on to expat XML
parser. This is because on Python 2, expat only accepts bytes strings.
2016-12-21 13:57:33 +00:00
Sascha Brawer
59368c424a WIP: Implement STAT table 2016-12-02 13:37:42 -08:00
Cosimo Lupo
2552d224a3 [testTools] use 'newlinestr' for makeXMLWriter() helper function 2016-10-20 16:57:49 +01:00
Sascha Brawer
0588502771 Add otConverters.NameID (#708)
When writing XML, this produces a comment with the English name.
If the name ID is missing from the name table, it logs a warning.
2016-10-14 21:04:35 +02:00
Sascha Brawer
0f8882bcc3 [otlLib] Move creation of ValueRecords from feaLib to otlLib 2016-01-14 16:27:04 +01:00
Sascha Brawer
582852119c Implement OTTableReader.readUShortArray()
There is currently only one single call site in the codebase,
but this function will be needed a lot for parsing `morx` and
other AAT tables.
2015-10-17 06:47:52 +02:00
Cosimo Lupo
cb36478d4b [testTools] add getXML function to get the XMLWriter content as string 2015-09-30 20:19:35 +01:00
Sascha Brawer
d63885e337 [otTables] Use XML snippets for testing fromXML() methods
This should make the unit tests more readable, and it also prevents
failures where a changed fromXML() implementation fails to ignore
interspersed whitespace. This has recently caused some developer
nuisance; see https://github.com/behdad/fonttools/pull/367.

Instead of having a custom parser implementation, it would be nicer
to call the actual XMLReader. However, XMLReader has a deeply built-in
assumption that it is processing an entire TTX file. Changing this
assumption would certainly be possible, but it would need a re-write
of the XMLReader code; having a custom parser just for unit tests
seems less involved.
2015-09-11 15:44:29 +02:00