2789 Commits

Author SHA1 Message Date
Cosimo Lupo
85f9f442ea [BitmapGlyphMetrics] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
6a92ae085b [woff2] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
967b994449 [sfnt] replace print with logger 2016-01-27 19:01:12 +00:00
Cosimo Lupo
de5dca010b [xmlReader] replace print with logger; deprecate 'quiet' argument 2016-01-27 19:01:12 +00:00
Cosimo Lupo
769efc3d0d [ttLib] replace print statements with logger; deprecate 'quiet' and 'verbose' arguments; deprecate 'debugmsg' func
Previously, when TTX was run in verbose mode, the messages printed to the console would also show the time
each one was logged -- e.g. "blah blah  (15:23:24)" -- using the 'debugmsg' function which is defined here.
Even though the logging package would allow to do the same thing (via 'datefmt' and "%(asctime)s"), I decided
drop this, as I think it's not very interesting...
I'll replace it with the overall elapsed time in seconds, in a follow-up commit.
2016-01-27 19:01:12 +00:00
Cosimo Lupo
0c313bc1d2 [fontTools.__init__] export 'configLogger' in the top-level module to make it easier for clients to import 2016-01-27 19:01:12 +00:00
Cosimo Lupo
1034699a21 [fontTools.__init__] add NullHandler to avoid "no handlers could be found" error. 2016-01-27 19:01:12 +00:00
Cosimo Lupo
317d653125 [loggingTools] module containing tools for adapting the Python logging package to fontTools (and viceversa) 2016-01-27 19:01:12 +00:00
Cosimo Lupo
58601f2218 Merge pull request #267 from anthrotype/uniranges3_merge
[subset] add option to prune unused ulUnicodeRange bits
2016-01-27 19:00:35 +00:00
Cosimo Lupo
ce5d230eef [subset] add --prune-unicode-ranges option (enabled by default) 2016-01-27 18:38:32 +00:00
Cosimo Lupo
328c72f2d8 [OS/2 test] add tests for getUnicodeRanges, setUnicodeRanges and recalcUnicodeRanges 2016-01-27 18:38:32 +00:00
Cosimo Lupo
20d7849697 [OS/2] add Unicode ranges data from OT spec, plus methods to get/set bits manually, or recalc/prune automatically 2016-01-27 18:37:29 +00:00
Cosimo Lupo
e042824b83 Merge pull request #489 from anthrotype/use-open
replace codecs.open with py23.open
2016-01-26 16:22:47 +00:00
Cosimo Lupo
f99a09fdbe [mtiLib] import unicode_literals; use py23.open with utf-8 encoding 2016-01-26 15:45:32 +00:00
Cosimo Lupo
ac56990aad replace all uses of codecs.open with py23.open 2016-01-26 15:45:27 +00:00
Cosimo Lupo
ce15331f6d Merge pull request #488 from anthrotype/io-open
[py23] add wrapper for io.open
2016-01-26 14:44:44 +00:00
Cosimo Lupo
6832b56385 Merge pull request #486 from anthrotype/lazy-file-load
[ttLib] don't load whole input file in memory if 'lazy' is True
2016-01-26 14:39:28 +00:00
Sascha Brawer
ab8f9ee785 [feaLib] Add test case for bug 463
https://github.com/behdad/fonttools/issues/463
2016-01-26 12:45:56 +01:00
Sascha Brawer
6dcddd9e36 [feaLib] Compile test files to binary tables in addition to XML
https://github.com/behdad/fonttools/issues/463
2016-01-26 12:39:41 +01:00
Sascha Brawer
b2e663a1fc [feaLib] Compile lookups after assigning lookup indices
Before this change, feaLib had assigned a lookup index at the same
time as compiling each lookup. For chains, the implicit assumption was
that the chain's targets would always come before the contexual chain.
Normally this was indeed the case, but feaLib (and also makeotf)
sometimes merge several chain targets into one single lookup,
and then this assumption was not true anymore.

In the new version, the lookups get compiled in a separate pass,
after assigning lookup indices.

https://github.com/behdad/fonttools/issues/463
2016-01-26 12:09:52 +01:00
Sascha Brawer
f5af1cf682 [feaLib] Minor: Remove obsolete import statement 2016-01-25 19:46:02 +01:00
Cosimo Lupo
3a537be111 [run-test.sh] fix an issue when calling sys.executable with subprocess in py23_test.py 2016-01-25 18:25:07 +00:00
Cosimo Lupo
b63935c6f8 [py23_test] test py23.open for piping binary data through stdin/stdout 2016-01-25 18:25:07 +00:00
Cosimo Lupo
47bde21b86 [py23] add wrapper around io.open bridging py23 differences 2016-01-25 17:52:45 +00:00
Sascha Brawer
c09e8862c0 [feaLib] Handle contextual chained SinglePos rules
Resolves https://github.com/behdad/fonttools/issues/485.
2016-01-25 16:27:18 +01:00
Sascha Brawer
a7c0b5c78f [feaLib] Implement chained contextual single positioning
https://github.com/behdad/fonttools/issues/485
2016-01-25 15:10:40 +01:00
Sascha Brawer
312136356a [feaLib] Raise FeatureLibError for not-yet-implemented construct 2016-01-25 12:26:23 +01:00
Sascha Brawer
82a444d659 [feaLib] Parse glyph patterns with multiple values
For example, we now recognize `pos one' 1 two' 2 three' 3;`
as a SinglePos statement, like makeotf does.

https://github.com/behdad/fonttools/issues/485
2016-01-25 12:18:17 +01:00
Cosimo Lupo
81b290a47b [ttLib] raise if saving TTFont to the same input file when lazy is True 2016-01-25 10:21:09 +00:00
Cosimo Lupo
3f7c67ed50 [ttLib] skip reading the whole file in memory if lazy == True
As discussed in #482.
2016-01-25 10:06:52 +00:00
Cosimo Lupo
2afa2b07cf Merge pull request #484 from miguelsousa/ttx-minor
[ttx] minor changes
2016-01-25 09:05:29 +00:00
Miguel Sousa
d1a1f1dc69 [ttx] minor addition to options' info 2016-01-24 18:42:41 -08:00
Miguel Sousa
a45a149b21 [ttx] don't print error when command is 'ttx -h' 2016-01-24 18:39:53 -08:00
Behdad Esfahbod
f65f7bbe2b [otBase] Output object index for arrays, when exception occurs
Ie, now we get:
...
    assert 0 <= value < 0x10000, value
AssertionError: (None, 'LookupListIndex', 'SubstLookupRecord[0]', 'ChainContextSubst[1]', 'Lookup[3]', 'LookupList')
2016-01-23 21:30:45 +01:00
Behdad Esfahbod
ba42586548 [inspect] Fix decompiling objects 2016-01-23 21:28:10 +01:00
Cosimo Lupo
b63cbbf070 Merge pull request #480 from khaledhosny/subset-math
Add support for subsetting MATH table
2016-01-23 19:44:23 +00:00
Khaled Hosny
279243202a [subset] Test MATH table 2016-01-23 23:09:22 +04:00
Khaled Hosny
0e1cc9fb73 [subset] Add support for MATH table 2016-01-23 23:00:30 +04:00
Behdad Esfahbod
1fbad696c9 Print out object hierarchy, when an Exception happens while compiling otData tables
The common stacktrace like this:

  File "fonttools/Lib/fontTools/ttLib/__init__.py", line 202, in save
    self._writeTable(tag, writer, done)
  File "fonttools/Lib/fontTools/ttLib/__init__.py", line 631, in _writeTable
    tabledata = self.getTableData(tag)
  File "fonttools/Lib/fontTools/ttLib/__init__.py", line 644, in getTableData
    return self.tables[tag].compile(self)
  File "fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 86, in compile
    self.table.compile(writer, font)
  File "fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 681, in compile
    conv.write(writer, font, table, value)
  File "fonttools/Lib/fontTools/ttLib/tables/otConverters.py", line 354, in write
    value.compile(subWriter, font)
  File "fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 661, in compile
    conv.write(writer, font, table, value, i)
  File "fonttools/Lib/fontTools/ttLib/tables/otConverters.py", line 354, in write
    value.compile(subWriter, font)
  File "fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 661, in compile
    conv.write(writer, font, table, value, i)
  File "fonttools/Lib/fontTools/ttLib/tables/otConverters.py", line 354, in write
    value.compile(subWriter, font)
  File "fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 661, in compile
    conv.write(writer, font, table, value, i)
  File "fonttools/Lib/fontTools/ttLib/tables/otConverters.py", line 277, in write
    value.compile(writer, font)
  File "fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 681, in compile
    conv.write(writer, font, table, value)
  File "fonttools/Lib/fontTools/ttLib/tables/otConverters.py", line 175, in write
    writer.writeUShort(value)
  File "fonttools/Lib/fontTools/ttLib/tables/otBase.py", line 457, in writeUShort
    assert 0 <= value < 0x10000, value
AssertionError: None

now has this as the last line:

AssertionError: (None, 'LookupListIndex', 'SubstLookupRecord', 'ChainContextSubst', 'Lookup', 'LookupList')

which means a value of None was tried for writing a LookupListIndex from a ChainContextSubset...

It's a hack, but a very useful one.
2016-01-23 14:20:33 +01:00
Behdad Esfahbod
929dada533 [otlLib] Minor
These count attrs are redundant and we might remove them in the
future.  To simplify things, always write them as:

  self.XXXCount = len(self.XXX)
2016-01-22 19:57:22 +01:00
Behdad Esfahbod
521d1d0e90 [otlLib] Remove duplicate points in buildAttachPoint() 2016-01-22 19:56:10 +01:00
Behdad Esfahbod
46f16347fb [mtiLib] Port to otl.buildAttachList() 2016-01-22 19:52:19 +01:00
Behdad Esfahbod
223a1c8499 [otlLib] Return None from buildAttachPoint() 2016-01-22 19:51:02 +01:00
Behdad Esfahbod
33eb68e21a [otlLib] Disallow negative pixel-size in buildDevice()
These fields are USHORT.
2016-01-22 19:49:22 +01:00
Behdad Esfahbod
58b49a1a42 [otlLib] change buildDevice API to take dict
Makes more sense.  feaLib can be simplified by storing a dict
as well, but for now just cast.
2016-01-22 19:45:56 +01:00
Behdad Esfahbod
e4328fb612 [otlLib] Return None in a few more places 2016-01-22 19:39:54 +01:00
Behdad Esfahbod
4e13a2268e [otlLib] One more rename 2016-01-22 19:38:20 +01:00
Behdad Esfahbod
aea0ce9ae1 [otlLib] Adapt names to newly agreed scheme 2016-01-22 19:32:45 +01:00
Behdad Esfahbod
564af5a65c [otlLib] Return None if coverage is empty 2016-01-22 19:27:33 +01:00
Behdad Esfahbod
577a1500e5 [mtiLib] Cosmetic 2016-01-22 19:25:14 +01:00