[cairo] Problem displaying text

Carl Worth cworth at cworth.org
Thu Nov 2 03:36:02 PST 2006


On Thu, 2 Nov 2006 20:46:06 +1100, Benno Rice wrote:
> 	ctx.select_font_face("Sans", cairo.FONT_SLANT_NORMAL,
> 	    cairo.FONT_WEIGHT_NORMAL)
> 	ctx.set_font_size(24.0)
> 	ctx.set_source_rgba(1.0, 1.0, 1.0, 1.0)
> 	ctx.move_to(100, 100)
> 	ctx.show_text("Fnord")

That much looks just fine.

> 	ctx.fill()

That call you don't need. The show_text operation is a drawing
operation and should show your text. This subsequent fill will instead
fill the current path. From the above code snippet it's not obvious if
you have a path or not. If not, then the fill should do nothing, so it
would be harmless in that case, but still unnecessary.

Other than that I don't see any obvious problems. You might print out
cairo's status value, (along the lines of ctx.status_to_string
(ctx.status())), to see if cairo has detected any error.

Good luck, and have fun with cairo.

-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/20061102/81d54005/attachment.pgp


More information about the cairo mailing list