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