• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

behdad / fonttools / 932 / 13
70%
master: 72%

Build:
Build:
LAST BUILD BRANCH: opentype-gx
DEFAULT BRANCH: master
Ran 17 Apr 2016 09:33PM UTC
Files 164
Run time 4s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

17 Apr 2016 09:02PM UTC coverage: 70.403%. First build
TOXENV=coveralls

push

travis-ci

behdad
[WIP] TTFont: Use mmap if possible

As discussed here:
https://github.com/behdad/fonttools/issues/580#issuecomment-211110222

Before:
$ python -m timeit 'from fontTools.ttLib import TTFont; TTFont("sazanami-gothic.ttf")'
10 loops, best of 3: 66.9 msec per loop

After:
$ python -m timeit 'from fontTools.ttLib import TTFont; TTFont("sazanami-gothic.ttf")'
10000 loops, best of 3: 110 usec per loop

That's a 600x speedup!

Fixes https://github.com/behdad/fonttools/issues/482

HOWEVER, it reintroduces https://github.com/behdad/fonttools/issues/302
Or worse, we'll crash when overwriting:

$ cp Lobster.ttf t.ttf
$ ./ttx -o ./t.ttf ./t.ttf
Dumping "./t.ttf" to "./t.ttf"...
Dumping 'GlyphOrder' table...
Bus error (core dumped)

IMO we should fix this by changing both XML and font output routines to,
instead of calling open, use os.tmpfile(), create output in a new file
and then rename it to the final destination.  It has the benefit of not
leaving a half-written output file behind if an exception occurs.  The
tempfile.NamedTemporaryFile also comes handy.

While checking those out, tempfile.SpooledTemporaryFile also comes handy,
when it's available, to replace BytesIO in the following part of TTFont.save():

	# write to a temporary stream to allow saving to unseekable streams
	tmp = BytesIO()

Looks like we need to start misc.fileTools to abstract the details away.

19101 of 27131 relevant lines covered (70.4%)

0.7 hits per line

Source Files on job 932.13 (TOXENV=coveralls)
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 932
  • Travis Job 932.13
  • 02e023e2 on github
  • Next Job for TOXENV=coveralls on mmap (#934.13)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc