/usr/include/fontforge/ffpython.h is in libfontforge-dev 1:20170731~dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | /* Copyright (C) 2007-2012 by George Williams */
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef FONTFORGE_FFPYTHON_H
#define FONTFORGE_FFPYTHON_H
#include "flaglist.h"
/*********** PYTHON 3 **********/
#if PY_MAJOR_VERSION >= 3
#define PyInt_Check PyLong_Check
#define PyInt_AsLong PyLong_AsLong
#define PyInt_FromLong PyLong_FromLong
#define ANYSTRING_CHECK(obj) (PyUnicode_Check(obj))
#define STRING_CHECK PyUnicode_Check
#define STRING_TO_PY PyUnicode_FromString
#define DECODE_UTF8(s, size, errors) PyUnicode_DecodeUTF8(s, size, errors)
#define PYBYTES_UTF8(str) PyUnicode_AsUTF8String(str)
#define STRING_FROM_FORMAT PyUnicode_FromFormat
#define PICKLE "pickle"
#else /* PY_MAJOR_VERSION >= 3 */
/*********** PYTHON 2 **********/
#define ANYSTRING_CHECK(obj) ( PyUnicode_Check(obj) || PyString_Check(obj) )
#define STRING_CHECK PyBytes_Check
#define STRING_TO_PY PyBytes_FromString
#define DECODE_UTF8(s, size, errors) PyString_Decode(s, size, "UTF-8", errors)
#define PYBYTES_UTF8(str) PyString_AsEncodedObject(str, "UTF-8", NULL)
#define STRING_FROM_FORMAT PyBytes_FromFormat
#define PICKLE "cPickle"
#endif /* PY_MAJOR_VERSION >= 3 */
/*********** Common **********/
#ifndef Py_TYPE
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
#endif
#ifndef Py_TYPENAME
#define Py_TYPENAME(ob) (((PyObject*)(ob))->ob_type->tp_name)
#endif
#if !defined( Py_RETURN_NONE )
/* Not defined before 2.4 */
# define Py_RETURN_NONE return( Py_INCREF(Py_None), Py_None )
#endif
#define Py_RETURN(self) return( Py_INCREF((PyObject *) (self)), (PyObject *) (self) )
#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
#define PyMODINIT_FUNC void
#endif
#ifndef PyVarObject_HEAD_INIT
#define PyVarObject_HEAD_INIT(type, size) \
PyObject_HEAD_INIT(type) size,
#endif
extern char* AnyPyString_to_UTF8( PyObject* );
extern SplineChar *sc_active_in_ui;
extern FontViewBase *fv_active_in_ui;
extern int layer_active_in_ui;
extern void FfPy_Replace_MenuItemStub(PyObject *(*func)(PyObject *,PyObject *));
extern PyObject *PySC_From_SC(SplineChar *sc);
extern PyObject *PyFV_From_FV(FontViewBase *fv);
extern int FlagsFromTuple(PyObject *tuple,struct flaglist *flags,const char *flagkind);
extern void PyFF_Glyph_Set_Layer(SplineChar *sc,int layer);
/********************************************************************************/
/** Allow both python.c and pythonui.c to access the python objects. ***/
/********************************************************************************/
/* Other sentinel values for end-of-array initialization */
#define PYMETHODDEF_EMPTY { NULL, NULL, 0, NULL }
#define PYGETSETDEF_EMPTY { NULL, NULL, NULL, NULL, NULL }
typedef struct ff_point {
PyObject_HEAD
/* Type-specific fields go here. */
float x,y;
uint8 on_curve;
uint8 selected;
char *name;
} PyFF_Point;
static PyTypeObject PyFF_PointType;
typedef struct ff_contour {
PyObject_HEAD
/* Type-specific fields go here. */
int pt_cnt, pt_max;
struct ff_point **points;
short is_quadratic, closed; /* bit flags, but access to short is faster */
spiro_cp *spiros;
int spiro_cnt;
char *name;
} PyFF_Contour;
static PyTypeObject PyFF_ContourType;
typedef struct ff_layer {
PyObject_HEAD
/* Type-specific fields go here. */
short cntr_cnt, cntr_max;
struct ff_contour **contours;
int is_quadratic; /* bit flags, but access to int is faster */
} PyFF_Layer;
static PyTypeObject PyFF_LayerType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
SplineChar *sc;
uint8 replace;
uint8 ended;
uint8 changed;
int layer;
} PyFF_GlyphPen;
static PyTypeObject PyFF_GlyphPenType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
SplineChar *sc;
} PyFF_LayerArray;
static PyTypeObject PyFF_LayerArrayType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
SplineChar *sc;
} PyFF_RefArray;
static PyTypeObject PyFF_RefArrayType;
typedef struct glyphmathkernobject {
PyObject_HEAD
SplineChar *sc;
} PyFF_MathKern;
static PyTypeObject PyFF_MathKernType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
SplineChar *sc;
PyFF_LayerArray *layers;
PyFF_RefArray *refs;
PyFF_MathKern *mk;
int layer;
} PyFF_Glyph;
static PyTypeObject PyFF_GlyphType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
SplineFont *sf;
int layer;
} PyFF_LayerInfo;
static PyTypeObject PyFF_LayerInfoType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
SplineFont *sf;
} PyFF_LayerInfoArray;
static PyTypeObject PyFF_LayerInfoArrayType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
SplineFont *sf;
FontViewBase *fv;
} PyFF_Private;
static PyTypeObject PyFF_PrivateType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
FontViewBase *fv;
int by_glyphs;
} PyFF_Selection;
static PyTypeObject PyFF_SelectionType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
SplineFont *sf;
struct ttf_table *cvt;
} PyFF_Cvt;
static PyTypeObject PyFF_CvtType;
typedef struct fontmathobject {
PyObject_HEAD
SplineFont *sf;
} PyFF_Math;
static PyTypeObject PyFF_MathType;
typedef struct {
PyObject_HEAD
/* Type-specific fields go here. */
FontViewBase *fv;
PyFF_LayerInfoArray *layers;
PyFF_Private *private;
PyFF_Cvt *cvt;
PyFF_Selection *selection;
PyFF_Math *math;
} PyFF_Font;
static PyTypeObject PyFF_FontType;
extern PyMethodDef PyFF_Font_methods[];
extern PyMethodDef module_fontforge_methods[];
PyObject *PyFV_From_FV_I(FontViewBase *fv);
// return is really a CharView*
typedef void* (*pyFF_maybeCallCVPreserveState_Func_t)( PyFF_Glyph *self );
pyFF_maybeCallCVPreserveState_Func_t get_pyFF_maybeCallCVPreserveState_Func( void );
void set_pyFF_maybeCallCVPreserveState_Func( pyFF_maybeCallCVPreserveState_Func_t f );
typedef void (*pyFF_sendRedoIfInSession_Func_t)( void* cv );
pyFF_sendRedoIfInSession_Func_t get_pyFF_sendRedoIfInSession_Func( void );
void set_pyFF_sendRedoIfInSession_Func( pyFF_sendRedoIfInSession_Func_t f );
#endif /* FONTFORGE_FFPYTHON_H */
|