1358 Commits

Author SHA1 Message Date
Khaled Hosny
e0b517a6e7 A couple ufoLib.pointPen → pens.pointPen 2019-02-14 23:38:11 +02:00
Cosimo Lupo
173a0f5011 [C_P_A_L_] make Color a subclass of namedtuple
so that's comparable/hashable/immutable and can be used as key in a dict or set.

The fromXML instance method was dropped since it relied on the object being mutable.
A fromHex classmethod replaces it.
2019-02-08 01:16:47 +01:00
Cosimo Lupo
8350332461
{v,h}mtx: allow to compile/decompile even without {v,h}hhea table
when no horizontal/vertical header table is present, we assume numberOfHMetrics == maxp.numGlyphs.
This allows to compile/decompile incomplete fonts, only containing head, maxp, hmtx, loca and glyf (or CFF),
that is the bare minimum to temporarily store glyph outline and metrics data for use with sparse/intermediate
master TTFs in varLib.
See https://github.com/googlei18n/ufo2ft/issues/308
2019-01-14 13:45:24 +00:00
justvanrossum
d938668cc2 some purely cosmetic whitespace edits 2019-01-10 19:35:34 +01:00
Just van Rossum
6f7c0f1d09
[ttLib] cmap format 14 cleanup (#1437)
* cleanup cmap format 14 TTX format by removing redundant attributes
* don't output the name attr for a default mapping, instead of a glyph named 'None'
* still accept 'None' as an indicator glyph name, for bw compatibility
* swap order of TTX attrs uv and uvs
* make sure (unicode, glyphName) pairs are always tuples in uvsDict.
2019-01-10 19:19:35 +01:00
Miguel Sousa
f07d5e7dc0 [maxp] Include 'maxComponentElements' in the table's recalculation 2019-01-09 03:03:32 -08:00
Cosimo Lupo
683547dde2
Merge pull request #1359 from justvanrossum/addmultilingualnames-mac
[name] make addMultilingualNames() add mac names by default
2019-01-07 09:54:34 +00:00
Cosimo Lupo
ce86397f8f
[sfnt] allways copy file data to BytesIO, not just if deepcopy failed
on py27, calling deepcopy on a file object doesn't raise TypeError, but leaves
the duplicated file object in an inconsistent state:

https://travis-ci.org/fonttools/fonttools/jobs/474811063#L714

any operations on it will fail with 'ValueError: I/O operation on uninitialized object'.
Thus, for semplicity for now we always do a manual copy the file contents into an
in-memory BytesIO stream, rather than attempting to call deepcopy first.
2019-01-03 11:53:28 +00:00
Cosimo Lupo
560c7558c8
SFNTReader: try deepcopy'ing first, if fails do manual copy of file contents 2018-12-20 14:28:17 +00:00
Cosimo Lupo
4001ded199
override SFNTReader __deepcopy__ for 'file' isn't copyable; use it in varLib 2018-12-20 14:18:59 +00:00
Cosimo Lupo
6f317aa362
ttFont: add copy() method that return new instance with same data
and use it in varLib to copy master font
2018-12-20 12:47:43 +00:00
justvanrossum
1828dae78a Use raw strings for regex patterns. Fixes #1389 2018-12-05 12:46:36 +01:00
Denis Moyogo Jacquerye
0c4f11f5ff
Merge pull request #1361 from moyogo/kerntable
Ignore the length of kern table sutable format 0
2018-11-20 13:41:13 +00:00
Denis Moyogo Jacquerye
46add5375d kern table: allow subtables larger than length value 2018-11-20 12:41:57 +00:00
Nyshadh Reddy Rachamallu
512bccf49e Add IDEF for GETVARIATION opcode 2018-11-15 15:18:03 -05:00
Martin Hosken
2cfc16a172 Remove redundant bug fix, add graphite dependencies 2018-11-06 15:21:32 +07:00
justvanrossum
8841d98652 [name] make addMultilingualName() also add Mac names by default. 2018-11-02 11:56:22 +01:00
Martin Hosken
9739247a81 Fix python3 file writing issues and table compression 2018-11-02 11:21:58 +07:00
Jens Kutilek
76e7b7a786
Add PointPen support to TT Glyph objects (#1334)
* Add drawPoints method to _g_l_y_f.Glyph
* Add drawPoints method to ttFont._TTGlyph
2018-10-18 11:52:38 +02:00
Cosimo Lupo
935aad1a25
DefaultTable: pass extra **kwargs in toXML (for glyf table class)
when ttx fails to decompile a buggy glyf table, the DefaultTable implementation is used,
but TTFont._tableToXML passes 'splitGlyphs' keyword argument to table.toXML when
the tag is 'glyf'.
Let's simply ignore it here.
2018-10-16 17:21:50 +01:00
Sascha Brawer
2011ccf6ec [morx] Clean up compilation of AAT action tables; add more tests 2018-09-24 20:15:54 +02:00
Sascha Brawer
4a1871ff62 [morx] Support AAT action type to insert glyphs 2018-09-24 18:14:01 +02:00
Jens Kutilek
7c8077a63d Add glyf flags bit6 to ttx output (#1316)
* Implement glyf outline flags bit 6 when decompiling/compiling

* Add test data for outline flag bit 6

* Rename flags, use bitwise OR for setting flag bit

* Remove unneeded code
2018-09-14 15:27:32 +02:00
Cosimo Lupo
5c2ea41fa6
Merge pull request #1310 from paullinnerud/master
TSIC table support a Visual TrueType source table
2018-09-14 11:40:43 +02:00
Cosimo Lupo
32aef4fc88
[G__l_o_c] import sys 2018-09-06 10:05:26 +01:00
Behdad Esfahbod
349cd94d17 [graphite] Fix for big-endian
Make all "if sys.byteorder..." and "byteswap" be on the same line for
earsier grep verification.

Fixes https://github.com/fonttools/fonttools/issues/1311
2018-09-05 21:12:53 -07:00
Paul Linnerud
df429df9ec TSIC Support for Visual TrueType
TSIC is a source table for Visual TrueType to maintain sources for the cvar variation table.
2018-08-22 16:48:42 -07:00
Behdad Esfahbod
05f95f0f58 [otBase] Try ExtensionLookup if other offset-overflow methods fail
If offset overflow happens other than between Lookup and SubTable, or
within SubTable, then we don't know how to fix it currently.  Now we
try to put that lookup in an Extension lookup anyway, since that will
isolate it and sharing with other lookups won't happen, hopefully
avoiding the overflow.

This is really a bandaid... What we want is the 99proof branch to
be finished and replace our current packing algorithm.

Fixes https://github.com/fonttools/fonttools/issues/1296
2018-07-25 11:06:44 -07:00
Behdad Esfahbod
642cb03296 Remove unused line of code 2018-07-25 11:06:44 -07:00
Cosimo Lupo
6e8e431dee
otTables: try to fix MarkBasePos subtable overflows
Fixes https://github.com/googlei18n/fontmake/issues/450
2018-07-19 17:52:00 +01:00
Cosimo Lupo
2798bf6d1f
otTables: print subtable type when can't split in fixSubTableOverFlows 2018-07-19 17:50:43 +01:00
bgermann
d438f15118
Add missing import 2018-06-28 14:07:14 +02:00
Cosimo Lupo
d570fc038a
use otRound when rounding visual coordinates or deltas
So we now round towards +Infinity in:

- floatToFixed (which fully examplify that quotes from OT spec)
- psCharStrings: when packing floats as fixed 16.16
- t2CharStringPen: when rounding coordinates and advance widths
- subset: when rounding advance widths to compute average
- TupleVariation: rounding gvar deltas
- _g_l_y_f: when rounding coordinates: both in GlyphComponent.{x,y}
  and for GlyphCoordinates.toInt()
- _h_m_t_x: for rounding horiz/vert metrics
- varLib: rounding horiz metrics and deltas
2018-06-14 17:40:11 +01:00
Cosimo Lupo
846941c8ef
[glyf] ensure GlyphCoordinates never overflow
in _checkFloat (used whenever we're about to update the inner array) we check whether the value exceeds a short integer, and if so we convert the array to floats.
Also, we make sure we call __setitem__ (which in turn calls _checkFloat) instead of updating the inner array directly in the rest of the math methods.
2018-06-07 12:53:42 +01:00
Cosimo Lupo
ca92b172f5
ttFont: allow to build glyph order without post nor cmap, just maxp.numGlyphs
could be useful to read in incomplete sfnt fonts e.g. containing only GPOS or GSUB tables
and a bare maxp table with the numGlyphs
2018-05-06 15:33:18 +01:00
Jens Kutilek
ae4472860f No need to use .keys() 2018-05-04 13:37:59 +02:00
Jens Kutilek
4a16d1839d Add __len__ method to TTFont._TTGlyphSet 2018-05-04 13:12:18 +02:00
Behdad Esfahbod
795f2f95fb [otBase] Fix sharing of tables referred to by different offset sizes
When an offset refers to a table, we keep the size of the offset to
the referred-to table. When sharing tables, we were ignoring this,
which could result in a long offset being written out as a short, or
vice versa.  Fix it by not sharing such tables. This is not optimal
but fixes the bug.

Bug has been there forever.
2018-04-25 20:57:19 -07:00
Behdad Esfahbod
95838bd4df [otBase] If decoding tables fails, append breadcrumb to exception 2018-04-25 15:53:43 -07:00
Cosimo Lupo
dde854d285
Allow decompiling bad ClassDef tables with invalid format
Fixes https://github.com/fonttools/fonttools/issues/1235
2018-04-13 12:58:29 +02:00
Andy Zickler
1e2ee8e15e Add context guard to ttfont 2018-04-03 18:08:52 -04:00
Cosimo Lupo
6b6c34ab1a
otTables: fix IndexError while pruning of HVAR pre-write 2018-04-03 10:28:27 +01:00
Behdad Esfahbod
d3a6a4e9e4 Don't fail during ValueRecord copy if src has more items
We drop hinting by simply changing ValueFormat, without cleaning
up the actual ValueRecords. This was causing failure at this assert
if font was subsetted without hinting and then passed to mutator.
2018-03-26 12:54:57 -07:00
Cosimo Lupo
e02055e070
[sfnt] TTCTag is a str
https://github.com/fonttools/fonttools/issues/1207
2018-03-06 10:46:01 +01:00
Cosimo Lupo
d46444acb4
[glyf] use . to separate glyph name from table tag in -g mode 2018-03-01 11:57:45 +00:00
Cosimo Lupo
6473cc9349
add more tests for userNameToFilename function
plus minor whitespace
2018-02-28 12:26:52 +00:00
Cosimo Lupo
232e2b8467
Revert "Merge pull request #1130 from anthrotype/temp-revert-split-glyphs"
This reverts commit 060f856f92e0fb2d8e60f6be080c89c08528bacb, reversing
changes made to 1e42224af741fac73e20f7193d8115cfda7d3594.
2018-02-28 11:24:19 +00:00
Behdad Esfahbod
54fd71f73c [varLib/subset] Fix subsetting of GPOS variation data
Was not picking up ValueRecord Device objects. Ouch!
2018-02-27 18:52:07 -08:00
Chris Simpkins
5f36f03311 [ttFont] fixes xmlWriter import error in _saveXML method with ttx split tables requests 2018-02-21 12:33:01 -05:00
Behdad Esfahbod
073227bbb0 [varLib.varStore] Start implementing a VarStore optimizer
Commandline takes varfont and optimizes its GDEF VarStore.
2018-02-20 20:58:18 -08:00