Nikolaus Waxweiler
d584daa8fd
Blacken code
2022-12-13 11:26:36 +00: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
Chris Simpkins
791f619029
refactor array.tostring to array.tobytes
...
the array.tostring method is deprecated
2019-08-29 23:21:22 -04:00
Nikolaus Waxweiler
01328213c7
Remove __future__ imports
2019-08-09 12:20:13 +01:00
justvanrossum
1828dae78a
Use raw strings for regex patterns. Fixes #1389
2018-12-05 12:46:36 +01:00
Nyshadh Reddy Rachamallu
512bccf49e
Add IDEF for GETVARIATION opcode
2018-11-15 15:18:03 -05:00
Cosimo Lupo
f9071139b1
[ttProgram] don't write empty <assembly> or <bytecode> elements
...
That means that, when reading from XML, we fallback to empty lists in case 'assembly' or 'bytecode' attrs are not there.
2017-01-24 14:35:46 +00:00
Cosimo Lupo
499bc960f9
[_g_l_y_f/ttProgram] Move writer.newline() to Program.toXML()
2017-01-24 14:35:46 +00:00
Jens Kutilek
bbc9f63627
Use indentation amount from XMLWriter.indentwhite
2017-01-24 13:07:20 +01:00
Jens Kutilek
bec499ac05
Indent XML output for TT assembly instructions
...
Indentation for TTX XMLF is 2 spaces. I chose 4 spaces for indentation of instructions to make it more noticeable. I hope it’s not a problem, because assembly code lines are usually very short.
2017-01-23 16:10:48 +01:00
schriftgestalt
b09c5baa15
Disable optimisations when decompiling TrueType instructions
2016-03-20 22:26:22 +01:00
Cosimo Lupo
35c46aa0e2
[ttProgram] add __eq__ and __ne__ methods to Program class
2016-03-11 15:10:50 +00:00
Cosimo Lupo
48db539c44
[ttProgram] replace print with logger
2016-01-27 19:02:48 +00:00
Cosimo Lupo
cef10ec654
[ttProgram] if can't disassemble bytecode, warn and dump toXML as it is
...
Fixes https://github.com/behdad/fonttools/issues/347
2015-09-24 09:32:49 +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
3a856eeef8
[ttProgram] add doctests for __bool__ method
2015-06-25 19:22:42 +01:00
Cosimo Lupo
ea9c2faecd
[ttProgram] add __bool__ and __nonzero__ methods to Program
2015-06-25 19:03:39 +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
Behdad Esfahbod
9db2ace931
Fix ttProgram test for Python3
2015-04-14 13:25:19 -07:00
Behdad Esfahbod
2702a5b879
Hook up ttProgram tests to doctest
2015-04-14 11:51:03 -07:00
schriftgestalt
adfe7f293a
add some missing return values
2015-01-08 09:46:13 -08:00
Behdad Esfahbod
a0dfcb496e
Align instruction comments at tab stop
...
Makes them much more readable.
2015-01-05 17:49:38 -08:00
schriftgestalt
5d66d59a1f
Add comments with names of TrueType instruction to assembly
2015-01-05 17:45:09 -08:00
Behdad Esfahbod
a36c74e8b8
Add logic for keeping PUSHB/PUSHW distinction
...
And avoid merging consequent pushes. No option to control this
externally right now, but the logic is there.
Part of https://github.com/behdad/fonttools/issues/92
2014-01-19 17:30:19 +08: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
42d305a824
Further adjustment
2013-12-17 05:10:30 -05:00
Behdad Esfahbod
fcc56e637a
Choose most compact representation when writing PUSH instructions
...
Can use some testing...
2013-12-17 05:06:37 -05:00
Behdad Esfahbod
965c87fb4a
When disassembling, merge multiple PUSH ops
...
Fonts typically have multiple consecutive PUSHB / PUSHW
operators. Merge them in the disassembled output.
This, for now, generates worse assmebly because all PUSHB's
grouped with PUSHW's now generate as PUSHW. Followup fix
will address that.
2013-12-17 04:19:14 -05:00
Behdad Esfahbod
ce84d3215e
Generate PUSH mnemonic for PUSHB/NPUSHB/PUSHW/NPUSHW
...
Reduces XML noise while reenabling the optimization
during assembly.
Fixes https://github.com/behdad/fonttools/issues/73
2013-12-17 04:02:10 -05:00
Behdad Esfahbod
3714c78c92
When writing PUSH instructions, obey requested opcode
...
Previously fonttools was choosing between the optimal opcode
from PUSHB, NPUSHB, PUSHW, and NPUSHW. We now respect
whatever was requested and err if the format doesn't support
the data.
Morevoer, if the number of numbers to push is more than 255,
we add multiple push instructions to push all the numbers.
Finally, add a new pseudo-opcode "PUSH" that automatically
chooses the best format.
This, by itself, reduces roundtrip noise by not optimizing
the bytecode as it was before. In a followup commit I'll
change the bytecode disassembler to always produce PUSH
in the textual instructions instead of the four variants.
That way, we get both the optimization during assembling,
and reduced noise in XML.
Part of https://github.com/behdad/fonttools/issues/73
2013-12-17 04:00:01 -05:00
Behdad Esfahbod
6d658cf0ea
Minor
2013-12-07 16:06: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
18316aa769
ps23 More bytes fixes. All ''join()'s fixed
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
Behdad Esfahbod
7ed91eca1e
py23 import in all nontrivial source files and unused import cleanup
2013-11-27 15:25:00 -05:00
Behdad Esfahbod
14fb031125
Remove most uses of module string
2013-11-27 14:01:44 -05:00
Behdad Esfahbod
3ec6a25823
2to3 --fix=print with manual fixup
2013-11-27 04:57:33 -05:00
Behdad Esfahbod
ac1b435946
2to3 --fix=idioms
2013-11-27 04:15:34 -05:00
Behdad Esfahbod
3a9fd30180
2to3 equivalent to --fix=tuple_params
...
I hope I got this all right...
2013-11-27 03:30:21 -05:00
Behdad Esfahbod
dc7e6f3e55
2to3 --fix=repr
2013-11-27 02:44:56 -05:00
Behdad Esfahbod
cd5aad92f2
2to3 --fix=raise
2013-11-27 02:42:28 -05:00
Behdad Esfahbod
180ace6a5f
2to3 --fix=ne
2013-11-27 02:40:30 -05:00
Behdad Esfahbod
fc4f438496
Fix parsing of hinting instructions that end in a PUSHB
...
Sounds useless, but MReifutaiM-Regular.ttf seems to have that, and the
parsing back from XML was failing because we expected a token whereas
after dropping whitespace there wasn't any left.
2013-11-18 16:06:01 -05:00
Behdad Esfahbod
67fef70631
Support decode/encoding of unknown glyf hinting instructions
...
New instructions can be defined in the prep program. We don't
check that the "unknown" instruction was actually defined. Just
pass it through.
Fixes ttx with Skia.ttf on the Mac OS X.
Fixes https://github.com/behdad/fonttools/issues/21
2013-11-14 20:25:21 -05:00
Behdad Esfahbod
4ff7712131
Restructure code
...
In anticipation of upcoming change.
2013-11-14 20:16:41 -05:00
Behdad Esfahbod
4fab60ca5b
Remove unused instruction name propagation
...
No functional change whatsoever.
2013-11-14 20:14:10 -05:00