Re: Pango cairo target surface size
Behdad Esfahbod <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
On 15-03-23 10:41 PM, Rob Kramer wrote: > What I want to do is paint a string to a surface the same size as the text's > logical extents -- without doing the text layouting twice (once to calculate > the extents, once to paint). Since I cannot change the target image size after > it is set, or import an existing Pango layout into Cairo, I wondered whether > anyone on this list would know of a method. You create a 0x0 surface, create PangoLayout for it, measure, create new surface & cairo_t, and render the same PangoLayout to new cairo_t. PangoLayout caches layout internally and if font size, options, etc don't change, it won't recompute layout. Now that you mention it, pango-view itself doesn't try to do this. It does layout twice. Maybe I'll fix that. behdad -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo