408 Commits

Author SHA1 Message Date
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
Behdad Esfahbod
ba0a3b9abb Revamp name table Unicode handling some more
Part of https://github.com/behdad/fonttools/issues/236

Now we fallback to ASCII for unknown encodings.  Not sure if this might be a bad idea.
The main user-visible difference is that if there's an ASCII-only text in an unknown
encoding, we still "decode" it and use unicode="True" instead of unicode="False".

Or is assuming that any unsupported encoding is ASCII-compatible too intrusive?
2015-04-16 17:09:49 -07:00
Behdad Esfahbod
3619126d26 Use os.linesep for line separator in xmlWriter 2015-04-15 17:41:30 -07:00
Behdad Esfahbod
034ed355de Fix bytes/unicode detection
https://github.com/behdad/fonttools/pull/233
2015-04-15 10:44:39 -07:00
Behdad Esfahbod
8b0152f0a1 Fix XMLWriter to take sinks that accept both bytes() and unicodes()
Fix xmlWriter_test with python3 as well.
2015-04-14 19:07:34 -07:00
Sascha Brawer
2ac42ad3ec Support unittests in addition to doctests
The Python libraries come with two ways of writing unittests:
module unittest, and module doctest. In some cases, unittest
is more natural (less cumbersome) than doctest.

Wrote tests on xmlWriter for illustration.
2015-04-14 17:52:17 -07:00
Behdad Esfahbod
7c9ab300c2 Add standard imports to all python sources
Previously, the trivial files didn't have them.
2015-04-14 17:26:59 -07:00
Behdad Esfahbod
4458f363e3 [ttx] Write out name table entries as Unicode when possible
https://github.com/behdad/fonttools/issues/54

There's a new attribute named unicode that can choose whether the
text in the XML entry is to be interpretted as Unicode, or as the
target encoding.
2015-04-07 17:52:51 -07:00
Behdad Esfahbod
467a0369e4 Fix test on Python 2.6 2015-03-03 16:05:25 -08:00
Behdad Esfahbod
1296c7457e Make tests pass with Python3
In python3, str(float) is noisy.  Always format floats using "%g".
2015-03-03 15:54:37 -08:00
Behdad Esfahbod
e02b9ea05b Fix tests to return failures 2015-03-03 10:47:40 -08:00
Behdad Esfahbod
f192400039 Fix checks; add run-tests.sh 2015-03-03 09:57:41 -08:00