1038 Commits

Author SHA1 Message Date
Olivier Berten
149b9f97e3 use array instead of unpack 2014-01-28 20:59:10 +01:00
Olivier Berten
4a73f8b4e9 'post' format 4.0 support 2014-01-28 14:37:15 +01:00
Behdad Esfahbod
27c71f9f60 Retain hinting for first font
Part of https://github.com/behdad/fonttools/issues/95
2014-01-27 21:01:45 -05:00
Behdad Esfahbod
a36c74e8b8 Add logic for keeping PUSHB/PUSHW distinction
And avoid merging consequent pushes.  No option to control this
externally right now, but the logic is there.

Part of https://github.com/behdad/fonttools/issues/92
2014-01-19 17:30:19 +08:00
Behdad Esfahbod
fea81ee2b3 Use Python's unicodedata.name() in fontTools.unicode
This removes our internal copy of Unicode names database!

Adds new API fontTools.unicode.setUnicodeData() that can be
called with a filename or file object corresponding to a
UnicodeData.txt file, which will consequently used for Unicode
character name mapping.  This is useful for using newer Unicode
database than the one that comes with the builtin Python module.

This also changes behavior such that control characters, Hangul
syllables, Han chars, etc, get no name with custom
UnicodeData.txt.  We may revisit this though.

Filed https://github.com/behdad/fonttools/issues/82 to add
option to ttx to pass custom UnicodeData.txt.

Fixes https://github.com/behdad/fonttools/issues/81
2014-01-15 23:38:08 +08: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
Behdad Esfahbod
972af5af63 [merge] Sort script records 2013-12-31 18:16:36 +08:00
Behdad Esfahbod
233663207d [merge] Minor 2013-12-31 18:12:53 +08:00
Roozbeh Pournader
642eaf135d Properly merge head.flags and OS/2.fsType
Also install the merge script.
2013-12-22 15:33:25 -05:00
Behdad Esfahbod
95f795f40a Move offset overflow fixing logic where it belongs 2013-12-20 21:52:28 -05:00
Behdad Esfahbod
35e3c7270d Minor 2013-12-20 21:34:09 -05:00
Behdad Esfahbod
b76d6ff14a [merge] Remove BaseTable.__hash__ need 2013-12-20 20:24:27 -05:00
Roozbeh Pournader
7a27214fcb Added merging tables for 'name' and 'gasp'. 2013-12-20 20:13:55 -05:00
Behdad Esfahbod
398770d51c [merge] Map GSUB/GPOS feature / lookup indices properly 2013-12-19 15:30:24 -05:00
Behdad Esfahbod
c68c0ff12f [merge] Minor 2013-12-19 14:25:17 -05:00
Behdad Esfahbod
2642934116 [merge] Add GSUB/GPOS
Doesn't renumber features / lookups yet.
2013-12-19 11:53:47 -05:00
Behdad Esfahbod
9c5e2ce1b6 Add a get() method to TTFont ala dict.get() 2013-12-19 11:38:56 -05:00
Behdad Esfahbod
12dd547c01 [merge] Port GDEF to mergeMap
There's some code duplication in mergeObjects that I'll refactor
later.
2013-12-19 05:58:57 -05:00
Behdad Esfahbod
92fd566577 [merge] Use NotImplemented as a singleton meaning "doesn't have"
And cleanup recalculate, so we don't accidentally mess something
that is NOT recalculated.
2013-12-19 05:27:53 -05:00
Behdad Esfahbod
6baf26ea74 [merge] Rename 2013-12-19 04:49:07 -05:00
Behdad Esfahbod
3b36f55adf [merge] Move tables out of merger object 2013-12-19 04:45:17 -05:00
Behdad Esfahbod
9e6adb6bd6 [merge] Move to per-class mergeMap 2013-12-19 04:37:48 -05:00
Behdad Esfahbod
db2410a2f1 [merge] Minor 2013-12-19 03:42:35 -05:00
Behdad Esfahbod
49028b3ba7 [merge] Minor cleanup 2013-12-18 17:36:18 -05:00
Roozbeh Pournader
e219c6c76f [merge] Update 'head', 'hhea', 'OS/2', and 'post' tables with new logic. 2013-12-18 17:25:37 -05:00
Roozbeh Pournader
47bee9cfbd [merge] Created new infrastructure for table merging logic 2013-12-18 17:22:19 -05:00
Behdad Esfahbod
f63e80e3fc [merge] py23 2013-12-18 17:14:26 -05:00
Behdad Esfahbod
fc1d0525b6 Merge branch 'merge' 2013-12-18 17:09:45 -05:00
Behdad Esfahbod
ee6340f475 Only track one parent per Writer
We were not using the extra parents anyway.
2013-12-17 06:31:37 -05:00
Behdad Esfahbod
ab0ca1bd6b Minor simplification 2013-12-17 06:19:15 -05:00
Behdad Esfahbod
6188b5b5f0 Remove unused variable 2013-12-17 06:11:41 -05:00
Behdad Esfahbod
dea08f2ba1 Minor optimization 2013-12-17 06:04:28 -05:00
Behdad Esfahbod
45ed572e31 [subset] Fix up from recent changes 2013-12-17 06:01:08 -05:00
Behdad Esfahbod
f6502635b9 Minor 2013-12-17 05:59:05 -05:00
Behdad Esfahbod
9e482332ba Fix subtable-split logic
Though, the split logic isn't implemented for GPOS, so I have not
been successful in actually exercising it so far.
2013-12-17 05:46:51 -05:00
Behdad Esfahbod
42d305a824 Further adjustment 2013-12-17 05:10:30 -05:00
Behdad Esfahbod
fcc56e637a Choose most compact representation when writing PUSH instructions
Can use some testing...
2013-12-17 05:06:37 -05:00
Behdad Esfahbod
965c87fb4a When disassembling, merge multiple PUSH ops
Fonts typically have multiple consecutive PUSHB / PUSHW
operators.  Merge them in the disassembled output.

This, for now, generates worse assmebly because all PUSHB's
grouped with PUSHW's now generate as PUSHW.  Followup fix
will address that.
2013-12-17 04:19:14 -05:00
Behdad Esfahbod
ce84d3215e Generate PUSH mnemonic for PUSHB/NPUSHB/PUSHW/NPUSHW
Reduces XML noise while reenabling the optimization
during assembly.

Fixes https://github.com/behdad/fonttools/issues/73
2013-12-17 04:02:10 -05:00
Behdad Esfahbod
3714c78c92 When writing PUSH instructions, obey requested opcode
Previously fonttools was choosing between the optimal opcode
from PUSHB, NPUSHB, PUSHW, and NPUSHW.  We now respect
whatever was requested and err if the format doesn't support
the data.

Morevoer, if the number of numbers to push is more than 255,
we add multiple push instructions to push all the numbers.

Finally, add a new pseudo-opcode "PUSH" that automatically
chooses the best format.

This, by itself, reduces roundtrip noise by not optimizing
the bytecode as it was before.  In a followup commit I'll
change the bytecode disassembler to always produce PUSH
in the textual instructions instead of the four variants.
That way, we get both the optimization during assembling,
and reduced noise in XML.

Part of https://github.com/behdad/fonttools/issues/73
2013-12-17 04:00:01 -05:00
Behdad Esfahbod
e93e29125f Don't write Format for Coverage, ClassDef, Single/Alternate/LigatureSubst
The format values for those are automatically handled in
postRead/preWrite to choose optimal format.  As such, don't write them
in XML.  Reduces noise.

Part of https://github.com/behdad/fonttools/issues/73
2013-12-17 03:06:10 -05:00
Behdad Esfahbod
6ed2eb4092 Write LookupType as a comment
We compute LookupType from the type of the subtables, so write it out
as an informative comment in XML as opposed to an element.
2013-12-17 02:57:29 -05:00
Behdad Esfahbod
5fec22bfcd Compute correct LookupType when compiling font
Also ensures that all subtables of a lookup have the same
lookup type.
2013-12-17 02:42:18 -05:00
Behdad Esfahbod
ea82d6dfd1 Handle NULL coverage table in ligature substitute
Just to be in line with Single and Alternate subst.
2013-12-17 01:58:26 -05:00
Behdad Esfahbod
dafdb2933a Further optimize table loading
Again, both faster and more memory efficient
2013-12-17 00:58:02 -05:00
Behdad Esfahbod
b4070bd629 Minor optimization of table loading
Is both faster and more memory efficient.
2013-12-17 00:44:33 -05:00
Behdad Esfahbod
0be386edb5 [subset] Fix subsetting of Khmer fonts
Read comment.
2013-12-16 20:52:52 -05:00
Khaled Hosny
522cd11d51 Remove unnecessary new line after <CFF> tag
No other table does that.
2013-12-16 01:29:16 -05:00
Behdad Esfahbod
283fb26820 By default, don't load fonts lazily
Lazy loading has implications on how people use objects.
So, by default, don't load lazily.  This only affects
GSUB/GDEF/GPOS/etc and is closer to what fonttools used
to do traditionally.

Turn lazy loading on in subset and inspect.
2013-12-16 00:52:29 -05:00