[cairo-commit] pycairo/cairo pycairo-font.c, 1.6,
1.7 pycairo-context.c, 1.18, 1.19 cairomodule.c, 1.11, 1.12
Steve Chaplin
commit at pdx.freedesktop.org
Thu Mar 10 00:29:54 PST 2005
Committed by: stevech1097
Update of /cvs/cairo/pycairo/cairo
In directory gabe:/tmp/cvs-serv14081/cairo
Modified Files:
pycairo-font.c pycairo-context.c cairomodule.c
Log Message:
SC 2005/03/10
Index: pycairo-font.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-font.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pycairo-font.c 26 Jan 2005 08:13:34 -0000 1.6
+++ pycairo-font.c 10 Mar 2005 08:29:52 -0000 1.7
@@ -66,39 +66,29 @@
PyObject_Del(self);
}
-/*
static PyObject *
-pycairo_font_set_transform(PyCairoFont *self, PyObject *args)
+pycairo_font_extents(PyCairoFont *self, PyObject *args)
{
PyCairoMatrix *matrix;
+ cairo_font_extents_t extents;
- if (!PyArg_ParseTuple(args, "O!:Font.set_transform",
+ if (!PyArg_ParseTuple(args, "O!:Font.extents",
&PyCairoMatrix_Type, &matrix))
return NULL;
- cairo_font_set_transform(self->font, matrix->matrix);
- Py_RETURN_NONE;
+ if (pycairo_check_status(cairo_font_extents(self->font, matrix, &extents)))
+ return NULL;
+ return Py_BuildValue("(ddddd)", extents.ascent, extents.descent, extents.height, extents.max_x_advance, extents.max_y_advance);
}
-static PyObject *
-pycairo_font_current_transform(PyCairoFont *self)
-{
- cairo_matrix_t *matrix;
- matrix = cairo_matrix_create();
- if (!matrix)
- return PyErr_NoMemory();
- cairo_font_current_transform(self->font, matrix);
- return pycairo_matrix_wrap(matrix);
-}
-*/
static PyMethodDef pycairo_font_methods[] = {
- /* { "set_transform", (PyCFunction)pycairo_font_set_transform, METH_VARARGS },*/
+ { "extents", (PyCFunction)pycairo_font_extents, METH_VARARGS },
+ /* TODO { "glyph_extents", (PyCFunction)pycairo_font_extents, METH_VARARGS },*/
{ NULL, NULL, 0 }
};
static PyGetSetDef pycairo_font_getsets[] = {
- /* { "transform", (getter)pycairo_font_current_transform, (setter)0 },*/
{ NULL, (getter)0, (setter)0 }
};
Index: pycairo-context.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-context.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- pycairo-context.c 12 Jan 2005 07:09:05 -0000 1.18
+++ pycairo-context.c 10 Mar 2005 08:29:52 -0000 1.19
@@ -917,9 +917,10 @@
cairo_font_t *font;
font = cairo_current_font(self->ctx);
- if (!font)
- Py_RETURN_NONE;
-
+ if (!font){
+ pycairo_check_status(cairo_status(self->ctx));
+ return NULL;
+ }
cairo_font_reference(font);
return pycairo_font_wrap(font);
}
@@ -1222,23 +1223,23 @@
};
static PyGetSetDef pycairo_getsets[] = {
- { "alpha", (getter)pycairo_current_alpha, (setter)0 },
- { "fill_extents", (getter)pycairo_fill_extents, (setter)0 },
- { "fill_rule", (getter)pycairo_current_fill_rule, (setter)0 },
- { "font", (getter)pycairo_current_font, (setter)0 },
- { "font_extents", (getter)pycairo_current_font_extents, (setter)0 },
- { "line_cap", (getter)pycairo_current_line_cap, (setter)0 },
- { "line_join", (getter)pycairo_current_line_join, (setter)0 },
- { "line_width", (getter)pycairo_current_line_width, (setter)0 },
- { "matrix", (getter)pycairo_current_matrix, (setter)0 },
- { "miter_limit", (getter)pycairo_current_miter_limit, (setter)0 },
- { "operator", (getter)pycairo_current_operator, (setter)0 },
- { "pattern", (getter)pycairo_current_pattern, (setter)0 },
- { "point", (getter)pycairo_current_point, (setter)0 },
- { "rgb_color", (getter)pycairo_current_rgb_color, (setter)0 },
- { "stroke_extents", (getter)pycairo_stroke_extents, (setter)0 },
+ { "alpha", (getter)pycairo_current_alpha, (setter)0 },
+ { "fill_extents", (getter)pycairo_fill_extents, (setter)0 },
+ { "fill_rule", (getter)pycairo_current_fill_rule, (setter)0 },
+ { "font", (getter)pycairo_current_font, (setter)0 },
+ { "font_extents", (getter)pycairo_current_font_extents, (setter)0 },
+ { "line_cap", (getter)pycairo_current_line_cap, (setter)0 },
+ { "line_join", (getter)pycairo_current_line_join, (setter)0 },
+ { "line_width", (getter)pycairo_current_line_width, (setter)0 },
+ { "matrix", (getter)pycairo_current_matrix, (setter)0 },
+ { "miter_limit", (getter)pycairo_current_miter_limit, (setter)0 },
+ { "operator", (getter)pycairo_current_operator, (setter)0 },
+ { "pattern", (getter)pycairo_current_pattern, (setter)0 },
+ { "point", (getter)pycairo_current_point, (setter)0 },
+ { "rgb_color", (getter)pycairo_current_rgb_color, (setter)0 },
+ { "stroke_extents", (getter)pycairo_stroke_extents, (setter)0 },
{ "target_surface", (getter)pycairo_current_target_surface, (setter)0 },
- { "tolerance", (getter)pycairo_current_tolerance, (setter)0 },
+ { "tolerance", (getter)pycairo_current_tolerance, (setter)0 },
{ NULL, (getter)0, (setter)0 }
};
Index: cairomodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairomodule.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- cairomodule.c 12 Jan 2005 03:45:04 -0000 1.11
+++ cairomodule.c 10 Mar 2005 08:29:52 -0000 1.12
@@ -65,6 +65,9 @@
case CAIRO_STATUS_NULL_POINTER:
PyErr_SetString(PyExc_RuntimeError, "NULL pointer");
return 1;
+ case CAIRO_STATUS_INVALID_STRING:
+ PyErr_SetString(PyExc_RuntimeError, "invalid string");
+ return 1;
default:
PyErr_SetString(PyExc_RuntimeError, "other cairo error");
return 1;
More information about the cairo-commit
mailing list