DRYer CoreText
This commit is contained in:
parent
5ed4b29e4b
commit
4a27793651
@ -1,15 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Kovid Goyal <kovid at kovidgoyal.net>
|
||||
*
|
||||
* Distributed under terms of the GPL3 license.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define UNUSED __attribute__ ((unused))
|
||||
|
||||
int init_CoreText(PyObject *);
|
||||
PyObject* coretext_all_fonts(PyObject UNUSED *self);
|
||||
|
||||
#define CORE_TEXT_FUNC_WRAPPERS \
|
||||
{"coretext_all_fonts", (PyCFunction)coretext_all_fonts, METH_NOARGS, ""},
|
||||
@ -320,11 +320,16 @@ PyTypeObject Face_Type = {
|
||||
.tp_repr = (reprfunc)repr,
|
||||
};
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"coretext_all_fonts", (PyCFunction)coretext_all_fonts, METH_NOARGS, ""},
|
||||
{NULL, NULL, 0, NULL} /* Sentinel */
|
||||
};
|
||||
|
||||
int
|
||||
init_CoreText(PyObject *module) {
|
||||
if (PyType_Ready(&Face_Type) < 0) return 0;
|
||||
if (PyModule_AddObject(module, "CTFace", (PyObject *)&Face_Type) != 0) return 0;
|
||||
if (PyModule_AddFunctions(module, module_methods) != 0) return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -60,10 +60,6 @@ stop_profiler(PyObject UNUSED *self) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include "core_text.h"
|
||||
#endif
|
||||
|
||||
static PyMethodDef module_methods[] = {
|
||||
{"set_iutf8", (PyCFunction)pyset_iutf8, METH_VARARGS, ""},
|
||||
{"thread_write", (PyCFunction)cm_thread_write, METH_VARARGS, ""},
|
||||
@ -72,9 +68,6 @@ static PyMethodDef module_methods[] = {
|
||||
{"redirect_std_streams", (PyCFunction)redirect_std_streams, METH_VARARGS, ""},
|
||||
{"wcwidth", (PyCFunction)wcwidth_wrap, METH_O, ""},
|
||||
{"change_wcwidth", (PyCFunction)change_wcwidth_wrap, METH_O, ""},
|
||||
#ifdef __APPLE__
|
||||
CORE_TEXT_FUNC_WRAPPERS
|
||||
#endif
|
||||
GLFW_FUNC_WRAPPERS
|
||||
SPRITE_FUNC_WRAPPERS
|
||||
#ifdef WITH_PROFILER
|
||||
@ -108,6 +101,10 @@ extern int init_Face(PyObject *);
|
||||
extern int init_Window(PyObject *);
|
||||
extern bool init_freetype_library(PyObject*);
|
||||
extern bool init_fontconfig_library(PyObject*);
|
||||
#ifdef __APPLE__
|
||||
extern int init_CoreText(PyObject *);
|
||||
#endif
|
||||
|
||||
|
||||
EXPORTED PyMODINIT_FUNC
|
||||
PyInit_fast_data_types(void) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user