]> gitweb.factorcode.org Git - factor.git/blob - basis/pango/pango.factor
03134ed7871ac348c23397218dd010afaf0b5487
[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 classes.struct
6 accessors ;
7 IN: pango
8
9 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10 ! Helpful functions from other parts of pango
11 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
13 << {
14     { [ os winnt? ] [ "pango" "libpango-1.0-0.dll" "cdecl" add-library ] }
15     { [ os macosx? ] [ "pango" "/opt/local/lib/libpango-1.0.0.dylib" "cdecl" add-library ] }
16     { [ os unix? ] [ ] }
17 } cond >>
18
19 LIBRARY: pango
20
21 CONSTANT: PANGO_SCALE 1024
22
23 : pango>float ( n -- x ) PANGO_SCALE /f ; inline
24 : float>pango ( x -- n ) PANGO_SCALE * >integer ; inline
25
26 TYPEDEF: void* PangoContext*
27
28 FUNCTION: PangoContext* pango_context_new ( ) ;
29
30 STRUCT: PangoRectangle
31     { x int }
32     { y int }
33     { width int }
34     { height int } ;
35
36 : PangoRectangle>rect ( PangoRectangle -- rect )
37     [ [ x>> pango>float ] [ y>> pango>float ] bi 2array ]
38     [ [ width>> pango>float ] [ height>> pango>float ] bi 2array ] bi
39     <rect> ;