[cairo] Rendering line fonts
ajohnson at redneon.com
Fri Nov 21 06:52:40 PST 2008
Ian Britten wrote:
> After thinking about this a bit more, I've been able to get a bit
> Since the root of my problem is my own font driver, and its stroke
> fonts, I made a change to it so that the path it returns now also
> includes all the points from the last point back to the first point.
> This makes it a (zero area) closed polygon, which I'm hoping is
> more acceptable. It certainly looks better!
> My only issue is that the fonts draw almost invisibly thin, and I'm
> looking to get a lineweight applied to it (See screenshots). Given
> that I can set the thickness of lines and polygon boundaries in Cairo,
> is there anything I can set that will be used when these fonts are
> rendered? For example, I tried calling cairo_set_line_width() before
> calling cairo_show_glyphs(), but it didn't seem to have any effect.
> We love the fact that our text is actually coming out as text in the
> PDF (Rather than just lines, or an image), and would really like to
> be able to keep this! [ Without having to rewrite vast amounts of
> our existing text handling code ;) ]
The PDF backend, when embedding font subsets of fonts that are not
natively supported (TrueType, CFF, Type 1), will try to obtain the path
of each glyph. If the paths are available a Type 1 font is created from
these paths and embedded in the PDF. The paths are always filled. If you
want to stroke the paths you will need to make your FT driver create
paths that when filled form the strokes. The Type 1 font specification
also documents some limitations on the type of paths that may be used
(eg intersecting paths are not permitted) .
Your best option is to use the user font feature in cairo. It would take
very little effort create a user font with a render function that
strokes the glyph path. In the PDF/PS backends user fonts are embedded
as a Type 3 fonts.
More information about the cairo