[cairo-commit] pycairo/examples text.py,1.5,1.6
Carl Worth
commit at pdx.freedesktop.org
Thu Apr 29 06:50:16 PDT 2004
Committed by: cworth
Update of /cvs/cairo/pycairo/examples
In directory pdx:/tmp/cvs-serv28030/examples
Modified Files:
text.py
Log Message:
* examples/text.py (expose_event): Hook up text_extents now that
it is working.
* cairo/pycairo-context.c (pycairo_text_extents): Hook up the text
extents code, (it hadn't been working in cairo some time ago).
Index: text.py
===================================================================
RCS file: /cvs/cairo/pycairo/examples/text.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/text.py 14 Nov 2003 15:32:10 -0000 1.5
--- b/text.py 29 Apr 2004 13:50:10 -0000 1.6
***************
*** 13,23 ****
ctx.select_font('sans-serif')
ctx.scale_font(48)
! # Text extents is currently not working in cairo
! # (x, y, widht, height, dx, dy) = ctx.text_extents('Hello World')
! # Instead, we'll just kluge in some hard-coded values.
! (x, y, width, height, dx, dy) = (0, 41, 280, 48, 280, 0)
ctx.new_path()
! ctx.move_to(10,10)
ctx.rel_line_to(width + 20, 0)
ctx.rel_line_to(0, height + 20)
--- 13,22 ----
ctx.select_font('sans-serif')
ctx.scale_font(48)
! (x, y, width, height, dx, dy) = ctx.text_extents('Hello World')
!
! ctx.translate (100, 100)
ctx.new_path()
! ctx.move_to(x-10,y-10)
ctx.rel_line_to(width + 20, 0)
ctx.rel_line_to(0, height + 20)
***************
*** 27,31 ****
ctx.stroke()
! ctx.move_to(20 + x, 20 + y)
ctx.set_rgb_color(0,0,0)
ctx.show_text('Hello World')
--- 26,30 ----
ctx.stroke()
! ctx.move_to(0, 0)
ctx.set_rgb_color(0,0,0)
ctx.show_text('Hello World')
More information about the cairo-commit
mailing list