269 Commits

Author SHA1 Message Date
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
Behdad Esfahbod
00c89aa9cf Preserve case and other detail of XML encoding passed in
Part of fixing https://github.com/behdad/fonttools/issues/246

Or, should I alsways write "UTF-8" for the sake of consistency?
I think I actually like doing that.
2015-04-20 18:04:47 -07:00
Behdad Esfahbod
42fbc21069 Fix x_mac Chinese names 2015-04-19 04:46:12 -07:00
Behdad Esfahbod
11b93b8491 Use canonical name of Wansung: euc_kr 2015-04-19 04:36:52 -07:00
Behdad Esfahbod
702b94f00a Use canonical Python encoding names 2015-04-19 04:24:55 -07:00
Behdad Esfahbod
e561b758c1 Move getEncoding into fontTools.misc.encodingTools
Logic developed as part of:
https://github.com/behdad/fonttools/pull/208
2015-04-19 03:36:20 -07:00
Behdad Esfahbod
12c3f6ecd4 Docstring 2015-04-19 03:20:02 -07:00
Cosimo Lupo
1b58b828af [bezierTools] fix bug in splitLine function
The function was returning wrong values when the two points are
vertically aligned and the split 'isHorizontal':
Fixes https://github.com/behdad/fonttools/issues/241
2015-04-19 03:10:59 -07:00