[cairo] Problem displaying text

Benno Rice benno at jeamland.net
Thu Nov 2 01:46:06 PST 2006


Hi all,

I'm trying to display text within a Python program using the toy text  
API.  I'm using pycairo 1.2.2 linked against cairo 1.2.4 with  
freetype 2.2.1 and fontconfig 2.4.1.  I'm displaying to an X window  
using a custom python extension module (written in C) that creates a  
window and creates an associated cairo surface which I can get at  
from my python script.  When I try to display text using code along  
the lines of:

	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")
	ctx.fill()

I get nothing displayed.  Similarly finishing with ctx.stroke()  
doesn't display anything either.  Displaying a rectangle works.  As a  
test, I tried calling font_extents and text_extents and both return  
numbers that appeared to be correct.

Can anyone point me to where I might be making a mistake?

Many thanks,
	Benno.
	
-- 
Benno Rice
benno at jeamland.net
http://jeamland.net/




More information about the cairo mailing list