[cairo-commit] pycairo/cairo pycairo.h, 1.43, 1.44 cairomodule.c, 1.50, 1.51 pycairo-font.c, 1.28, 1.29

Steve Chaplin commit at pdx.freedesktop.org
Sun Jan 22 19:59:20 PST 2006


Committed by: stevech1097

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

Modified Files:
	pycairo.h cairomodule.c pycairo-font.c 
Log Message:
'SC'

Index: pycairo.h
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- pycairo.h	14 Dec 2005 04:47:02 -0000	1.43
+++ pycairo.h	23 Jan 2006 03:59:18 -0000	1.44
@@ -125,6 +125,7 @@
     PyTypeObject *ImageSurface_Type;
     PyTypeObject *PDFSurface_Type;
     PyTypeObject *PSSurface_Type;
+    PyTypeObject *SVGSurface_Type;
     PyTypeObject *Win32Surface_Type;
     PyObject *(*Surface_FromSurface)(cairo_surface_t *surface,
 				     PyTypeObject *type, PyObject *base);

Index: cairomodule.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/cairomodule.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -d -r1.50 -r1.51
--- cairomodule.c	14 Dec 2005 04:47:02 -0000	1.50
+++ cairomodule.c	23 Jan 2006 03:59:18 -0000	1.51
@@ -378,6 +378,16 @@
     CONSTANT(FORMAT_A8);
     CONSTANT(FORMAT_A1);
 
+    CONSTANT(HINT_METRICS_DEFAULT);
+    CONSTANT(HINT_METRICS_OFF);
+    CONSTANT(HINT_METRICS_ON);
+
+    CONSTANT(HINT_STYLE_DEFAULT);
+    CONSTANT(HINT_STYLE_NONE);
+    CONSTANT(HINT_STYLE_SLIGHT);
+    CONSTANT(HINT_STYLE_MEDIUM);
+    CONSTANT(HINT_STYLE_FULL);
+
     CONSTANT(LINE_CAP_BUTT);
     CONSTANT(LINE_CAP_ROUND);
     CONSTANT(LINE_CAP_SQUARE);
@@ -408,5 +418,11 @@
     CONSTANT(PATH_LINE_TO);
     CONSTANT(PATH_CURVE_TO);
     CONSTANT(PATH_CLOSE_PATH);
+
+    CONSTANT(SUBPIXEL_ORDER_DEFAULT);
+    CONSTANT(SUBPIXEL_ORDER_RGB);
+    CONSTANT(SUBPIXEL_ORDER_BGR);
+    CONSTANT(SUBPIXEL_ORDER_VRGB);
+    CONSTANT(SUBPIXEL_ORDER_VBGR);
 #undef CONSTANT
 }

Index: pycairo-font.c
===================================================================
RCS file: /cvs/cairo/pycairo/cairo/pycairo-font.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- pycairo-font.c	19 Aug 2005 02:46:54 -0000	1.28
+++ pycairo-font.c	23 Jan 2006 03:59:18 -0000	1.29
@@ -349,21 +349,115 @@
     return o;
 }
 
+static PyObject *
+font_options_get_antialias (PycairoFontOptions *o)
+{
+    return PyInt_FromLong (cairo_font_options_get_antialias (o->font_options));
+}
+
+static PyObject *
+font_options_get_hint_metrics (PycairoFontOptions *o)
+{
+    return PyInt_FromLong (cairo_font_options_get_hint_metrics
+			   (o->font_options));
+}
+
+static PyObject *
+font_options_get_hint_style (PycairoFontOptions *o)
+{
+    return PyInt_FromLong (cairo_font_options_get_hint_style
+			   (o->font_options));
+}
+
+static PyObject *
+font_options_get_subpixel_order (PycairoFontOptions *o)
+{
+    return PyInt_FromLong (cairo_font_options_get_subpixel_order
+			   (o->font_options));
+}
+
+static PyObject *
+font_options_set_antialias (PycairoFontOptions *o, PyObject *args)
+{
+    cairo_antialias_t aa = CAIRO_ANTIALIAS_DEFAULT;
+
+    if (!PyArg_ParseTuple(args, "|i:FontOptions.set_antialias", &aa))
+	return NULL;
+
+    cairo_font_options_set_antialias (o->font_options, aa);
+    if (Pycairo_Check_Status (cairo_font_options_status (o->font_options)))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
+static PyObject *
+font_options_set_hint_metrics (PycairoFontOptions *o, PyObject *args)
+{
+    cairo_hint_metrics_t hm = CAIRO_HINT_METRICS_DEFAULT;
+
+    if (!PyArg_ParseTuple(args, "|i:FontOptions.set_hint_metrics", &hm))
+	return NULL;
+
+    cairo_font_options_set_hint_metrics (o->font_options, hm);
+    if (Pycairo_Check_Status (cairo_font_options_status (o->font_options)))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
+static PyObject *
+font_options_set_hint_style (PycairoFontOptions *o, PyObject *args)
+{
+    cairo_hint_style_t hs = CAIRO_HINT_STYLE_DEFAULT;
+
+    if (!PyArg_ParseTuple(args, "|i:FontOptions.set_hint_style", &hs))
+	return NULL;
+
+    cairo_font_options_set_hint_style (o->font_options, hs);
+    if (Pycairo_Check_Status (cairo_font_options_status (o->font_options)))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
+static PyObject *
+font_options_set_subpixel_order (PycairoFontOptions *o, PyObject *args)
+{
+    cairo_subpixel_order_t so = CAIRO_SUBPIXEL_ORDER_DEFAULT;
+
+    if (!PyArg_ParseTuple(args, "|i:FontOptions.set_subpixel_order", &so))
+	return NULL;
+
+    cairo_font_options_set_subpixel_order (o->font_options, so);
+    if (Pycairo_Check_Status (cairo_font_options_status (o->font_options)))
+	return NULL;
+    Py_RETURN_NONE;
+}
+
 
 static PyMethodDef font_options_methods[] = {
     /* methods never exposed in a language binding:
      * cairo_font_options_destroy()
      * cairo_font_options_reference()
      */
-    /* TODO:
-     * copy
-     * merge
-     * equal (richcmp?)
-     * set/get_antialias
-     * set/get_subpixel_order
-     * set/get_hint_style
-     * set/get_hint_metrics
-     */
+    /* TODO: */
+    /* copy */
+    /* merge */
+    /* equal (richcmp?) */
+    {"get_antialias",     (PyCFunction)font_options_get_antialias,
+     METH_NOARGS},
+    {"get_hint_metrics",  (PyCFunction)font_options_get_hint_metrics,
+     METH_NOARGS},
+    {"get_hint_style",    (PyCFunction)font_options_get_hint_style,
+     METH_NOARGS},
+    {"get_subpixel_order",(PyCFunction)font_options_get_subpixel_order,
+     METH_NOARGS},
+    {"set_antialias",     (PyCFunction)font_options_set_antialias,
+     METH_VARARGS},
+    {"set_hint_metrics",  (PyCFunction)font_options_set_hint_metrics,
+     METH_VARARGS},
+    {"set_hint_style",    (PyCFunction)font_options_set_hint_style,
+     METH_VARARGS},
+    {"set_subpixel_order",(PyCFunction)font_options_set_subpixel_order,
+     METH_VARARGS},
     {NULL, NULL, 0, NULL},
 };
 



More information about the cairo-commit mailing list