Re: Pango cairo target surface size

Lawrence D'Oliveiro <[email protected]>
Newsgroups gmane.comp.lib.cairo
Organization Geek Central
Message-ID <[email protected]>
On Mon, 23 Mar 2015 11:29:51 +0800, Rob Kramer wrote:

> On 03/23/2015 11:20 AM, Lawrence D'Oliveiro wrote:
>
>> 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.
>
> But how does that result in an image surface equal to the extents of
> the string?

You use it to measure the text_extents with cairo_text_extents or
cairo_glyph_extents
<http://cairographics.org/manual/cairo-text.html#cairo-text-extents>.
-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.