[cairo] show_glyphs and writing text
Donn
donn.ingle at gmail.com
Mon Dec 17 06:05:35 PST 2007
Hi,
I am doing a diagram for the text now and have spent some time trying to
write a string using show_glyphs.
It seems I can write glyphs, just not the ones I expect. I gather it's all
tangled up in encodings and font backends etc., but is there any easy way to:
cr.select_font_face('fantasy', cairo.FONT_SLANT_NORMAL,cairo.FONT_WEIGHT_BOLD)
cr.set_font_size(0.05 )
glyphs = []
x,y,w,h,xa,ya = cr.text_extents("A")
x,y = 0, 0.5
string=u"Donn is bamboozled"
for c in string:
glyphs.append( ( ord(c), x, y ) ) #here's me thinking A = 65 :)
x += xa
cr.show_glyphs (glyphs)
So that a string is displayed?
(Oh, PS, Freetype is my backend.)
I realize that show_text() is the easier, but there are all these implications
that's it's not fit for much (unicode issues?) and I am also just trying to
be thorough. I will also address pango soon.
\d
He missed an invaluable opportunity to hold his tongue. -- Andrew Lang
More information about the cairo
mailing list