[cairo] Rendering line fonts

Behdad Esfahbod behdad at behdad.org
Fri Nov 21 07:30:24 PST 2008


Ian Britten wrote:
> 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 ;) ]

As Adrian suggested, you need to use a user font.  Start by taking
test/user-font-proxy.c from the cairo distribution.  That file has a render
function with this line:

    cairo_show_glyphs (cr, &cairo_glyph, 1);


You need to replace that with:

    cairo_glyph_path (cr, &cairo_glyph, 1);
    cairo_stroke (cr);


behdad

> As always, thanks for any help/suggestions! (And patience!)
> Ian
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo


More information about the cairo mailing list