[cairo-commit] pycairo/cairo pycairo-context.c, 1.70,
1.71 pycairo-private.h, 1.36, 1.37 pycairo-font.c, 1.31, 1.32
Steve Chaplin
commit at pdx.freedesktop.org
Sat Apr 29 03:32:46 PDT 2006
- Previous message: [cairo-commit] pycairo/cairo pycairo-context.c, 1.69,
1.70 pycairo-font.c, 1.30, 1.31 pycairo-pattern.c, 1.31,
1.32 pycairo-surface.c, 1.64, 1.65
- Next message: [cairo-commit] pycairo ChangeLog,1.204,1.205
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory kemper:/tmp/cvs-serv19073/cairo
Modified Files:
pycairo-context.c pycairo-private.h pycairo-font.c
Log Message:
'SC'
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- pycairo-context.c 29 Apr 2006 07:26:08 -0000 1.70
+++ pycairo-context.c 29 Apr 2006 10:32:44 -0000 1.71
@@ -38,7 +38,7 @@
/* Take a PyBaseString (str or unicode) object and return a pointer to the
* UTF-8 encoded string.
*/
-static char *
+char *
__PyBaseString_AsUTF8 (PyObject *o)
{
if (PyString_Check(o)) {
@@ -526,6 +526,15 @@
}
static PyObject *
+pycairo_new_sub_path (PycairoContext *o)
+{
+ cairo_new_sub_path (o->ctx);
+ if (Pycairo_Check_Status (cairo_status (o->ctx)))
+ return NULL;
+ Py_RETURN_NONE;
+}
+
+static PyObject *
pycairo_paint (PycairoContext *o)
{
cairo_paint (o->ctx);
@@ -1172,6 +1181,7 @@
{"mask_surface", (PyCFunction)pycairo_mask_surface, METH_VARARGS},
{"move_to", (PyCFunction)pycairo_move_to, METH_VARARGS},
{"new_path", (PyCFunction)pycairo_new_path, METH_NOARGS},
+ {"new_sub_path", (PyCFunction)pycairo_new_sub_path, METH_NOARGS},
{"paint", (PyCFunction)pycairo_paint, METH_NOARGS},
{"paint_with_alpha",(PyCFunction)pycairo_paint_with_alpha,METH_VARARGS},
{"get_current_point",(PyCFunction)pycairo_get_current_point,METH_NOARGS},
@@ -1198,6 +1208,7 @@
{"set_matrix", (PyCFunction)pycairo_set_matrix, METH_VARARGS},
{"set_miter_limit", (PyCFunction)pycairo_set_miter_limit,METH_VARARGS},
{"set_operator", (PyCFunction)pycairo_set_operator, METH_VARARGS},
+ /* set_scaled_font */
{"set_source", (PyCFunction)pycairo_set_source, METH_VARARGS},
{"set_source_rgb", (PyCFunction)pycairo_set_source_rgb, METH_VARARGS},
{"set_source_rgba", (PyCFunction)pycairo_set_source_rgba,METH_VARARGS},
Index: pycairo-private.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-private.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- pycairo-private.h 25 Apr 2006 02:45:59 -0000 1.36
+++ pycairo-private.h 29 Apr 2006 10:32:44 -0000 1.37
@@ -41,6 +41,8 @@
#include "pycairo.h"
+char * __PyBaseString_AsUTF8 (PyObject *o);
+
extern PyTypeObject PycairoContext_Type;
PyObject *PycairoContext_FromContext (cairo_t *ctx, PyTypeObject *type,
PyObject *base);
Index: pycairo-font.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-font.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- pycairo-font.c 29 Apr 2006 07:26:08 -0000 1.31
+++ pycairo-font.c 29 Apr 2006 10:32:44 -0000 1.32
@@ -240,6 +240,26 @@
cairo_scaled_font_get_font_face (o->scaled_font)));
}
+static PyObject *
+scaled_font_text_extents (PycairoScaledFont *o, PyObject *obj)
+{
+ cairo_text_extents_t extents;
+ const char *utf8 = __PyBaseString_AsUTF8 (obj);
+ if (utf8 == NULL) {
+ PyErr_SetString(PyExc_TypeError,
+ "ScaledFont.text_extents() argument must be a string or "
+ "unicode object");
+ return NULL;
+ }
+
+ cairo_scaled_font_text_extents (o->scaled_font, utf8, &extents);
+ if (Pycairo_Check_Status (cairo_scaled_font_status(o->scaled_font)))
+ return NULL;
+ return Py_BuildValue("(dddddd)", extents.x_bearing, extents.y_bearing,
+ extents.width, extents.height, extents.x_advance,
+ extents.y_advance);
+}
+
static PyMethodDef scaled_font_methods[] = {
/* methods never exposed in a language binding:
* cairo_scaled_font_destroy()
@@ -247,13 +267,14 @@
* cairo_scaled_font_reference()
*
* TODO if requested:
- * cairo_scaled_font_get_font_matrix
* cairo_scaled_font_get_ctm
+ * cairo_scaled_font_get_font_matrix
* cairo_scaled_font_get_font_options
+ * cairo_scaled_font_glyph_extents
*/
- {"extents", (PyCFunction)scaled_font_extents, METH_NOARGS},
+ {"extents", (PyCFunction)scaled_font_extents, METH_NOARGS},
{"get_font_face", (PyCFunction)scaled_font_get_font_face, METH_NOARGS},
- /* glyph_extents - undocumented */
+ {"text_extents", (PyCFunction)scaled_font_text_extents, METH_O},
{NULL, NULL, 0, NULL},
};
- Previous message: [cairo-commit] pycairo/cairo pycairo-context.c, 1.69,
1.70 pycairo-font.c, 1.30, 1.31 pycairo-pattern.c, 1.31,
1.32 pycairo-surface.c, 1.64, 1.65
- Next message: [cairo-commit] pycairo ChangeLog,1.204,1.205
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the cairo-commit
mailing list