[cairo] scale with text

Carl Worth cworth at cworth.org
Sat Feb 17 11:11:14 PST 2007


On Sat, 17 Feb 2007 19:20:41 +0100, Tobias Ceglarek wrote:
> I have attached two pics. You will see, that the text overlaps the white
> area in the zoomed version.

Thanks for the picture.

I still don't understand what it is you are having trouble
achieving. Here's what I understand so far:

* You called cairo_scale to make the text get larger

* The text got larger

* Something about the white box

I feel like there's a question in there, and I'd like to try to answer
it. But I'm still not sure what the question is. Can you help some
more?

I can take some guesses as to what the question might be:

    Question: How can I restrict the text to be clipped by a rectangle
              the size of the white box?

    Answer: Call the following before drawing the text:

		cairo_rectangle (cr, x, y, width, height);
		cairo_clip (cr);

    Question: How can I measure the size of the text so that I can
    	      draw a rectangle that will bound it?

    Answer: Use cairo_text_extents()

    etc.

But I'm not sure that it's too productive for me to keep guessing
until I get to the right question. :-)

> cairo_text_path(str)
> cairo_fill
>
> instead of
>
> cairo_show_text(str)
>
> The effect is the same.

Good. That means that those functions or behaving exactly as intended.

-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20070217/95125272/attachment.pgp


More information about the cairo mailing list