[cairo] Re: [cairo-commit] 4 commits - src/cairo-output-stream.c src/cairo-pdf-surface.c

Adrian Johnson ajohnson at redneon.com
Tue Feb 13 04:56:50 PST 2007

Baz wrote:
> I uncompressed the doc with pdftk and looked at the content, what I'm
> seeing would be consistent with eg:
> 0.634115 0 Td <01> Tj
> displaying the character <01> unmapped - I see the box for an
> unprintable char. The chars in this doc only go up to <1b>, a few more
> letters and it'd be obvious, since we'd be into the ascii printable
> range. Since the text selection works, I'm guessing ToUnicode is
> working fine but the font encoding is being ignored?

The character numbers 0..1b are not ASCII. The subsetted font contains
only the required glyphs at the glyph locations 1..0x1c (0 is the notdef
glyph you are seeing). The cmap table in the subsetted font maps the
character codes 0..0x1b to the glyph locations 1..0x1c. You can try
editting the character codes in the PDF if you are careful to not move
anything else in the file as it is a binary file.

The ToUnicode is a mapping from character codes to Unicode so this will
not be affected. In your case there is a problem with the character code
to glyph mapping.

> I see that the encoding is done using 'Differences', the pdf spec
> describes this as 'Optional; not recommended with TrueType fonts'. The
> reason its not recommended would be (I presume) that since no base

The Differences array was included to work around a problem where
Adobe Reader for Linux would not correctly print cairo PDFs.

I'll send you some PDFs with and without the Encoding dictionary to test.

More information about the cairo mailing list