407 Commits

Author SHA1 Message Date
jvr
d299b55d14 patches from rroberts:
# 1) Switched to using Numeric module arrays rather than array modules arrays,
#  because of a memory leak in array.array when handling elements > 1 byte.
# 2) speed optimizations:
# -  For loops are collapsed when possible
# - the data for a subtable is parsed only if a mapping value is requested
# - if two subtables share the same data offset, then on
decompilation, they will
# share the same cmap dict, and not get decompiled twice. Same for compiling.
# - as before, two tables with the same contents will get compiled to a single
# data block in the font.
# 3) added  (self.platformID, self.platEncID) == (3, 10) to the list
of subtables that
# get Unicode comments.
# 4) allow item reference by GID as well as by name. I did this when
experimenting to see if using GID references only would speed the
compile; it didn't but it seemed useful enough to leave in.
# 5) Fixed compile to/from XML: for cmap type unknown ( aka cmap
format 10, in practice.)


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@510 4cde692c-a291-49d1-8350-778aa11640f8
2006-10-21 13:54:30 +00:00
jvr
bc6e55b31e Speed optimizations from rroberts
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@508 4cde692c-a291-49d1-8350-778aa11640f8
2006-10-21 13:29:47 +00:00
jvr
4cc0051c08 Some non-official OT tables from rrboerts. He wrote:
There are also some new files, for SING glyphlet support, that you
may or may not want to add, because they are not in the OpenType spec.

M_E_T_A_.py # SING glyphlet meta data table. see
'http://partners.adobe.com/public/developer/opentype/gdk/topic.html"
S_I_N_G_.py # SING glyphlet basic info. See same web site as for META
data table.

G_M_A_P_.py # Summary of sing glyphlet info that has been stuck into
a parent font. Not documented anywhere yet.
G_P_K_G_.py # Opaque wrapper for SING glyphlet info; travels with
application document. Is also stuck into augmented parent font. Not
documented anywhere yet


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@507 4cde692c-a291-49d1-8350-778aa11640f8
2006-10-21 13:27:25 +00:00
fcoiffie
3a3721cb1c In some bad fonts, kern table is incomplete (it only contains a version number). In this case, the code accept a table without kernTables.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@504 4cde692c-a291-49d1-8350-778aa11640f8
2006-01-25 15:24:37 +00:00
fcoiffie
dc66e7e118 LTSH length can be different of numGlyphs as the table length must be 4-bytes aligned (assertion changed to (len(data) % numGlyphs) < 4)
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@503 4cde692c-a291-49d1-8350-778aa11640f8
2006-01-25 15:21:22 +00:00
fcoiffie
83f069d66c The dates are stored in 8-bytes fields (Microsoft reference document) but Macintosh dates are only coded with 4-bytes. In some fonts, these date fields are badly coded and 8-bytes are used. So, a ValueError occurs.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@502 4cde692c-a291-49d1-8350-778aa11640f8
2006-01-25 15:12:14 +00:00
fcoiffie
04985bfdde Unsigned long data field must be packed with "L" instead of "l" (sometimes an OverflowError can occur)
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@501 4cde692c-a291-49d1-8350-778aa11640f8
2006-01-12 14:04:40 +00:00
jvr
2e4cc02ca3 BasePen should not fail if a base glyph does not exist in the glyph set; added get() method to _TTGlyphSet class
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@497 4cde692c-a291-49d1-8350-778aa11640f8
2005-03-08 09:50:56 +00:00
jvr
31ae380735 fixed problem with empty ClassDef, as well as added some more defenses for possible empty tables
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@484 4cde692c-a291-49d1-8350-778aa11640f8
2005-02-11 19:36:38 +00:00
jvr
7afc6b989c uh, and the other one
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@482 4cde692c-a291-49d1-8350-778aa11640f8
2005-01-24 10:18:58 +00:00
jvr
79c1316d65 fixed buglet in GlyphSet support code
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@481 4cde692c-a291-49d1-8350-778aa11640f8
2005-01-24 10:06:45 +00:00
jvr
1ed5b4746d fixed 2.4 compat issue
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@480 4cde692c-a291-49d1-8350-778aa11640f8
2005-01-24 10:05:52 +00:00
jvr
f34c6f3937 fix for new 2.4 hex() behavior
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@478 4cde692c-a291-49d1-8350-778aa11640f8
2004-12-24 16:07:01 +00:00
jvr
28ae196229 Refactored and enhanced table order support:
- Rewrote sorting function, it was really quite buggy.
- Added reorderFontTables() functions, which reorders the
  tables in a font at the sfnt level.
- TTFont.save() will now by default rewrite the font in the
  optimized order. This is done through a temp file since
  our dependency checking logic gets in the way of writing
  the tables in a predefined order directly (if table A depends
  on B, table B will always be compiled and written first, so
  this prevents A from showing up in the file before B).

sfnt.py:
- removed closeStream option from SFNTWriter.close(); it's better
  done by the caller (TTFont).


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@475 4cde692c-a291-49d1-8350-778aa11640f8
2004-11-16 10:37:59 +00:00
jvr
a4f6688ebe tweak & bugfix
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@474 4cde692c-a291-49d1-8350-778aa11640f8
2004-11-16 09:12:30 +00:00
jvr
427f9802bc make sure that a cmap subtable instance always has a language attr, so __cmp__ can't fail
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@473 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-26 18:32:50 +00:00
jvr
fba0609d54 Fix for [ 808370 ] Dumping Legendum.otf fails on 'kern' table
Work around buggy kern table.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@472 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-25 10:56:15 +00:00
jvr
1fae9b48d3 [ 637398 ] Failure while parsing OpenType file
Deal with empty Coverage table: it will be None so won't have a .glyphs
attribute.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@471 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-25 10:31:29 +00:00
jvr
266bf21dbe workaround for bug [ 766694 ] Error from invalid date
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@470 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-25 10:01:12 +00:00
jvr
980fae897a bug #784690: simple workaround for buggy name table
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@469 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-25 09:12:00 +00:00
jvr
a84b28d934 - Refactored XML writing, removed lots of code duplicaiton
- Only output unicode names as comments if we're in fact dealing with
  a unicode cmap subtable (and this is -- in theory -- independent of
  cmap format)


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@468 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-25 09:06:58 +00:00
jvr
0cd79a5642 Patch #845571 from Anthony Fok:
- better exception msg in loca table
- renamed "version" to "language" in cmap
- made cmap 12 work (untested by me)


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@463 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-25 07:30:47 +00:00
jvr
7718d95951 whoops, forgot one part os OS/2 version 3 support
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@462 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-25 07:19:27 +00:00
jvr
30bcb12dcb added support for OS/2 table #3
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@461 4cde692c-a291-49d1-8350-778aa11640f8
2004-09-24 18:33:19 +00:00
jvr
8e1d75b1a3 ReverseChainSingleSubst support from Yannis H. (must get that generate-otdata-from-the-docs working again)
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@459 4cde692c-a291-49d1-8350-778aa11640f8
2003-09-22 13:12:55 +00:00
jvr
df1f145e5a bug from the spec leaked into here; pointed out by Yannis H.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@458 4cde692c-a291-49d1-8350-778aa11640f8
2003-09-22 07:09:33 +00:00
jvr
27f108844e this should have been part of the previous path by some fixes from klchxbec
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@450 4cde692c-a291-49d1-8350-778aa11640f8
2003-09-11 07:11:35 +00:00
jvr
3a6aa2359e tweaked doc string
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@445 4cde692c-a291-49d1-8350-778aa11640f8
2003-09-02 19:23:13 +00:00
jvr
5aaeac3333 Ha, a reserved field got eaten. Noticed by Yannis Haralambous.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@443 4cde692c-a291-49d1-8350-778aa11640f8
2003-09-01 15:09:29 +00:00
jvr
1cff4cb190 workaround for buggy 2.2 mac support
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@436 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-28 18:23:43 +00:00
jvr
3430abf7ab whitespace nits
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@435 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-28 18:14:33 +00:00
jvr
bafa66e665 Another patch from rroberts. He writes:
"""It adds full support for cmap format 2, which is what
the Adobe CJK fonts use for the Mac cmap subtable."""


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@434 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-28 18:04:23 +00:00
jvr
d028b7be3c Set .width in _TTGlyph.__init__ after all: these are just this wrapper
objects, _TTGlyphSet doesn't cache them, so setting .width in .draw()
is confusing to say the least.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@430 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-26 19:00:38 +00:00
jvr
6f8f5ded55 fixed AttributeError in _TTGlyphSet.keys()
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@428 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-26 18:19:11 +00:00
jvr
6d9e8e8831 document that this file is generated
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@425 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-25 21:19:09 +00:00
jvr
1c9917bcf4 comment typo fix, reflow
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@422 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-25 13:20:38 +00:00
jvr
8df8f6385e TTFont now has a getGlyphSet() method, which will return a generic
GlyphSet. A GlyphSet is simply a dict-like object mapping glyph names
to glyphs. The glyphs in a GlyphSet have a .draw(pen) method and a
.width attribute. This provides a generic interface for drawing glyphs
or extracting outlines, and works both for CFF-based fonts and TT fonts.

See also fontTools.pens.basePen for a description of what makes a Pen
a Pen.


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@420 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-25 13:15:50 +00:00
jvr
731ed49dbc add some more dict-like stuff to the glyf table
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@419 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-25 12:23:01 +00:00
jvr
b47e3ba3ae some fixes from klchxbec
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@409 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-22 20:21:08 +00:00
jvr
aa2723c559 VORG support by rroberts.
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@408 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-22 20:02:25 +00:00
jvr
700df03131 - attempted to sort tables in order recommended by spec.
TODO: need to fix table dependency order to complete this.
  (Read: would you mind posting a bug report regarding this?)


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@406 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-22 19:44:08 +00:00
jvr
f509c0f070 support for CEF fonts: don't depend on the head table being available
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@405 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-22 19:38:37 +00:00
jvr
07dd0e4504 recalc numGlyphs upon writing
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@404 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-22 19:34:48 +00:00
jvr
d407973545 update macUtils to current day MacPython
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@403 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-22 18:56:01 +00:00
jvr
0bb3ba5222 some modernizations
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@401 4cde692c-a291-49d1-8350-778aa11640f8
2003-08-22 18:52:22 +00:00
jvr
e73b8a53a5 Fix for bug #691744; calc_mac_epoch_diff() was broken when the timezone
was GMT (or perhaps other situations; it's not entirely clear).


git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@391 4cde692c-a291-49d1-8350-778aa11640f8
2003-02-23 19:40:07 +00:00
jvr
924e4e274e cmap format 12 support, donated by rroberts: thanks!
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@390 4cde692c-a291-49d1-8350-778aa11640f8
2003-02-08 10:45:23 +00:00
jvr
a87cde236e second try to work around bogus stringOffset value
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@389 4cde692c-a291-49d1-8350-778aa11640f8
2003-01-25 18:20:22 +00:00
jvr
b71d0f46f6 renamed stringoffset to stringOffset as per spec
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@388 4cde692c-a291-49d1-8350-778aa11640f8
2003-01-25 11:15:42 +00:00
jvr
aabca6d793 gracefully handle bogus stringOffset values (thanks to Anthony Fok)
git-svn-id: svn://svn.code.sf.net/p/fonttools/code/trunk@387 4cde692c-a291-49d1-8350-778aa11640f8
2003-01-25 11:14:59 +00:00