[cairo] User fonts -> PDF questions

Ian Britten britten at caris.com
Thu Dec 4 07:05:27 PST 2008


Hi all,
I have a couple of questions about writing custom (user) fonts to
PDF files.  Note that these are 'stroke' fonts (lines only), done
with a custom FT_Driver/FT_Face, and rendered via Cairos "user font"
mechanism.
Basically, I've noticed some issues with the resulting PDF file,
and am wondering where the problem lies, and how to best fix it.

[ NB - I can provide a small PDF, if anyone can read it and wants
to try working backwards... ]

1) When selecting the text, the highlight box isn't correct:
    - In AdobeReader_enu-8.1.2_SU1-1), the blue highlight box is
      shifted to the right by half the width of the glyph.  The
      vertical positioning seems ok.
    - In evince-2.22.2-1.1mdv2008.1, not only is the highlight
      box shifted to the right by half the width of the glyph, but
      the box is also more than twice the height of the text.
    - NB - When selecting TT fonts, both of these tools seem to
      have a highlight box that is about twice the height of the
      glyphs, but centred vertically.

-> When I first mentioned this in a previous post, Adrian
    suggested I draw the extents around each glyph.  I have done
    this, and the boxes look correct.  They're off a tiny bit in
    some cases, but I'm not concerned about that at the moment.

2) When I copy+paste the text from the PDF, I don't get my text.
    - From AdobeReader, I get one 􀀀 character for each character.
    - From evince, I get one 0 character for each character.

3) When I look at the embedded fonts (under File->Properties in
    evince), all my embedded fonts are called "No name".
    Is there a way I can set some sort of informative name
    reflecting my user font?  Or should it maybe have already done
    that, and I've not got something set up correctly? (Either in
    my Cairo UserFont or in my custom FT_Driver/FT_Face?)

4) I've been asked by some people about being able to control some
    of the additional PDF attributes (eg: security->printing,
    layers, etc).
    I confess I don't know much about this stuff, but am just
    wondering if there is any (cairo) interface to this stuff
    (Either currently or planned)?

5) When I draw my text in evince, the colour of the first glyph
    is wrong (black).  It looks correct in AdobeReader, kpdf,
    and gv.  (Maybe this is just an evince problem though...)

In any/all of these cases, the problem is very well me doing
something wrong (or unexpected), or failing to do something
that is supposed to be done.
If anything isn't clear, or if you need more details, please
let me know!

Thanks,
Ian


More information about the cairo mailing list