Cosimo Lupo
563f32f877
[glyf] add 'padding' attribute to glyf table; assert is in (0, 1, 2, 4)
...
The default (1) keeps the current behaviour (i.e. only pad when we can
use short offsets). Optional values are 0 (no padding), 2 and 4.
2015-09-09 11:15:26 +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
77ffbab995
[glyf] pad glyph data upon compile if self has attribute 'padding'
2015-08-07 18:23:41 +01:00
Cosimo Lupo
4bbe6ef57f
[glyf] fixed 'noname'
2015-05-11 17:37:48 +01: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
4ba27843a9
Fix drawing of glyf's after numpy removal!
...
Should really start adding tests for these...
Fixes https://github.com/behdad/fonttools/issues/238
2015-04-16 03:26:06 -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
0bf67b50bd
[glyf] Implement optimal glyph outline packing; disabled by default
...
Dynamic-Programming-based algorithm. Previously we had a greedy
algorithm only.
Unfortunately the savings are truly negligible. In the order of ~20
bytes for each of the Roboto faces, less so for Noto fonts. Even on
a 20MB font, it produced less than 100 bytes saving compared to our
greedy packing. Either I made a huge mistake, or this is so not worth
it. Anyway, the code is there, but disabled.
2015-03-30 16:47:49 -07:00
Behdad Esfahbod
cd1bc34f89
Simplify glyf packing a bit more
2015-03-30 16:47:48 -07:00
Behdad Esfahbod
c72058623b
Minor
2015-03-30 16:47:48 -07:00
Behdad Esfahbod
630284e31a
Minor
2015-03-30 16:47:48 -07:00
Behdad Esfahbod
0679a7691d
Move glyf coordinate delta packing into new function
2015-03-30 16:47:47 -07:00
Behdad Esfahbod
a40b20d0e0
Minor shuffling of glyf compression code
2015-03-30 16:47:47 -07:00
Behdad Esfahbod
c511745b2e
Work around a Jython bug:
...
>>> import array; array.array("f", array.array("b", [1,2,3]))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can only extend with array of same kind
>>> import array; array.array("f", list(array.array("b", [1,2,3])))
array('f', [1.0, 2.0, 3.0])
2015-03-17 15:32:57 -07:00
Behdad Esfahbod
8ef5adc4af
Move draw() implementation to a better place
2015-01-08 12:28:42 -08:00
Behdad Esfahbod
3715f2d354
Unbreak Python3
...
Fixes https://github.com/behdad/fonttools/issues/197
2014-12-01 13:33:19 -08:00
Behdad Esfahbod
b342a27430
Add glyf.Glyph.trim() that removes padding and if asked hinting
2014-08-15 14:34:03 -04:00
Behdad Esfahbod
5ba7d98a41
[glyf] Only pad glyphs that are odd-lengthed
...
Ouch! Thinko.
2014-07-23 16:36:31 -04:00
Behdad Esfahbod
5ed7d154a9
Turn assert into warning
2014-07-23 16:28:34 -04:00
Behdad Esfahbod
3a10a6546c
[glyf] Don't pad when removing hinting instructions
...
Finishes recent changes.
2014-07-22 21:48:19 -04:00
Behdad Esfahbod
9ab98b2d65
Adjust previous commit
2014-07-22 17:39:17 -04:00
Behdad Esfahbod
eef4daeeaa
Add padding to glyphs only if it makes it possible to use short loca
...
Otherwise don't add padding. This is against the spec, but "should"
work everywhere. The spec only says offsets "should" be padded:
"""Note that the local offsets should be long-aligned, i.e., multiples
of 4. Offsets which are not long-aligned may seriously degrade
performance of some processors."""
We don't add any padded that we absolutely don't have to. Should save
an average of one byte per glyph on large fonts.
2014-07-22 16:00:24 -04:00
Behdad Esfahbod
30ff4ab869
Minor debug output improvement
2014-07-22 15:37:17 -04:00
Behdad Esfahbod
e6adebdc4a
Make glyf-table glyph loading lazy by default
...
When I added the font.lazy setting, I made glyf table non-lazy
by default. This is helpful to users who typically access glyphs
like:
glyf_table.glyphs[glyfname]
instead of the correct way:
glyf_table[glyfname]
and also forget to call expand() on the glyph. However, this
significantly slows down most scripts that load the font without
lazy=True... As such, add a third mode to laziness. By default
lazy=None and does NOT expand glyphs. If lazy=False is passed
in, all glyphs are loaded.
I hope this is an acceptable middle ground and not too confusing.
2014-07-14 20:02:37 -04:00
Behdad Esfahbod
671bca785d
[glyf] Align glyphs at word boundaries, not long
...
Saves two bytes per glyph on average. Or as Roozbeh reports,
70kb in DroidSansFallbackFull.ttf.
2014-07-14 19:53:42 -04:00
Behdad Esfahbod
83a89c123f
Fix isComposite with empty glyphs
...
Was broken in 626107c8.
2014-06-25 19:02:04 -06:00
Behdad Esfahbod
487b15fd94
Add a few __delitem__ implementations
2014-05-14 13:51:10 -06: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
Khaled Hosny
9c573019d5
Fix compiling back Times New Roman font
...
This has been broken since f2c2b4d38bd7bba23db71936262db984e4b7aebb,
assigning a new object to a function argument will not change the
original one, so we need to return the modified list.
2013-12-07 12:08:09 -05:00
Behdad Esfahbod
273a90074a
Return NotImplemented
2013-12-07 03:40:44 -05:00
Behdad Esfahbod
8ea6439d3b
Implement __ne__ when __eq__ is defined
2013-12-06 22:25:48 -05:00
Behdad Esfahbod
dc87372c88
Use True/False instead of 1/0
2013-12-04 21:28:50 -05:00
Behdad Esfahbod
f2c2b4d38b
Improve composite glyph bounds calculation
...
Extend GlyphCoordinates to transparently support float coordinates.
As a result, transformed glyph components now don't have their
coordinates rounded anymore. This slightly changes bounding box
calculations.
There's also code added, but disabled, to calculate exact glyph
bounding box, but we don't seem to actually want that.
2013-12-01 13:36:09 -05:00
Behdad Esfahbod
1336105c31
py23 Use fixedToFloat() in glyf table
...
Sample output:
Before: <component ... scale="0.599975585938" flags="0x1004"/>
After: <component ... scale="0.6" flags="0x1004"/>
Now the Python 2 and 3 outputs agree on these.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
e388db566b
py23 Use new-style classes
...
Such that we get the same semantics in both Python 2 and 3.
2013-11-28 18:53:30 -05:00
Behdad Esfahbod
5f6418d9e1
py23 Turn Unicode XML parsing on; more bytes fixes
2013-11-28 17:32:43 -05:00
Behdad Esfahbod
821572c9a9
py23 Add bytesjoin()
2013-11-28 17:32:43 -05:00
Behdad Esfahbod
b7fd2e1913
py23 Remove uses of __cmp__ and cmp()
2013-11-28 17:32:42 -05:00
Behdad Esfahbod
319c5fd10e
py23 introduce byteord() and use it
2013-11-28 17:32:42 -05:00
Behdad Esfahbod
32c10eecff
py23 from __future__ import division and adjust divisions
2013-11-28 17:32:42 -05:00
Behdad Esfahbod
30e691edd0
py23 from __future__ import print_function
2013-11-27 17:27:45 -05:00
Behdad Esfahbod
7ed91eca1e
py23 import in all nontrivial source files and unused import cleanup
2013-11-27 15:25:00 -05:00
Behdad Esfahbod
14fb031125
Remove most uses of module string
2013-11-27 14:01:44 -05:00
Behdad Esfahbod
b774f9f684
2to3 --fix=types manual additions
...
Don't know why the tool didn't catch these.
2013-11-27 14:01:44 -05:00
Behdad Esfahbod
e5ca79699d
2to3 --fix=map with manual cleanup
2013-11-27 04:38:16 -05:00
Behdad Esfahbod
ac1b435946
2to3 --fix=idioms
2013-11-27 04:15:34 -05:00
Behdad Esfahbod
97dea0a5d0
2to3 --fix=xrange
2013-11-27 03:34:48 -05:00
Behdad Esfahbod
3a9fd30180
2to3 equivalent to --fix=tuple_params
...
I hope I got this all right...
2013-11-27 03:30:21 -05:00