]> gitweb.factorcode.org Git - factor.git/blob - basis/pango/pango.factor
update code for usages of add-library
[factor.git] / basis / pango / pango.factor
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 alien.libraries ;
6 IN: pango
7
8 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9 ! Helpful functions from other parts of pango
10 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11
12 << {
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 ] }
15     { [ os unix? ] [ ] }
16 } cond >>
17
18 LIBRARY: pango
19
20 CONSTANT: PANGO_SCALE 1024
21
22 : pango>float ( n -- x ) PANGO_SCALE /f ; inline
23 : float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
24
25 FUNCTION: PangoContext*
26 pango_context_new ( ) ;
27
28 C-STRUCT: PangoRectangle
29     { "int" "x" }
30     { "int" "y" }
31     { "int" "width" }
32     { "int" "height" } ;
33
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
37     <rect> ;