Example #1
0
static PyObject *
scaled_font_get_font_face (PycairoScaledFont *o)
{
    return PycairoFontFace_FromFontFace (
               cairo_font_face_reference (
		   cairo_scaled_font_get_font_face (o->scaled_font)));
}
static PyObject *
pycairo_get_font_face (PycairoContext *o)
{
    cairo_font_face_t *font_face = cairo_get_font_face (o->ctx);
    cairo_font_face_reference (font_face);
    return PycairoFontFace_FromFontFace (font_face);
}
Example #3
0
static PyObject *
toy_font_face_new (PyTypeObject *type, PyObject *args, PyObject *kwds)
{
    PyObject *obj;
    PyObject *pyUTF8 = NULL;
    const char *utf8family = NULL;
    cairo_font_slant_t slant   = CAIRO_FONT_SLANT_NORMAL;
    cairo_font_weight_t weight = CAIRO_FONT_WEIGHT_NORMAL;

    if (!PyArg_ParseTuple(args, "O!|ii:ToyFontFace.__new__",
			  &PyBaseString_Type, &obj, &slant, &weight))
	return NULL;

    /* accept str and unicode family, auto convert to utf8 as required */
    if (PyString_Check(obj)) {
	/* A plain ASCII string is also a valid UTF-8 string */
	utf8family = PyString_AS_STRING(obj);
    } else if (PyUnicode_Check(obj)) {
	pyUTF8 = PyUnicode_AsUTF8String(obj);
	if (pyUTF8 != NULL) {
	    utf8family = PyString_AS_STRING(pyUTF8);
	}
    } else {
	PyErr_SetString(PyExc_TypeError,
	    "ToyFontFace.__new__: family must be str or unicode");
    }
    if (utf8family == NULL)
	return NULL;

    PyObject *o = PycairoFontFace_FromFontFace (
		cairo_toy_font_face_create (utf8family, slant, weight));
    Py_XDECREF(pyUTF8);
    return o;
}
static PyObject * 
deepin_font_icon_font_face_create(PyObject *self, PyObject *args) {
    gchar *fontfile;
    if (!(PyArg_ParseTuple(args, "s", &fontfile))) {
        return NULL;
    }

    PyObject *obj = PycairoFontFace_FromFontFace(font_face_create(fontfile));
    Py_INCREF(obj);
    return (PyObject *)obj;
}
Example #5
0
static PyObject *
pycairo_get_font_face (PycairoContext *o) {
  return PycairoFontFace_FromFontFace (
       cairo_font_face_reference (cairo_get_font_face (o->ctx)));
}