Cosimo Lupo
db70dee031
[macRes] new module and ResourceReader to read Mac resource/data forks
...
inspired by Sascha Brawer's GNU Classpath Java implementation
https://gcc.gnu.org/viewvc/gcc/trunk/libjava/classpath/gnu/java/awt/font/opentype/MacResourceFork.java?view=co&content-type=text%2Fplain
2015-10-26 04:40:00 +00:00
Cosimo Lupo
363893d1fc
[macCreatorType] try to use xattr module if installed
...
xattr is a Python wrapper for extended filesystem attributes, which works
with both Python 2 and 3: https://pypi.python.org/pypi/xattr
2015-10-26 03:49:31 +00:00
Cosimo Lupo
8891e98920
remove MacOS-only misc/homeResFile.py module (no longer used)
2015-10-26 03:34:03 +00:00
Cosimo Lupo
d0b6bdafa0
[psLib] make PSTokenizer indipendent StringIO-like object; fix issues with python3 (bytes vs unicode)
...
PSTokenizer is now an indipendent object behaving like a StringIO.StringIO: it has `read` and `close` methods, as well as `buf`, `pos` and `len` attributes.
The input data is a string of bytes, and the output tokens are ascii-decoded unicode strings.
(I removed "__main__" as it was using a non-py23 EasyDialogs module)
See https://github.com/behdad/fonttools/issues/393 .
Related to https://github.com/behdad/fonttools/issues/391 .
2015-10-22 19:55:33 +01:00
Cosimo Lupo
1c2fe9c37c
[eexec] use bytes instead of str; add doctests to encrypt and decrypt functions
2015-10-22 19:54:53 +01:00
Cosimo Lupo
565d36c511
[psLib] revert to StringIO.StringIO; temporarily drop support for py3
...
Reverts commit bf0e336d316518115a7b47da4f721bb8a009b3e1
Fixes https://github.com/behdad/fonttools/issues/391
...though only temporarily.
2015-10-21 13:14:48 +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
Cosimo Lupo
895c54cf92
[textTools] reduce usage of str concat in pad
function
2015-09-09 09:52:31 +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
Miguel Sousa
a7aef47695
fix "indentation contains mixed spaces and tabs" errors reported by Landscape
2015-08-09 00:33:50 -07:00
Cosimo Lupo
98e47a8746
[textTools] add 'pad' function to pad strings with null bytes
2015-08-07 18:23:41 +01:00
Cosimo Lupo
bf0e336d31
replace all 'StringIO' with 'BytesIO'
2015-08-07 17:25:22 +01:00
Cosimo Lupo
2e058808fe
[py23] define BytesIO, StringIO and 'UnicodeIO' to disambiguate bytes vs unicode in-memory streams
2015-08-07 17:24:42 +01:00
Cosimo Lupo
9f846d3687
[xmlReader_test] test newlines gets normalised by expat parser, unless escaped
2015-07-27 19:24:02 +01:00
Cosimo Lupo
5102353afb
[xmlWriter] escape carriage returns '\r' using XML character entity '&13#;'
...
Fixes https://github.com/behdad/fonttools/issues/318
2015-07-27 12:58:02 +01:00
Cosimo Lupo
fcd31fdf19
[xmlWriter_test] test carriage returns '\r' are escaped with ' '
2015-07-27 12:58:02 +01:00
Cosimo Lupo
13d7d38259
[xmlReader_test] test that xmlReader correctly decodes UTF-8 bytes
2015-07-26 15:34:58 +01:00
Cosimo Lupo
edeb2c6c98
[xmlReader] open file for reading bytes
2015-07-24 16:59:07 +01:00
Cosimo Lupo
76c05ae052
Revert "[xmlReader] always open files using UTF-8 encoding"
...
This reverts commit 6b4567fcde138b069b1323d3127c103d007592cd.
2015-07-24 16:59:06 +01:00
Cosimo Lupo
fbdab03a1d
Revert "[xmlReader] make expat parser use UTF-8"
...
This reverts commit fe76598a80b16ed078606090470f491e4aadb660.
2015-07-24 16:59:06 +01:00
Cosimo Lupo
d7d59c527d
[fixedTools] make sure fixedToFloat function returns float on both python 2 and 3
2015-07-24 16:48:07 +01:00
Cosimo Lupo
fe76598a80
[xmlReader] make expat parser use UTF-8
2015-07-23 17:03:31 +01:00
Cosimo Lupo
6b4567fcde
[xmlReader] always open files using UTF-8 encoding
...
If no "encoding" argument is provided to Python3 `open`, the default plaftorm's encoding (cp1252 on Windows) is used when decoding bytes to unicode strings.
So, we use the `io.open` function (i.e. a backport of Python3 default file interface) with `encoding="utf_8"` argument.
Fixes https://github.com/behdad/fonttools/issues/323
2015-07-23 16:36:48 +01:00
Cosimo Lupo
a54b98f445
add test for stringifyattrs method
2015-07-03 18:20:41 +01:00
mashabow
57e7a6b7a7
[cffLib] Fix encoding of Notice and Copyright values in XML on Python 2
2015-07-03 22:33:17 +09:00
Cosimo Lupo
679fe8965f
[encodingTools] fix typo
2015-06-16 22:44:57 +01:00
Cosimo Lupo
262f0e9017
[timeTools] add timestampSinceEpoch function
2015-06-16 22:44:57 +01:00
Behdad Esfahbod
37e6e6a380
Use dict comprehension now that we don't support Python 2.6
2015-06-11 17:05:15 -07:00
Cosimo Lupo
b1bd77f9f6
fix xmlWriter and _l_t_a_g tests failing on Windows because of \r\n
2015-06-10 10:17:05 +01:00
Behdad Esfahbod
8963f3bbed
Simplify fixedToFloat() a bit more
2015-06-08 17:26:59 -07:00
Behdad Esfahbod
a09d96f6a2
Leave values unchanged in fixed → float → fixed round-trip conversions
...
Fixes https://github.com/behdad/fonttools/issues/286
Fixes https://github.com/behdad/fonttools/pull/287
2015-06-08 11:35:40 -07:00
Sascha Brawer
2019cfa180
Move fixedTools tests to unittests
...
Lifted from https://github.com/behdad/fonttools/pull/287
Adds new roundtrip tests, but they are disabled.
2015-06-08 11:11:36 -07:00
Cosimo Lupo
a29383eb9c
[py23] minor formatting fix
2015-05-08 19:53:15 +01:00
Cosimo Lupo
8ff416f2c5
[py23] simulate "wide" unichr and ord on "narrow" UCS2-only Python 2
2015-05-08 19:28:42 +01:00
Behdad Esfahbod
fdf5f1e6fa
Merge pull request #262 from anthrotype/mac_type
...
[macCreatorType] disable workaround in py27 for setting as well getting
2015-05-07 12:37:56 -07:00
Cosimo Lupo
d16d42a73b
[macCreatorType] disable workaround for setting function for all python versions
2015-05-07 19:07:22 +01:00
Cosimo Lupo
52b45f16b8
[macCreatorType] disable workaround in py27 for setting as well getting
2015-05-07 13:45:59 +01:00
Sascha Brawer
5cda3d4e72
Minor fixes to reduce the number of code smells
2015-05-06 19:17:08 +02:00
Cosimo Lupo
fec197de5a
[macCreatorType] apply workaround only for python 2.6
2015-04-28 16:37:59 +01:00
Behdad Esfahbod
df2906b0ad
Fix a few issues found by landscape.io
2015-04-26 02:17:13 -04: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
cc072eca9f
Use utf_16_be instead of utf_16be
...
That's the canonical name.
https://github.com/behdad/fonttools/issues/236
2015-04-24 12:48:37 -07:00
Behdad Esfahbod
0ac019ca2c
Use native mac_romanian and mac_croatian encodings
...
Apparently they are implemented in Python, just miss aliases.
https://github.com/behdad/fonttools/issues/236
http://bugs.python.org/issue24043
2015-04-24 12:32:56 -07:00
Behdad Esfahbod
d73e707317
Always write encoding as "UTF-8" in XML output
...
Fixes https://github.com/behdad/fonttools/issues/246
2015-04-21 11:07:48 -07:00
Sascha Brawer
dfe0b85b9d
Test that XMLWriter keeps capitalization of passed encoding
...
Unit test for #246
2015-04-21 11:01:01 -07:00
Behdad Esfahbod
aa74114f1d
Use cannonical encoding ids
2015-04-20 18:21:46 -07:00
Behdad Esfahbod
5580c60b64
Fix build
2015-04-20 18:20:04 -07:00