1 ! Copyright (C) 2008 Matthew Willis.
2 ! Copyright (C) 2009 Slava Pestov.
3 ! See http://factorcode.org/license.txt for BSD license
4 USING: arrays system alien.destructors alien.c-types alien.syntax alien
5 combinators math.rectangles kernel math ;
8 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9 ! Helpful functions from other parts of pango
10 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
13 { [ os winnt? ] [ "pango" "libpango-1.0-0.dll" "cdecl" add-library ] }
14 { [ os macosx? ] [ "pango" "/opt/local/lib/libpango-1.0.0.dylib" "cdecl" add-library ] }
20 CONSTANT: PANGO_SCALE 1024
22 : pango>float ( n -- x ) PANGO_SCALE /f ; inline
23 : float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
25 FUNCTION: PangoContext*
26 pango_context_new ( ) ;
28 C-STRUCT: PangoRectangle
34 : PangoRectangle>rect ( PangoRectangle -- rect )
35 [ [ PangoRectangle-x pango>float ] [ PangoRectangle-y pango>float ] bi 2array ]
36 [ [ PangoRectangle-width pango>float ] [ PangoRectangle-height pango>float ] bi 2array ] bi