factor/basis/pango/pango.factor

38 lines
1.2 KiB
Factor
Raw Normal View History

2009-02-26 03:31:24 -05:00
! Copyright (C) 2008 Matthew Willis.
2009-02-28 02:31:51 -05:00
! Copyright (C) 2009 Slava Pestov.
2009-02-26 03:31:24 -05:00
! See http://factorcode.org/license.txt for BSD license
2009-02-28 02:31:51 -05:00
USING: arrays system alien.destructors alien.c-types alien.syntax alien
2009-03-26 00:00:19 -04:00
combinators math.rectangles kernel math alien.libraries ;
2009-02-26 03:31:24 -05:00
IN: pango
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Helpful functions from other parts of pango
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2009-03-02 03:55:54 -05:00
<< {
{ [ os winnt? ] [ "pango" "libpango-1.0-0.dll" "cdecl" add-library ] }
{ [ os macosx? ] [ "pango" "/opt/local/lib/libpango-1.0.0.dylib" "cdecl" add-library ] }
{ [ os unix? ] [ ] }
} cond >>
2009-02-26 03:31:24 -05:00
LIBRARY: pango
CONSTANT: PANGO_SCALE 1024
: pango>float ( n -- x ) PANGO_SCALE /f ; inline
: float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
2009-02-27 00:30:02 -05:00
FUNCTION: PangoContext*
pango_context_new ( ) ;
2009-02-26 03:31:24 -05:00
2009-02-28 02:31:51 -05:00
C-STRUCT: PangoRectangle
{ "int" "x" }
{ "int" "y" }
{ "int" "width" }
{ "int" "height" } ;
: 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
2009-03-26 00:00:19 -04:00
<rect> ;