[cairo-commit] pycairo/cairo pycairo-context.c,1.3,1.4

Carl Worth commit at pdx.freedesktop.org
Thu Apr 29 06:50:14 PDT 2004


Committed by: cworth

Update of /cvs/cairo/pycairo/cairo
In directory pdx:/tmp/cvs-serv28030/cairo

Modified Files:
	pycairo-context.c 
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: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/pycairo-context.c	28 Oct 2003 15:53:13 -0000	1.3
--- b/pycairo-context.c	29 Apr 2004 13:50:10 -0000	1.4
***************
*** 728,747 ****
  }
  
- #if 0
  static PyObject *
  pycairo_text_extents(PyCairoContext *self, PyObject *args)
  {
      const unsigned char *utf8;
!     double x, y, width, height, dx, dy;
  
      if (!PyArg_ParseTuple(args, "s:Context.text_extents", &utf8))
  	return NULL;
  
!     cairo_text_extents(self->ctx, utf8, &x, &y, &width, &height, &dx, &dy);
      if (pycairo_check_status(cairo_status(self->ctx)))
  	return NULL;
!     return Py_BuildValue("(dddddd)", x, y, width, height, dx, dy);
  }
- #endif
  
  static PyObject *
--- 728,745 ----
  }
  
  static PyObject *
  pycairo_text_extents(PyCairoContext *self, PyObject *args)
  {
      const unsigned char *utf8;
!     cairo_text_extents_t extents;
  
      if (!PyArg_ParseTuple(args, "s:Context.text_extents", &utf8))
  	return NULL;
  
!     cairo_text_extents(self->ctx, utf8, &extents);
      if (pycairo_check_status(cairo_status(self->ctx)))
  	return NULL;
!     return Py_BuildValue("(dddddd)", extents.x_bearing, extents.y_bearing, extents.width, extents.height, extents.x_advance, extents.y_advance);
  }
  
  static PyObject *
***************
*** 812,818 ****
      { "show_text", (PyCFunction)pycairo_show_text, METH_VARARGS },
      { "set_font", (PyCFunction)pycairo_set_font, METH_VARARGS },
- #if 0
      { "text_extents", (PyCFunction)pycairo_text_extents, METH_VARARGS },
- #endif
      { "show_surface", (PyCFunction)pycairo_show_surface, METH_VARARGS },
      { NULL, NULL, 0 }
--- 810,814 ----





More information about the cairo-commit mailing list