[cairo] Truetype subsetting code reenabled

Kristian Høgsberg krh at bitplanet.net
Tue May 16 20:51:18 PDT 2006


Hey,

I have a branch in my git repository that reenables truetype
subsetting and embedding with the new subset code:

  http://gitweb.freedesktop.org/?p=users-krh-cairo;a=log;h=truetype-subsetting

The bulk of the code is pretty much unchanged, except for the
interface to the subsetting code.  The way it works now is that when a
print backend wants to output a font subset it can call:

cairo_private cairo_status_t
_cairo_truetype_subset_init (cairo_truetype_subset_t    *truetype_subset,
                             cairo_scaled_font_subset_t *font_subset)

to try to create a truetype subset file for the
cairo_scaled_font_subset_t.  If that succeeds, truetype_subset is
inititalized with the truetype data and various meta data about the
font and the print backend can procees with emitting the required
dicts.  If the call returns CAIRO_INT_STATUS_NOT_SUPPORTED, it means
that either the underlying cairo_scaled_font_t or the font backend
does not support truetype subsetting for this font.  In this case, the
print backend can try other subset types (type1) or fall back to the
type3 code.

As it is, the code is basically usable and could go into 1.2, but I
have a few things I'd like to do:

- refactor cairo-font-subset.c a bit and rename it
cairo-truetype-subset.c.  In it's current state it's clear that it's
been moved around and renamed a few times.  It's only clean-up and
renames, no changes in functionality.
- redo the subsetting to work on cairo_font_face_t's instead, so we
don't output a font subset for each scale of a given font.
- add cairo-type1-subset.c, I have this code lying around 90%
finished.  I don't wan't to enable this by default, I was thinking it
could be added as an experimental feature that could be enabled by a
./configure option.  With the fallback structure described above it's
easy to conditionally enable or disable this code at compile time.

However none of these are critical for 1.2, the code works as it is.

cheers,
Kristian


More information about the cairo mailing list