Correction of the unbufferizing

This commit is contained in:
Nicolas Pieuchot 2013-04-25 20:57:13 +02:00
parent b170c5627e
commit af72132349
2 changed files with 3 additions and 7 deletions

View File

@ -140,9 +140,7 @@ class FreeTypeFont:
self.font = core.getfont(font, size, index, encoding)
else:
bytes = font.read()
font.seek(0, 2)
size = font.tell()
self.font = core.getfont("", size, index, encoding, bytes, size)
self.font = core.getfont("", size, index, encoding, bytes)
def getname(self):
return self.font.family, self.font.style

View File

@ -106,10 +106,10 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
unsigned char* file_like;
int file_like_size = 0;
static char* kwlist[] = {
"filename", "size", "index", "encoding", "file_like", "file_like_size", NULL
"filename", "size", "index", "encoding", "file_like", NULL
};
if (!PyArg_ParseTupleAndKeywords(args, kw, "eti|isz*i", kwlist,
if (!PyArg_ParseTupleAndKeywords(args, kw, "eti|iss#", kwlist,
Py_FileSystemDefaultEncoding, &filename,
&size, &index, &encoding, &file_like,
&file_like_size))
@ -148,8 +148,6 @@ getfont(PyObject* self_, PyObject* args, PyObject* kw)
return geterror(error);
}
fprintf(stderr, "> %d %d %s\n", error, file_like_size, self);
return (PyObject*) self;
}