[cairo] cairo-created PDFs are too large

Adrian Johnson ajohnson at redneon.com
Wed Dec 3 13:32:44 PST 2008


Ian Britten wrote:
> Adrian Johnson wrote:
> 
>> There isn't anything you can do to reduce the size other than upgrade to 
>> each new release when available. There are some things you can do that 
>> would increase the size unnecessarily like creating a new font face each 
>> time you draw some text as cairo embeds a separate font for each font face.
> 
> Can you clarify whether I'm into this case with what I'm doing?
> 
> Our rendering engine draws one character/glyph at a time (Since each
> glyph needs to be positioned/rotated/etc, may be using different
> faces, different sizes (subscripts), colours, etc).
> 
> As such, I'm "creating a new font face" for each glyph to be drawn.
> However, I'm always creating a Cairo face from a FT_Face, and the
> actual FT_Face is cached/shared amongst all the Cairo faces that
> use it.  As such, the number of unique FT_Faces used is relatively
> low, compared to the number of Cairo faces I 'create' (ie: Allocate).

Each time you create and use a font face with
cairo_ft_font_face_create_for_ft_face() you will get a new font embedded 
in the PDF.

> 
> I haven't been watching my PDF file sizes, and am probably not too
> concerned about their size for now (As long as they're practical),
> but I figured I should know if I'm into this case or not...

You can see what fonts are embedded with pdffonts or File->Properties in 
Evince.

> 
> Many thanks for any info!
> Ian
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo



More information about the cairo mailing list