mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
Remove ununsed font_getabc
This commit is contained in:
parent
6fc1e79e96
commit
3cf6ad1895
|
@ -674,47 +674,6 @@ font_getsize(FontObject* self, PyObject* args)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PyObject*
|
|
||||||
font_getabc(FontObject* self, PyObject* args)
|
|
||||||
{
|
|
||||||
FT_ULong ch;
|
|
||||||
FT_Face face;
|
|
||||||
double a, b, c;
|
|
||||||
|
|
||||||
/* calculate ABC values for a given string */
|
|
||||||
|
|
||||||
PyObject* string;
|
|
||||||
if (!PyArg_ParseTuple(args, "O:getabc", &string))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
#if PY_VERSION_HEX >= 0x03000000
|
|
||||||
if (!PyUnicode_Check(string)) {
|
|
||||||
#else
|
|
||||||
if (!PyUnicode_Check(string) && !PyString_Check(string)) {
|
|
||||||
#endif
|
|
||||||
PyErr_SetString(PyExc_TypeError, "expected string");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (font_getchar(string, 0, &ch)) {
|
|
||||||
int index, error;
|
|
||||||
face = self->face;
|
|
||||||
index = FT_Get_Char_Index(face, ch);
|
|
||||||
/* Note: bitmap fonts within ttf fonts do not work, see #891/pr#960 */
|
|
||||||
error = FT_Load_Glyph(face, index, FT_LOAD_DEFAULT|FT_LOAD_NO_BITMAP);
|
|
||||||
if (error)
|
|
||||||
return geterror(error);
|
|
||||||
a = face->glyph->metrics.horiBearingX / 64.0;
|
|
||||||
b = face->glyph->metrics.width / 64.0;
|
|
||||||
c = (face->glyph->metrics.horiAdvance -
|
|
||||||
face->glyph->metrics.horiBearingX -
|
|
||||||
face->glyph->metrics.width) / 64.0;
|
|
||||||
} else
|
|
||||||
a = b = c = 0.0;
|
|
||||||
|
|
||||||
return Py_BuildValue("ddd", a, b, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
static PyObject*
|
static PyObject*
|
||||||
font_render(FontObject* self, PyObject* args)
|
font_render(FontObject* self, PyObject* args)
|
||||||
{
|
{
|
||||||
|
@ -854,7 +813,6 @@ font_dealloc(FontObject* self)
|
||||||
static PyMethodDef font_methods[] = {
|
static PyMethodDef font_methods[] = {
|
||||||
{"render", (PyCFunction) font_render, METH_VARARGS},
|
{"render", (PyCFunction) font_render, METH_VARARGS},
|
||||||
{"getsize", (PyCFunction) font_getsize, METH_VARARGS},
|
{"getsize", (PyCFunction) font_getsize, METH_VARARGS},
|
||||||
{"getabc", (PyCFunction) font_getabc, METH_VARARGS},
|
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user