[cairo-commit] pycairo/cairo pycairo-private.h, 1.9, 1.10 pycairo.h, 1.13, 1.14 pycairo-font.c, 1.8, 1.9 pycairo-context.c, 1.27, 1.28 pycairo-matrix.c, 1.5, 1.6

Steve Chaplin commit at pdx.freedesktop.org
Thu Apr 7 20:24:51 PDT 2005


Committed by: stevech1097

Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv20056/cairo

Modified Files:
	pycairo-private.h pycairo.h pycairo-font.c pycairo-context.c 
	pycairo-matrix.c 
Log Message:
SC 2005/04/08

Index: pycairo-private.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-private.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- pycairo-private.h	14 Dec 2004 03:43:01 -0000	1.9
+++ pycairo-private.h	8 Apr 2005 03:24:49 -0000	1.10
@@ -55,6 +55,6 @@
 PyObject *pycairo_context_wrap(cairo_t *ctx);
 PyObject *pycairo_surface_wrap(cairo_surface_t *surface);
 PyObject *pycairo_pattern_wrap(cairo_pattern_t *pattern);
-PyObject *pycairo_font_wrap(cairo_font_t *font);
+PyObject *pycairo_font_wrap(cairo_font_face_t *font);
 
 #endif /* _PYCAIRO_PRIVATE_H_ */

Index: pycairo.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- pycairo.h	2 Mar 2005 13:58:48 -0000	1.13
+++ pycairo.h	8 Apr 2005 03:24:49 -0000	1.14
@@ -62,7 +62,7 @@
 
 typedef struct {
     PyObject_HEAD
-    cairo_font_t *font;
+    cairo_font_face_t *font;
 } PyCairoFont;
 
 struct _PyCairo_FunctionStruct {
@@ -72,7 +72,7 @@
     PyTypeObject *surface_type;
     PyObject *(* surface_wrap)(cairo_surface_t *surface);
     PyTypeObject *font_type;
-    PyObject *(* font_wrap)(cairo_font_t *font);
+    PyObject *(* font_wrap)(cairo_font_face_t *font);
     PyTypeObject *context_type;
     PyObject *(* context_wrap)(cairo_t *ctx);
     PyTypeObject *pattern_type;

Index: pycairo-font.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-font.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- pycairo-font.c	19 Mar 2005 04:51:39 -0000	1.8
+++ pycairo-font.c	8 Apr 2005 03:24:49 -0000	1.9
@@ -38,13 +38,14 @@
 #include "pycairo-misc.h"
 
 PyObject *
-pycairo_font_wrap(cairo_font_t *font)
+pycairo_font_wrap(cairo_font_face_t *font)
 {
     PyCairoFont *self;
 
     self = PyObject_New(PyCairoFont, &PyCairoFont_Type);
     if (!self) {
-	cairo_font_destroy(font);
+	/*cairo_font_destroy(font);*/
+	cairo_font_face_destroy(font);
 	return NULL;
     }
 
@@ -57,7 +58,8 @@
 pycairo_font_dealloc(PyCairoFont *self)
 {
     if (self->font)
-	cairo_font_destroy(self->font);
+	/*cairo_font_destroy(self->font);*/
+	cairo_font_face_destroy(self->font);
     self->font = NULL;
 
     if (self->ob_type->tp_free)
@@ -69,16 +71,9 @@
 static PyObject *
 pycairo_font_extents(PyCairoFont *self, PyObject *args)
 {
-    PyCairoMatrix *py_matrix;
     cairo_font_extents_t extents;
 
-    if (!PyArg_ParseTuple(args, "O!:Font.extents",
-			  &PyCairoMatrix_Type, &py_matrix))
-	return NULL;
-
-    if (pycairo_check_status(cairo_font_extents
-			     (self->font, py_matrix->matrix, &extents)))
-	return NULL;
+    cairo_font_extents (self->font, &extents);
     return Py_BuildValue("(ddddd)", extents.ascent, extents.descent, 
 			 extents.height, extents.max_x_advance, 
 			 extents.max_y_advance);
@@ -86,7 +81,7 @@
 
 
 static PyMethodDef pycairo_font_methods[] = {
-    { "extents", (PyCFunction)pycairo_font_extents, METH_VARARGS },
+    { "extents", (PyCFunction)pycairo_font_extents, METH_NOARGS },
     /* TODO { "glyph_extents", (PyCFunction)pycairo_font_extents, METH_VARARGS },*/
     { NULL, NULL, 0 }
 };

Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- pycairo-context.c	7 Apr 2005 02:09:57 -0000	1.27
+++ pycairo-context.c	8 Apr 2005 03:24:49 -0000	1.28
@@ -767,46 +767,46 @@
 }
 
 static PyObject *
-pycairo_select_font(PyCairoContext *self, PyObject *args)
+pycairo_select_font_face(PyCairoContext *self, PyObject *args)
 {
     const char *family;
     cairo_font_slant_t slant = CAIRO_FONT_SLANT_NORMAL;
     cairo_font_weight_t weight = CAIRO_FONT_WEIGHT_NORMAL;
 
-    if (!PyArg_ParseTuple(args, "s|ii:Context.select_font",
+    if (!PyArg_ParseTuple(args, "s|ii:Context.select_font_face",
 			  &family, &slant, &weight))
 	return NULL;
 
-    cairo_select_font(self->ctx, family, slant, weight);
+    cairo_select_font_face(self->ctx, family, slant, weight);
     if (pycairo_check_status(cairo_status(self->ctx)))
 	return NULL;
     Py_RETURN_NONE;
 }
 
 static PyObject *
-pycairo_scale_font(PyCairoContext *self, PyObject *args)
+pycairo_set_font_size(PyCairoContext *self, PyObject *args)
 {
     double scale;
 
-    if (!PyArg_ParseTuple(args, "d:Context.scale_font", &scale))
+    if (!PyArg_ParseTuple(args, "d:Context.set_font_size", &scale))
 	return NULL;
 
-    cairo_scale_font(self->ctx, scale);
+    cairo_set_font_size(self->ctx, scale);
     if (pycairo_check_status(cairo_status(self->ctx)))
 	return NULL;
     Py_RETURN_NONE;
 }
 
 static PyObject *
-pycairo_transform_font(PyCairoContext *self, PyObject *args)
+pycairo_set_font_matrix(PyCairoContext *self, PyObject *args)
 {
     PyCairoMatrix *matrix;
 
-    if (!PyArg_ParseTuple(args, "O!:Context.transform_font",
+    if (!PyArg_ParseTuple(args, "O!:Context.set_font_matrix",
 			  &PyCairoMatrix_Type, &matrix))
 	return NULL;
 
-    cairo_transform_font(self->ctx, matrix->matrix);
+    cairo_set_font_matrix(self->ctx, matrix->matrix);
     if (pycairo_check_status(cairo_status(self->ctx)))
 	return NULL;
     Py_RETURN_NONE;
@@ -827,15 +827,15 @@
 }
 
 static PyObject *
-pycairo_set_font(PyCairoContext *self, PyObject *args)
+pycairo_set_font_face(PyCairoContext *self, PyObject *args)
 {
     PyCairoFont *font;
 
-    if (!PyArg_ParseTuple(args, "O!:Context.set_font",
+    if (!PyArg_ParseTuple(args, "O!:Context.set_font_face",
 			  &PyCairoFont_Type, &font))
 	return NULL;
 
-    cairo_set_font(self->ctx, font->font);
+    cairo_set_font_face(self->ctx, font->font);
     if (pycairo_check_status(cairo_status(self->ctx)))
 	return NULL;
     Py_RETURN_NONE;
@@ -859,11 +859,11 @@
 }
 
 static PyObject *
-pycairo_get_font_extents(PyCairoContext *self)
+pycairo_font_extents(PyCairoContext *self)
 {
     cairo_font_extents_t extents;
 
-    cairo_get_font_extents(self->ctx, &extents);
+    cairo_font_extents(self->ctx, &extents);
     if (pycairo_check_status(cairo_status(self->ctx)))
 	return NULL;
     return Py_BuildValue("(ddddd)", extents.ascent, extents.descent, 
@@ -888,16 +888,17 @@
 }
 
 static PyObject *
-pycairo_get_font(PyCairoContext *self)
+pycairo_get_font_face(PyCairoContext *self)
 {
-    cairo_font_t *font;
+    cairo_font_face_t *font;
 
-    font = cairo_get_font(self->ctx);
+    font = cairo_get_font_face(self->ctx);
     if (!font){
 	pycairo_check_status(cairo_status(self->ctx));
 	return NULL;
     }
-    cairo_font_reference(font);
+    /*cairo_font_reference(font);*/
+    cairo_font_face_reference(font);
     return pycairo_font_wrap(font);
 }
 
@@ -968,18 +969,6 @@
 }
 
 static PyObject *
-pycairo_get_matrix(PyCairoContext *self)
-{
-    cairo_matrix_t *matrix;
-
-    matrix = cairo_matrix_create();
-    if (!matrix)
-	return PyErr_NoMemory();
-    cairo_get_matrix(self->ctx, matrix);
-    return pycairo_matrix_wrap(matrix);
-}
-
-static PyObject *
 pycairo_get_target_surface(PyCairoContext *self)
 {
     cairo_surface_t *surface;
@@ -1152,12 +1141,13 @@
     { "rotate",        (PyCFunction)pycairo_rotate,        METH_VARARGS },
     { "save",          (PyCFunction)pycairo_save,          METH_NOARGS },
     { "scale",         (PyCFunction)pycairo_scale,         METH_VARARGS },
-    { "scale_font",    (PyCFunction)pycairo_scale_font,    METH_VARARGS },
-    { "select_font",   (PyCFunction)pycairo_select_font,   METH_VARARGS },
+    { "select_font_face",(PyCFunction)pycairo_select_font_face,METH_VARARGS },
     { "set_alpha",     (PyCFunction)pycairo_set_alpha,     METH_VARARGS },
     { "set_dash",      (PyCFunction)pycairo_set_dash,      METH_VARARGS },
     { "set_fill_rule", (PyCFunction)pycairo_set_fill_rule, METH_VARARGS },
-    { "set_font",      (PyCFunction)pycairo_set_font,      METH_VARARGS },
+    { "set_font_face", (PyCFunction)pycairo_set_font_face, METH_VARARGS },
+    { "set_font_matrix",(PyCFunction)pycairo_set_font_matrix,METH_VARARGS },
+    { "set_font_size", (PyCFunction)pycairo_set_font_size, METH_VARARGS },
     { "set_line_cap",  (PyCFunction)pycairo_set_line_cap,  METH_VARARGS },
     { "set_line_join", (PyCFunction)pycairo_set_line_join, METH_VARARGS },
     { "set_line_width",(PyCFunction)pycairo_set_line_width,METH_VARARGS },
@@ -1186,7 +1176,6 @@
     { "text_extents",  (PyCFunction)pycairo_text_extents,  METH_VARARGS },
     { "text_path",     (PyCFunction)pycairo_text_path,     METH_VARARGS },
     { "transform",     (PyCFunction)pycairo_transform,     METH_VARARGS },
-    { "transform_font",(PyCFunction)pycairo_transform_font,METH_VARARGS },
     { "translate",     (PyCFunction)pycairo_translate,     METH_VARARGS },
     { "user_to_device",(PyCFunction)pycairo_user_to_device,METH_VARARGS },
     { "user_to_device_distance",(PyCFunction)pycairo_user_to_device_distance,
@@ -1198,12 +1187,12 @@
     { "alpha",          (getter)pycairo_get_alpha,        (setter)0 },
     { "fill_extents",   (getter)pycairo_fill_extents,     (setter)0 },
     { "fill_rule",      (getter)pycairo_get_fill_rule,    (setter)0 },
-    { "font",           (getter)pycairo_get_font,         (setter)0 },
-    { "font_extents",   (getter)pycairo_get_font_extents, (setter)0 },
+    { "font_face",      (getter)pycairo_get_font_face,    (setter)0 },
+    { "font_extents",   (getter)pycairo_font_extents,     (setter)0 },
+    /* (get_)font_matrix */
     { "line_cap",       (getter)pycairo_get_line_cap,     (setter)0 },
     { "line_join",      (getter)pycairo_get_line_join,    (setter)0 },
     { "line_width",     (getter)pycairo_get_line_width,   (setter)0 },
-    { "matrix",         (getter)pycairo_get_matrix,       (setter)0 },
     { "miter_limit",    (getter)pycairo_get_miter_limit,  (setter)0 },
     { "operator",       (getter)pycairo_get_operator,     (setter)0 },
     { "pattern",        (getter)pycairo_get_pattern,      (setter)0 },

Index: pycairo-matrix.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-matrix.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pycairo-matrix.c	10 Dec 2004 13:03:35 -0000	1.5
+++ pycairo-matrix.c	8 Apr 2005 03:24:49 -0000	1.6
@@ -43,7 +43,7 @@
 
     self = PyObject_New(PyCairoMatrix, &PyCairoMatrix_Type);
     if (!self) {
-	cairo_matrix_destroy(matrix);
+	cairo_matrix_destroy(matrix); /* deprecated */
 	return NULL;
     }
 
@@ -58,7 +58,7 @@
     static char *kwlist[] = { "a", "b", "c", "d", "tx", "ty", NULL };
     double a = 1.0, b = 0.0, c = 0.0, d = 1.0, tx = 0.0, ty = 0.0;
 
-    self->matrix = cairo_matrix_create();
+    self->matrix = cairo_matrix_create(); /* deprecated */
     if (!self->matrix) {
 	PyErr_SetString(PyExc_RuntimeError, "could not create matrix");
 	return -1;
@@ -69,7 +69,8 @@
 				     &a, &b, &c, &d, &tx, &ty))
 	return -1;
 
-    cairo_matrix_set_affine(self->matrix, a, b, c, d, tx, ty);
+    /*cairo_matrix_set_affine(self->matrix, a, b, c, d, tx, ty);*/
+    cairo_matrix_init(self->matrix, a, b, c, d, tx, ty);
 
     return 0;
 }
@@ -78,7 +79,7 @@
 pycairo_matrix_dealloc(PyCairoMatrix *self)
 {
     if (self->matrix)
-	cairo_matrix_destroy(self->matrix);
+	cairo_matrix_destroy(self->matrix); /* deprecated */
     self->matrix = NULL;
 
     if (self->ob_type->tp_free)
@@ -93,7 +94,7 @@
     char buf[256];
     double a, b, c, d, tx, ty;
 
-    cairo_matrix_get_affine(self->matrix, &a, &b, &c, &d, &tx, &ty);
+    cairo_matrix_get_affine(self->matrix, &a, &b, &c, &d, &tx, &ty); /* deprecated */
     PyOS_snprintf(buf, sizeof(buf), "cairo.Matrix(%g, %g, %g, %g, %g, %g)",
 		  a, b, c, d, tx, ty);
     return PyString_FromString(buf);
@@ -113,8 +114,8 @@
 	return Py_NotImplemented;
     }
 
-    cairo_matrix_get_affine(self->matrix, &a1, &b1, &c1, &d1, &tx1, &ty1);
-    cairo_matrix_get_affine(other->matrix, &a2, &b2, &c2, &d2, &tx2, &ty2);
+    cairo_matrix_get_affine(self->matrix, &a1, &b1, &c1, &d1, &tx1, &ty1); /* deprecated */
+    cairo_matrix_get_affine(other->matrix, &a2, &b2, &c2, &d2, &tx2, &ty2); /* deprecated */
     equal = a1 == a2 &&	b1 == b2 && c1 == c2 && d1 == d2 &&
 	tx1 == tx2 && ty1 == ty2;
 
@@ -131,7 +132,7 @@
 {
     cairo_matrix_t *result;
 
-    result = cairo_matrix_create();
+    result = cairo_matrix_create(); /* deprecated */
     if (!result)
 	return PyErr_NoMemory();
 
@@ -174,7 +175,7 @@
     if (!PyArg_ParseTuple(args, "dd:Matrix.translate", &tx, &ty))
 	return NULL;
     
-    other = cairo_matrix_create();
+    other = cairo_matrix_create(); /* deprecated */
     if (!other)
 	return PyErr_NoMemory();
 
@@ -192,7 +193,7 @@
     if (!PyArg_ParseTuple(args, "dd:Matrix.scale", &sx, &sy))
 	return NULL;
     
-    other = cairo_matrix_create();
+    other = cairo_matrix_create(); /* deprecated */
     if (!other)
 	return PyErr_NoMemory();
 
@@ -210,7 +211,7 @@
     if (!PyArg_ParseTuple(args, "d:Matrix.rotate", &radians))
 	return NULL;
     
-    other = cairo_matrix_create();
+    other = cairo_matrix_create(); /* deprecated */
     if (!other)
 	return PyErr_NoMemory();
 
@@ -224,13 +225,13 @@
 {
     cairo_matrix_t *other;
 
-    other = cairo_matrix_create();
+    other = cairo_matrix_create(); /* deprecated */
     if (!other)
 	return PyErr_NoMemory();
 
     cairo_matrix_copy(other, self->matrix);
     if (pycairo_check_status(cairo_matrix_invert(other))) {
-	cairo_matrix_destroy(other);
+	cairo_matrix_destroy(other); /* deprecated */
 	return NULL;
     }
     return pycairo_matrix_wrap(other);
@@ -261,14 +262,14 @@
 }
 
 static PyMethodDef pycairo_matrix_methods[] = {
-    { "translate", (PyCFunction)pycairo_matrix_translate, METH_VARARGS },
-    { "scale", (PyCFunction)pycairo_matrix_scale, METH_VARARGS },
-    { "rotate", (PyCFunction)pycairo_matrix_rotate, METH_VARARGS },
     { "invert", (PyCFunction)pycairo_matrix_invert, METH_VARARGS },
+    { "rotate", (PyCFunction)pycairo_matrix_rotate, METH_VARARGS },
+    { "scale", (PyCFunction)pycairo_matrix_scale, METH_VARARGS },
     { "transform_distance", (PyCFunction)pycairo_matrix_transform_distance,
       METH_VARARGS },
     { "transform_point", (PyCFunction)pycairo_matrix_transform_point,
       METH_VARARGS },
+    { "translate", (PyCFunction)pycairo_matrix_translate, METH_VARARGS },
     { NULL, NULL, 0 }
 };
 




More information about the cairo-commit mailing list