update pango for struct

db4
Doug Coleman 2009-08-31 12:23:08 -05:00
parent 6ac21a8cf9
commit 0f8405c507
2 changed files with 12 additions and 11 deletions

View File

@ -5,7 +5,7 @@ USING: arrays sequences alien alien.c-types alien.destructors
alien.syntax math math.functions math.vectors destructors combinators
colors fonts accessors assocs namespaces kernel pango pango.fonts
pango.cairo cairo cairo.ffi glib unicode.data images cache init
math.rectangles fry memoize io.encodings.utf8 ;
math.rectangles fry memoize io.encodings.utf8 classes.struct ;
IN: pango.layouts
LIBRARY: pango
@ -84,8 +84,8 @@ SYMBOL: dpi
[ set-layout-text ] keep ;
: layout-extents ( layout -- ink-rect logical-rect )
"PangoRectangle" <c-object>
"PangoRectangle" <c-object>
PangoRectangle <struct>
PangoRectangle <struct>
[ pango_layout_get_extents ] 2keep
[ PangoRectangle>rect ] bi@ ;

View File

@ -2,7 +2,8 @@
! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license
USING: arrays system alien.destructors alien.c-types alien.syntax alien
combinators math.rectangles kernel math alien.libraries ;
combinators math.rectangles kernel math alien.libraries classes.struct
accessors ;
IN: pango
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@ -25,13 +26,13 @@ CONSTANT: PANGO_SCALE 1024
FUNCTION: PangoContext*
pango_context_new ( ) ;
C-STRUCT: PangoRectangle
{ "int" "x" }
{ "int" "y" }
{ "int" "width" }
{ "int" "height" } ;
STRUCT: PangoRectangle
{ x int }
{ y int }
{ width int }
{ height int } ;
: PangoRectangle>rect ( PangoRectangle -- rect )
[ [ PangoRectangle-x pango>float ] [ PangoRectangle-y pango>float ] bi 2array ]
[ [ PangoRectangle-width pango>float ] [ PangoRectangle-height pango>float ] bi 2array ] bi
[ [ x>> pango>float ] [ y>> pango>float ] bi 2array ]
[ [ width>> pango>float ] [ height>> pango>float ] bi 2array ] bi
<rect> ;