package provide Freetype::ftsizes 0.1

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

::ffidl::callout _FT_New_Size {pointer pointer-var} int \
    [::ffidl::symbol $::ft::lib FT_New_Size]
proc FT_New_Size {face sizeVarName} {
    upvar $sizeVarName size
    set p [::ft::_bytearray_from_pointer 0]
    set result [_FT_New_Size [$face getPointer] p]
    if {$result == 0} {
        set size [FT_Size new [::ft::_bytearray_to_pointer $p]]
    }
    return $result
}

::ffidl::callout _FT_Done_Size {pointer} int \
    [::ffidl::symbol $::ft::lib FT_Done_Size]
proc FT_Done_Size {size} {
    set result [_FT_Done_Size [$size getPointer]]
    return $result
}

::ffidl::callout _FT_Activate_Size {pointer} int \
    [::ffidl::symbol $::ft::lib FT_Activate_Size]
proc FT_Activate_Size {size} {
    set result [_FT_Activate_Size [$size getPointer]]
    return $result
}

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