289 Commits

Author SHA1 Message Date
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
Behdad Esfahbod
b056318ca9 Ignore top four bytes of head table timestamps
Warn instead.
2015-01-02 13:08:57 -08:00
Behdad Esfahbod
15f2bb1e2f Fixup previous commit 2015-01-02 13:02:36 -08:00
Behdad Esfahbod
ee425b4350 Adjust for Python 3.3 change in gmtime() exception type
https://github.com/behdad/fonttools/issues/99#issuecomment-66776810

Fixes https://github.com/behdad/fonttools/issues/99
2015-01-02 12:54:19 -08:00
Behdad Esfahbod
f0200def0c Refactor timestamp code into misc.timeTools 2015-01-02 12:53:16 -08:00
Behdad Esfahbod
d86755bd45 Really fix fixedToFloat() this time
And simplify.  Fixes regression introduced two commits ago.

Fixes https://github.com/behdad/fonttools/issues/205
2014-12-29 11:56:39 -08:00
Behdad Esfahbod
db3b2817bf Add more tests to fixedToFloat(), showing previous commit is broken
Fix coming.
2014-12-29 11:30:48 -08:00
Behdad Esfahbod
97a07ce536 Improve fixedtoFloat()
Fixes https://github.com/behdad/fonttools/issues/205
2014-12-28 23:52:46 -08:00
Behdad Esfahbod
a767e0298b Fix XML reading of True/False after safeEval() revert 2014-09-30 18:54:47 -04:00
Behdad Esfahbod
8388a2e37c Revert "Use ast.literal_eval to implement safeEval"
This reverts commit f5d123be5e342d91c2fa964ddae2844bc633d08e.

Fixes https://github.com/behdad/fonttools/issues/164
See issue for details.
2014-09-24 18:15:51 +03:00
Behdad Esfahbod
03f8ad9dd8 Allow passing encoding to XMLWriter()
We don't support non-UTF-8 encodings, but reinstate the argument
such that existing code, like robofab, continues to work.
2014-08-13 19:06:51 -04:00
Behdad Esfahbod
4af65b0f3d [py23] Minor refactoring 2014-07-21 13:19:53 -04:00
Roozbeh Pournader
365b0bfce1 Add support for dumping XMLs to the standard output. 2014-06-27 15:03:32 -04:00
Behdad Esfahbod
d897eb0486 Micro optimization 2014-06-16 20:35:12 -04:00
Behdad Esfahbod
d06ecc6b25 Use basestring instead of str 2014-06-16 20:30:17 -04:00
Behdad Esfahbod
5598d1de5a [cff] Speed up operand handling
I get ~7% speedup just avoiding a redirection.
2014-06-16 20:23:12 -04:00
Behdad Esfahbod
8d44d79ee2 Minor simplification 2014-06-16 20:23:12 -04:00
Behdad Esfahbod
e3d7d71b7a Allow setting 'raw' attrs on XML for tables to be loaded from hex
Previously one had to set the 'ERROR' attribute.  Accept raw also.
So, for example one can say:

  <cmap raw="1">
    <!-- Hand-coded format13 table mapping all Unicode
         characters to .notdef glyph. -->
    <hexdata>
      0000 0001 <!-- version numTables -->
        0000 0006 <!-- platformID encodingID -->
        0000000C  <!-- offset -->
          000D 0000 <!-- format reserved -->
          0000001C  <!-- length -->
          00000000  <!-- language -->
          00000001  <!-- nGroups -->
            00000001  <!-- startCharCode -->
            0010FFFE  <!-- endCharCode -->
            00000001  <!-- glyphID -->
    </hexdata>
  </cmap>
2014-01-31 18:06:24 -05: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
f5d123be5e Use ast.literal_eval to implement safeEval
Fixes https://github.com/behdad/fonttools/issues/75
2014-01-14 14:59:12 +08:00