package provide Freetype::ftrender 0.1

if {![info exists _source([file tail [info script]])]} {
package require Freetype::ft2build
package require $FT_MODULE
package require $FT_GLYPH

ft::struct define FT_Glyph_Class {
    {glyph_size      int - FT_Long    1 FT_Long}             
    {glyph_format    int - int        1 int}
    {glyph_init      int - pointer    1 pointer}
    {glyph_done      int - pointer    1 pointer}
    {glyph_copy      int - pointer    1 pointer}
    {glyph_transform int - pointer    1 pointer}
    {glyph_bbox      int - pointer    1 pointer}
    {glyph_prepare   int - pointer    1 pointer}
}

ft::struct define FT_Renderer_Class {
    {root            object - FT_Module_Class 1 FT_Module_Class}
    {glyph_format    int    - int             1 int}
    {render_glyph    int    - pointer-proc    1 pointer}
    {transform_glyph int    - pointer-proc    1 pointer}
    {get_glyph_cbox  int    - pointer-proc    1 pointer}
    {set_mode        int    - pointer-proc    1 pointer}
    {raster_class    int    - pointer-proc    1 pointer}
}

::ffidl::callout _FT_Get_Renderer {pointer FT_Glyph_Format} pointer \
    [::ffidl::symbol $::ft::lib FT_Get_Renderer]
proc FT_Get_Renderer {library format} {
    set result [_FT_Get_Renderer [$library getPointer] $format]
    return $result
}

::ffidl::callout _FT_Set_Renderer {pointer pointer FT_UInt pointer-var} int \
    [::ffidl::symbol $::ft::lib FT_Set_Renderer]
proc FT_Set_Renderer {library renderer num_parames parameters} {
    set result [_FT_Set_Renderer [$library getPointer] \
        [$renderer getPointer] $num_parames [$parameters getPointer]]
    return $result
}

set _source([file tail [info script]]) 1
}
