[cairo] Pango cairo target surface size

Lawrence D'Oliveiro ldo at geek-central.gen.nz
Sun Mar 22 20:20:29 PDT 2015


On Mon, 23 Mar 2015 10:46:11 +0800, Rob Kramer wrote:

> I would like to create a cairo image surface that is equal to the 
> logical extents of a text string. This seems to be a chicken-and-egg 
> problem, since I need a cairo_t with surface before I can use layout 
> functions (and the surface size isn't known yet).

That’s easy. You can create an ImageSurface with 0 width and 0 height,
put a cairo_t on top of that, and do your text measurements without
any drawing taking place.


More information about the cairo mailing list