DRYer fontconfig module
This commit is contained in:
parent
b8678871df
commit
5ed4b29e4b
@ -74,8 +74,6 @@ static PyMethodDef module_methods[] = {
|
||||
{"change_wcwidth", (PyCFunction)change_wcwidth_wrap, METH_O, ""},
|
||||
#ifdef __APPLE__
|
||||
CORE_TEXT_FUNC_WRAPPERS
|
||||
#else
|
||||
{"get_fontconfig_font", (PyCFunction)get_fontconfig_font, METH_VARARGS, ""},
|
||||
#endif
|
||||
GLFW_FUNC_WRAPPERS
|
||||
SPRITE_FUNC_WRAPPERS
|
||||
|
||||
@ -402,5 +402,3 @@ DECLARE_CH_SCREEN_HANDLER(backspace)
|
||||
DECLARE_CH_SCREEN_HANDLER(tab)
|
||||
DECLARE_CH_SCREEN_HANDLER(linefeed)
|
||||
DECLARE_CH_SCREEN_HANDLER(carriage_return)
|
||||
|
||||
PyObject *get_fontconfig_font(PyObject *self, PyObject *args);
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#include "data-types.h"
|
||||
#include <fontconfig/fontconfig.h>
|
||||
|
||||
PyObject*
|
||||
static PyObject*
|
||||
get_fontconfig_font(PyObject UNUSED *self, PyObject *args) {
|
||||
char *family;
|
||||
int bold, italic, allow_bitmapped_fonts, index = 0, hint_style=0, weight=0, slant=0;
|
||||
@ -74,11 +74,17 @@ end:
|
||||
return ans;
|
||||
}
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"get_fontconfig_font", (PyCFunction)get_fontconfig_font, METH_VARARGS, ""},
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
bool
|
||||
init_fontconfig_library(PyObject UNUSED *m) {
|
||||
init_fontconfig_library(PyObject *module) {
|
||||
if (!FcInit()) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Failed to initialize the fontconfig library");
|
||||
return false;
|
||||
}
|
||||
if (PyModule_AddFunctions(module, module_methods) != 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user