Initial commit of font compression code into public project.
This commit is contained in:
+44
@@ -0,0 +1,44 @@
|
||||
To build:
|
||||
|
||||
Check out a recent version of OTS, so that ots-read-only/ is alongside cpp/
|
||||
|
||||
Cd into cpp, and run "scons".
|
||||
|
||||
Then, decompress a font using ./woff2-decompress font.wof2 > font.ttf .
|
||||
|
||||
An example font is provided (Inconsolata-Regular.wof2). In this snapshot,
|
||||
it contains no actual compression, but does apply the glyf table transform
|
||||
and has the file format and structure as described in the current draft
|
||||
of the "WOFF Ultra Condensed file format" doc.
|
||||
|
||||
That said, it is possible to get reliable estimates, and at the very least,
|
||||
bounds, on the compression efficiency, with the confidence that the
|
||||
compression is reversible. Running the compressor and doing a whole-file
|
||||
compression with a standard entropy coder such as gzip or lzma will yield
|
||||
a file size within a few dozen bytes or so of using a single entropy coded
|
||||
stream in the final file format.
|
||||
|
||||
Another limitation of the current implementation snapshot is that it
|
||||
doesn't implement continue streams. These will follow shortly.
|
||||
|
||||
= Building with lzma =
|
||||
|
||||
The lzma-enabled build is made with gyp instead of scons. Right now, the build
|
||||
requires patching a clean copy of OTS. (And thanks to Bashi for the patch!)
|
||||
|
||||
- Download GYP from http://code.google.com/p/gyp/
|
||||
- Download clean OTS sources:
|
||||
% svn checkout http://ots.googlecode.com/svn/trunk/ ots-read-only
|
||||
- Apply patch
|
||||
% cd ots-read-only; patch -p0 < ../ots-lzma.patch
|
||||
- Run gyp to generate Makefile
|
||||
% cd ../cpp; gyp --depth=. -f make woff2.gyp
|
||||
- Build
|
||||
% make
|
||||
|
||||
Now run:
|
||||
|
||||
out/Default/woff2-decompress Inconsolata-Regular-lzma.wof2 > i.ttf
|
||||
|
||||
We expect the build recipes to be cleaned up before the code is ready for
|
||||
production, but this should be good enough for testing.
|
||||
Reference in New Issue
Block a user