| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* Font Manager module */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | #include "Python.h"
 | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <gl.h>
 | 
					
						
							|  |  |  | #include <device.h>
 | 
					
						
							|  |  |  | #include <fmclient.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Font Handle object implementation */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | typedef struct { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	PyObject_HEAD | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	fmfonthandle fh_fh; | 
					
						
							|  |  |  | } fhobject; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | staticforward PyTypeObject Fhtype; | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define is_fhobject(v)		((v)->ob_type == &Fhtype)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | newfhobject(fmfonthandle fh) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	fhobject *fhp; | 
					
						
							|  |  |  | 	if (fh == NULL) { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 		PyErr_SetString(PyExc_RuntimeError, | 
					
						
							|  |  |  | 				"error creating new font handle"); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2000-05-03 23:44:39 +00:00
										 |  |  | 	fhp = PyObject_New(fhobject, &Fhtype); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	if (fhp == NULL) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 	fhp->fh_fh = fh; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	return (PyObject *)fhp; | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Font Handle methods */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_scalefont(fhobject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	double size; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_Parse(args, "d", &size)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	return newfhobject(fmscalefont(self->fh_fh, size)); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* XXX fmmakefont */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_setfont(fhobject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_NoArgs(args)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	fmsetfont(self->fh_fh); | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	Py_INCREF(Py_None); | 
					
						
							|  |  |  | 	return Py_None; | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_getfontname(fhobject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	char fontname[256]; | 
					
						
							|  |  |  | 	int len; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_NoArgs(args)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	len = fmgetfontname(self->fh_fh, sizeof fontname, fontname); | 
					
						
							|  |  |  | 	if (len < 0) { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 		PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontname"); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	return PyString_FromStringAndSize(fontname, len); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_getcomment(fhobject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	char comment[256]; | 
					
						
							|  |  |  | 	int len; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_NoArgs(args)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	len = fmgetcomment(self->fh_fh, sizeof comment, comment); | 
					
						
							|  |  |  | 	if (len < 0) { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 		PyErr_SetString(PyExc_RuntimeError, "error in fmgetcomment"); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	return PyString_FromStringAndSize(comment, len); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_getfontinfo(fhobject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	fmfontinfo info; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_NoArgs(args)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	if (fmgetfontinfo(self->fh_fh, &info) < 0) { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 		PyErr_SetString(PyExc_RuntimeError, "error in fmgetfontinfo"); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	return Py_BuildValue("(llllllll)", | 
					
						
							|  |  |  | 			     info.printermatched, | 
					
						
							|  |  |  | 			     info.fixed_width, | 
					
						
							|  |  |  | 			     info.xorig, | 
					
						
							|  |  |  | 			     info.yorig, | 
					
						
							|  |  |  | 			     info.xsize, | 
					
						
							|  |  |  | 			     info.ysize, | 
					
						
							|  |  |  | 			     info.height, | 
					
						
							|  |  |  | 			     info.nglyphs); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_getwholemetrics(fhobject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_getstrwidth(fhobject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1992-01-27 16:51:30 +00:00
										 |  |  | 	char *str; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_Parse(args, "s", &str)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	return PyInt_FromLong(fmgetstrwidth(self->fh_fh, str)); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyMethodDef fh_methods[] = { | 
					
						
							|  |  |  | 	{"scalefont",	(PyCFunction)fh_scalefont}, | 
					
						
							|  |  |  | 	{"setfont",	(PyCFunction)fh_setfont}, | 
					
						
							|  |  |  | 	{"getfontname",	(PyCFunction)fh_getfontname}, | 
					
						
							|  |  |  | 	{"getcomment",	(PyCFunction)fh_getcomment}, | 
					
						
							|  |  |  | 	{"getfontinfo",	(PyCFunction)fh_getfontinfo}, | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | #if 0
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	{"getwholemetrics",	(PyCFunction)fh_getwholemetrics}, | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	{"getstrwidth",	(PyCFunction)fh_getstrwidth}, | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	{NULL,		NULL}		/* sentinel */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_getattr(fhobject *fhp, char *name) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	return Py_FindMethod(fh_methods, (PyObject *)fhp, name); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static void | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fh_dealloc(fhobject *fhp) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	fmfreefont(fhp->fh_fh); | 
					
						
							| 
									
										
										
										
											2000-05-03 23:44:39 +00:00
										 |  |  | 	PyObject_Del(fhp); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyTypeObject Fhtype = { | 
					
						
							|  |  |  | 	PyObject_HEAD_INIT(&PyType_Type) | 
					
						
							| 
									
										
										
										
											1994-08-01 11:34:53 +00:00
										 |  |  | 	0,				/*ob_size*/ | 
					
						
							|  |  |  | 	"font handle",			/*tp_name*/ | 
					
						
							|  |  |  | 	sizeof(fhobject),		/*tp_size*/ | 
					
						
							|  |  |  | 	0,				/*tp_itemsize*/ | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	/* methods */ | 
					
						
							| 
									
										
										
										
											1994-08-01 11:34:53 +00:00
										 |  |  | 	(destructor)fh_dealloc,		/*tp_dealloc*/ | 
					
						
							|  |  |  | 	0,				/*tp_print*/ | 
					
						
							|  |  |  | 	(getattrfunc)fh_getattr,	/*tp_getattr*/ | 
					
						
							|  |  |  | 	0,				/*tp_setattr*/ | 
					
						
							|  |  |  | 	0,				/*tp_compare*/ | 
					
						
							|  |  |  | 	0,				/*tp_repr*/ | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Font Manager functions */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-12 10:43:11 +00:00
										 |  |  | fm_init(PyObject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_NoArgs(args)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							|  |  |  | 	fminit(); | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	Py_INCREF(Py_None); | 
					
						
							|  |  |  | 	return Py_None; | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-12 10:43:11 +00:00
										 |  |  | fm_findfont(PyObject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1992-01-27 16:51:30 +00:00
										 |  |  | 	char *str; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_Parse(args, "s", &str)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											1992-01-27 16:51:30 +00:00
										 |  |  | 	return newfhobject(fmfindfont(str)); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-12 10:43:11 +00:00
										 |  |  | fm_prstr(PyObject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1992-01-27 16:51:30 +00:00
										 |  |  | 	char *str; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_Parse(args, "s", &str)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											1992-01-27 16:51:30 +00:00
										 |  |  | 	fmprstr(str); | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	Py_INCREF(Py_None); | 
					
						
							|  |  |  | 	return Py_None; | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* XXX This uses a global variable as temporary! Not re-entrant! */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject *fontlist; | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | static void | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | clientproc(char *fontname) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							|  |  |  | 	int err; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	PyObject *v; | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	if (fontlist == NULL) | 
					
						
							|  |  |  | 		return; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	v = PyString_FromString(fontname); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	if (v == NULL) | 
					
						
							|  |  |  | 		err = -1; | 
					
						
							|  |  |  | 	else { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 		err = PyList_Append(fontlist, v); | 
					
						
							|  |  |  | 		Py_DECREF(v); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	} | 
					
						
							|  |  |  | 	if (err != 0) { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 		Py_DECREF(fontlist); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		fontlist = NULL; | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fm_enumerate(PyObject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	PyObject *res; | 
					
						
							|  |  |  | 	if (!PyArg_NoArgs(args)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	fontlist = PyList_New(0); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	if (fontlist == NULL) | 
					
						
							|  |  |  | 		return NULL; | 
					
						
							|  |  |  | 	fmenumerate(clientproc); | 
					
						
							|  |  |  | 	res = fontlist; | 
					
						
							|  |  |  | 	fontlist = NULL; | 
					
						
							|  |  |  | 	return res; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-10 17:04:33 +00:00
										 |  |  | fm_setpath(PyObject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1992-01-27 16:51:30 +00:00
										 |  |  | 	char *str; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_Parse(args, "s", &str)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											1992-01-27 16:51:30 +00:00
										 |  |  | 	fmsetpath(str); | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	Py_INCREF(Py_None); | 
					
						
							|  |  |  | 	return Py_None; | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyObject * | 
					
						
							| 
									
										
										
										
											2000-07-12 10:43:11 +00:00
										 |  |  | fm_fontpath(PyObject *self, PyObject *args) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	if (!PyArg_NoArgs(args)) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 		return NULL; | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	return PyString_FromString(fmfontpath()); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | static PyMethodDef fm_methods[] = { | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	{"init",	fm_init}, | 
					
						
							|  |  |  | 	{"findfont",	fm_findfont}, | 
					
						
							|  |  |  | 	{"enumerate",	fm_enumerate}, | 
					
						
							|  |  |  | 	{"prstr",	fm_prstr}, | 
					
						
							|  |  |  | 	{"setpath",	fm_setpath}, | 
					
						
							|  |  |  | 	{"fontpath",	fm_fontpath}, | 
					
						
							|  |  |  | 	{NULL,		NULL}		/* sentinel */ | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							| 
									
										
										
										
											2000-07-21 06:00:07 +00:00
										 |  |  | initfm(void) | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											1997-01-17 16:08:55 +00:00
										 |  |  | 	Py_InitModule("fm", fm_methods); | 
					
						
							| 
									
										
										
										
											1991-04-03 19:02:31 +00:00
										 |  |  | 	fminit(); | 
					
						
							|  |  |  | } |