[cairo] Tangential glyph enlargement

Chris Wilson chris at chris-wilson.co.uk
Tue May 10 06:52:29 PDT 2011


On Tue, 10 May 2011 15:35:58 +0200, Tobias Hoffmann <lcairo-list at thax.hardliners.org> wrote:
> Hi!
> 
> I'm using cairo (and freetype) to output some text, in bigger letters, 
> and allowing effects like stroked outline + different fill color, etc.
> One parameter would then allow to draw the glyph a little bit bigger or 
> smaller (and overlay this with itself, but unchanged size).
> 
> But just using a bigger font_size for that is not what's really wanted. 
> Strictly speaking, the glyph has to be "tangentially enlarged" (or shrunk).
> I'm currently using Cairo::Context::glyph_path().
> 
> Is this possible/advisable to do with cairo (say, Cairo::Path), or 
> should I try to grab the data from freetype and feed cairo with the 
> modified path?

Right, so you want to compute an offset curve for the bezier outline
stored in the vector font. This is very similar to the task performed when
actually stroking a path, and if you want some inspiration I would read
the cairo_stroke_to_path() code. Alas that is not yet upstream, but
Andrea I think has the latest copy
[git://anongit.freedesktop.org/~ranma42/cairo wip/stroke-to-path]

Even with using the outlines you will still need a little bit of
information from the font as to the direction in which to offset each
curve, so it is probably better looking to the original font description
and seeing if there is some information to help you generate the glyph you
want. Otherwise I would just scale and stroke the medial axis.

Hope this helps, and let us know the solution!
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the cairo mailing list