[cairo] Using Cairo and Pango to scroll text on video

Maarten Bosmans mkbosmans at gmail.com
Fri May 11 14:16:59 PDT 2012


2012/5/11  <robertk54 at aol.com>:
> Is there a way to render the entire text to a
> cairo surface whole?  As far as I can see one needs a cairo surface before
> creating the pango layout.  However, in my case, I do not know the
> dimensions of the cairo surface needed until after I start working in pango.

You need to do it in 2 steps. First create a 1x1 surface and a
corresponding layout. Then use the measured size to create a second
surface to dray the text to.
The layouting of the text is done twice in this approach. I don't know
of a way around that, but don't think it is a problem, performance
wise.

Maarten


More information about the cairo mailing list