예제 #1
0
파일: layout.c 프로젝트: tacaswell/freetypy
int setup_Layout(PyObject *m)
{
    memset(&Py_Layout_Type, 0, sizeof(PyTypeObject));
    Py_Layout_Type = (PyTypeObject) {
        .tp_name = "freetypy.Layout",
        .tp_basicsize = sizeof(Py_Layout),
        .tp_dealloc = (destructor)Py_Layout_dealloc,
        .tp_doc = doc_Layout__init__,
        .tp_getset = Py_Layout_getset,
        // .tp_methods = Py_Layout_methods,
        .tp_init = (initproc)Py_Layout_init,
        .tp_new = Py_Layout_new
    };

    ftpy_setup_type(m, &Py_Layout_Type);

    if (ftpy_setup_buffer_type(
            &Py_Layout_Points_Buffer_Type,
            "freetypy.Layout.PointsBuffer",
            doc_Layout_points,
            &Py_Layout_Points_Buffer_procs,
            (getbufferproc)Py_Layout_Points_Buffer_get_buffer)) {
        return -1;
    }

    if (ftpy_setup_buffer_type(
            &Py_Layout_Glyph_Indices_Buffer_Type,
            "freetypy.Layout.Glyph_Indices_Buffer",
            doc_Layout_glyph_indices,
            &Py_Layout_Glyph_Indices_Buffer_procs,
            (getbufferproc)Py_Layout_Glyph_Indices_Buffer_get_buffer)) {
        return -1;
    }

    return 0;
}
예제 #2
0
int setup_Outline(PyObject *m)
{
    memset(&Py_Outline_Type, 0, sizeof(PyTypeObject));
    Py_Outline_Type = (PyTypeObject) {
        .tp_name = "freetypy.Outline",
        .tp_basicsize = sizeof(Py_Outline),
        .tp_dealloc = (destructor)Py_Outline_dealloc,
        .tp_doc = doc_Outline__init__,
        .tp_methods = Py_Outline_methods,
        .tp_getset = Py_Outline_getset,
        .tp_init = (initproc)Py_Outline_init,
        .tp_new = Py_Outline_new
    };

    ftpy_setup_type(m, &Py_Outline_Type);

    if (ftpy_setup_buffer_type(
            &Py_Outline_Points_Buffer_Type,
            "freetypy.Outline.PointsBuffer",
            doc_Outline_points,
            &Py_Outline_Points_Buffer_procs,
            (getbufferproc)Py_Outline_Points_Buffer_get_buffer)) {
        return -1;
    }

    if (ftpy_setup_buffer_type(
            &Py_Outline_Tags_Buffer_Type,
            "freetypy.Outline.TagsBuffer",
            doc_Outline_tags,
            &Py_Outline_Tags_Buffer_procs,
            (getbufferproc)Py_Outline_Tags_Buffer_get_buffer)) {
        return -1;
    }

    if (ftpy_setup_buffer_type(
            &Py_Outline_Contours_Buffer_Type,
            "freetypy.Outline.ContoursBuffer",
            doc_Outline_contours,
            &Py_Outline_Contours_Buffer_procs,
            (getbufferproc)Py_Outline_Contours_Buffer_get_buffer)) {
        return -1;
    }

    if (ftpy_setup_buffer_type(
            &Py_Outline_Decomposed_Points_Buffer_Type,
            "freetypy.Outline.DecomposedPointsBuffer",
            doc_Outline_decomposed_points,
            &Py_Outline_Decomposed_Points_Buffer_procs,
            (getbufferproc)Py_Outline_Decomposed_Points_Buffer_get_buffer)) {
        return -1;
    }

    if (ftpy_setup_buffer_type(
            &Py_Outline_Codes_Buffer_Type,
            "freetypy.Outline.CodesBuffer",
            doc_Outline_codes,
            &Py_Outline_Codes_Buffer_procs,
            (getbufferproc)Py_Outline_Codes_Buffer_get_buffer)) {
        return -1;
    }

    if (define_constant_namespace(
            m, &Py_FT_OUTLINE_Type, &Py_FT_OUTLINE_BitflagType,
            "freetypy.OUTLINE",
            doc_OUTLINE, FT_OUTLINE_constants) ||

        define_constant_namespace(
            m, &Py_FT_ORIENTATION_Type, &Py_FT_ORIENTATION_ConstantType,
            "freetypy.ORIENTATION",
            doc_ORIENTATION, FT_ORIENTATION_constants) ||

        define_constant_namespace(
            m, &Py_FT_CODES_Type, &Py_FT_CODES_ConstantType,
            "freetypy.CODES",
            doc_CODES, FT_CODES_constants)) {
        return -1;
    }

    return 0;
}