Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 1 | |
| 2 | /* Font Manager module */ |
| 3 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 4 | #include "Python.h" |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 5 | |
| 6 | #include <gl.h> |
| 7 | #include <device.h> |
| 8 | #include <fmclient.h> |
| 9 | |
| 10 | |
| 11 | /* Font Handle object implementation */ |
| 12 | |
| 13 | typedef struct { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 14 | PyObject_HEAD |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 15 | fmfonthandle fh_fh; |
| 16 | } fhobject; |
| 17 | |
Jeremy Hylton | 938ace6 | 2002-07-17 16:30:39 +0000 | [diff] [blame] | 18 | static PyTypeObject Fhtype; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 19 | |
| 20 | #define is_fhobject(v) ((v)->ob_type == &Fhtype) |
| 21 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 22 | static PyObject * |
Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 23 | newfhobject(fmfonthandle fh) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 24 | { |
| 25 | fhobject *fhp; |
| 26 | if (fh == NULL) { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 27 | PyErr_SetString(PyExc_RuntimeError, |
| 28 | "error creating new font handle"); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 29 | return NULL; |
| 30 | } |
Guido van Rossum | b18618d | 2000-05-03 23:44:39 +0000 | [diff] [blame] | 31 | fhp = PyObject_New(fhobject, &Fhtype); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 32 | if (fhp == NULL) |
| 33 | return NULL; |
| 34 | fhp->fh_fh = fh; |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 35 | return (PyObject *)fhp; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | /* Font Handle methods */ |
| 39 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 40 | static PyObject * |
Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 41 | fh_scalefont(fhobject *self, PyObject *args) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 42 | { |
| 43 | double size; |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 44 | if (!PyArg_ParseTuple(args, "d", &size)) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 45 | return NULL; |
| 46 | return newfhobject(fmscalefont(self->fh_fh, size)); |
| 47 | } |
| 48 | |
| 49 | /* XXX fmmakefont */ |
| 50 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 51 | static PyObject * |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 52 | fh_setfont(fhobject *self) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 53 | { |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 54 | fmsetfont(self->fh_fh); |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 55 | Py_INCREF(Py_None); |
| 56 | return Py_None; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 57 | } |
| 58 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 59 | static PyObject * |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 60 | fh_getfontname(fhobject *self) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 61 | { |
| 62 | char fontname[256]; |
| 63 | int len; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 64 | len = fmgetfontname(self->fh_fh, sizeof fontname, fontname); |
| 65 | if (len < 0) { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 66 | PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname"); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 67 | return NULL; |
| 68 | } |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 69 | return PyString_FromStringAndSize(fontname, len); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 70 | } |
| 71 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 72 | static PyObject * |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 73 | fh_getcomment(fhobject *self) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 74 | { |
| 75 | char comment[256]; |
| 76 | int len; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 77 | len = fmgetcomment(self->fh_fh, sizeof comment, comment); |
| 78 | if (len < 0) { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 79 | PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment"); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 80 | return NULL; |
| 81 | } |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 82 | return PyString_FromStringAndSize(comment, len); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 83 | } |
| 84 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 85 | static PyObject * |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 86 | fh_getfontinfo(fhobject *self) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 87 | { |
| 88 | fmfontinfo info; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 89 | if (fmgetfontinfo(self->fh_fh, &info) < 0) { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 90 | PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontinfo"); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 91 | return NULL; |
| 92 | } |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 93 | return Py_BuildValue("(llllllll)", |
| 94 | info.printermatched, |
| 95 | info.fixed_width, |
| 96 | info.xorig, |
| 97 | info.yorig, |
| 98 | info.xsize, |
| 99 | info.ysize, |
| 100 | info.height, |
| 101 | info.nglyphs); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 102 | } |
| 103 | |
| 104 | #if 0 |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 105 | static PyObject * |
Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 106 | fh_getwholemetrics(fhobject *self, PyObject *args) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 107 | { |
| 108 | } |
| 109 | #endif |
| 110 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 111 | static PyObject * |
Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 112 | fh_getstrwidth(fhobject *self, PyObject *args) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 113 | { |
Guido van Rossum | ef0a00e | 1992-01-27 16:51:30 +0000 | [diff] [blame] | 114 | char *str; |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 115 | if (!PyArg_ParseTuple(args, "s", &str)) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 116 | return NULL; |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 117 | return PyInt_FromLong(fmgetstrwidth(self->fh_fh, str)); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 118 | } |
| 119 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 120 | static PyMethodDef fh_methods[] = { |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 121 | {"scalefont", (PyCFunction)fh_scalefont, METH_VARARGS}, |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 122 | {"setfont", (PyCFunction)fh_setfont, METH_NOARGS}, |
| 123 | {"getfontname", (PyCFunction)fh_getfontname, METH_NOARGS}, |
| 124 | {"getcomment", (PyCFunction)fh_getcomment, METH_NOARGS}, |
| 125 | {"getfontinfo", (PyCFunction)fh_getfontinfo, METH_NOARGS}, |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 126 | #if 0 |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 127 | {"getwholemetrics", (PyCFunction)fh_getwholemetrics, METH_VARARGS}, |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 128 | #endif |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 129 | {"getstrwidth", (PyCFunction)fh_getstrwidth, METH_VARARGS}, |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 130 | {NULL, NULL} /* sentinel */ |
| 131 | }; |
| 132 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 133 | static PyObject * |
Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 134 | fh_getattr(fhobject *fhp, char *name) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 135 | { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 136 | return Py_FindMethod(fh_methods, (PyObject *)fhp, name); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 137 | } |
| 138 | |
| 139 | static void |
Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 140 | fh_dealloc(fhobject *fhp) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 141 | { |
| 142 | fmfreefont(fhp->fh_fh); |
Guido van Rossum | b18618d | 2000-05-03 23:44:39 +0000 | [diff] [blame] | 143 | PyObject_Del(fhp); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 144 | } |
| 145 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 146 | static PyTypeObject Fhtype = { |
| 147 | PyObject_HEAD_INIT(&PyType_Type) |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 148 | 0, /*ob_size*/ |
Guido van Rossum | 1464839 | 2001-12-08 18:02:58 +0000 | [diff] [blame] | 149 | "fm.font handle", /*tp_name*/ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 150 | sizeof(fhobject), /*tp_size*/ |
| 151 | 0, /*tp_itemsize*/ |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 152 | /* methods */ |
Guido van Rossum | b6775db | 1994-08-01 11:34:53 +0000 | [diff] [blame] | 153 | (destructor)fh_dealloc, /*tp_dealloc*/ |
| 154 | 0, /*tp_print*/ |
| 155 | (getattrfunc)fh_getattr, /*tp_getattr*/ |
| 156 | 0, /*tp_setattr*/ |
| 157 | 0, /*tp_compare*/ |
| 158 | 0, /*tp_repr*/ |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 159 | }; |
| 160 | |
| 161 | |
| 162 | /* Font Manager functions */ |
| 163 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 164 | static PyObject * |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 165 | fm_init(PyObject *self) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 166 | { |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 167 | fminit(); |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 168 | Py_INCREF(Py_None); |
| 169 | return Py_None; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 170 | } |
| 171 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 172 | static PyObject * |
Sjoerd Mullender | 0ae5284 | 2000-07-12 10:43:11 +0000 | [diff] [blame] | 173 | fm_findfont(PyObject *self, PyObject *args) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 174 | { |
Guido van Rossum | ef0a00e | 1992-01-27 16:51:30 +0000 | [diff] [blame] | 175 | char *str; |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 176 | if (!PyArg_ParseTuple(args, "s", &str)) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 177 | return NULL; |
Guido van Rossum | ef0a00e | 1992-01-27 16:51:30 +0000 | [diff] [blame] | 178 | return newfhobject(fmfindfont(str)); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 179 | } |
| 180 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 181 | static PyObject * |
Sjoerd Mullender | 0ae5284 | 2000-07-12 10:43:11 +0000 | [diff] [blame] | 182 | fm_prstr(PyObject *self, PyObject *args) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 183 | { |
Guido van Rossum | ef0a00e | 1992-01-27 16:51:30 +0000 | [diff] [blame] | 184 | char *str; |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 185 | if (!PyArg_ParseTuple(args, "s", &str)) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 186 | return NULL; |
Guido van Rossum | ef0a00e | 1992-01-27 16:51:30 +0000 | [diff] [blame] | 187 | fmprstr(str); |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 188 | Py_INCREF(Py_None); |
| 189 | return Py_None; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 190 | } |
| 191 | |
| 192 | /* XXX This uses a global variable as temporary! Not re-entrant! */ |
| 193 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 194 | static PyObject *fontlist; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 195 | |
| 196 | static void |
Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 197 | clientproc(char *fontname) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 198 | { |
| 199 | int err; |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 200 | PyObject *v; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 201 | if (fontlist == NULL) |
| 202 | return; |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 203 | v = PyString_FromString(fontname); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 204 | if (v == NULL) |
| 205 | err = -1; |
| 206 | else { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 207 | err = PyList_Append(fontlist, v); |
| 208 | Py_DECREF(v); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 209 | } |
| 210 | if (err != 0) { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 211 | Py_DECREF(fontlist); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 212 | fontlist = NULL; |
| 213 | } |
| 214 | } |
| 215 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 216 | static PyObject * |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 217 | fm_enumerate(PyObject *self) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 218 | { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 219 | PyObject *res; |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 220 | fontlist = PyList_New(0); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 221 | if (fontlist == NULL) |
| 222 | return NULL; |
| 223 | fmenumerate(clientproc); |
| 224 | res = fontlist; |
| 225 | fontlist = NULL; |
| 226 | return res; |
| 227 | } |
| 228 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 229 | static PyObject * |
Peter Schneider-Kamp | 6a85027 | 2000-07-10 17:04:33 +0000 | [diff] [blame] | 230 | fm_setpath(PyObject *self, PyObject *args) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 231 | { |
Guido van Rossum | ef0a00e | 1992-01-27 16:51:30 +0000 | [diff] [blame] | 232 | char *str; |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 233 | if (!PyArg_ParseTuple(args, "s", &str)) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 234 | return NULL; |
Guido van Rossum | ef0a00e | 1992-01-27 16:51:30 +0000 | [diff] [blame] | 235 | fmsetpath(str); |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 236 | Py_INCREF(Py_None); |
| 237 | return Py_None; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 238 | } |
| 239 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 240 | static PyObject * |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 241 | fm_fontpath(PyObject *self) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 242 | { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 243 | return PyString_FromString(fmfontpath()); |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 244 | } |
| 245 | |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 246 | static PyMethodDef fm_methods[] = { |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 247 | {"init", fm_init, METH_NOARGS}, |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 248 | {"findfont", fm_findfont, METH_VARARGS}, |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 249 | {"enumerate", fm_enumerate, METH_NOARGS}, |
Thomas Wouters | 4d70c3d | 2006-06-08 14:42:34 +0000 | [diff] [blame] | 250 | {"prstr", fm_prstr, METH_VARARGS}, |
| 251 | {"setpath", fm_setpath, METH_VARARGS}, |
Neal Norwitz | 50905b5 | 2002-03-31 14:57:24 +0000 | [diff] [blame] | 252 | {"fontpath", fm_fontpath, METH_NOARGS}, |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 253 | {NULL, NULL} /* sentinel */ |
| 254 | }; |
| 255 | |
| 256 | |
| 257 | void |
Thomas Wouters | f3f33dc | 2000-07-21 06:00:07 +0000 | [diff] [blame] | 258 | initfm(void) |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 259 | { |
Roger E. Masse | ed648a2 | 1997-01-17 16:08:55 +0000 | [diff] [blame] | 260 | Py_InitModule("fm", fm_methods); |
Neal Norwitz | 1ac754f | 2006-01-19 06:09:39 +0000 | [diff] [blame] | 261 | if (m == NULL) |
| 262 | return; |
Guido van Rossum | a0c191e | 1991-04-03 19:02:31 +0000 | [diff] [blame] | 263 | fminit(); |
| 264 | } |