]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/pango/pango.factor
First attempt at ui.text.pango
[factor.git] / basis / pango / pango.factor
index ae78f530bb367b961cfe8dc0f8cef1fefb7d8d22..74e171e5ebdafd690d8c164250bdb3dfd923a8e4 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2008 Matthew Willis.
+! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license
-USING: system alien.destructors alien.c-types alien.syntax alien
-combinators ;
+USING: arrays system alien.destructors alien.c-types alien.syntax alien
+combinators math.rectangles kernel ;
 IN: pango
 
 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -21,5 +22,16 @@ CONSTANT: PANGO_SCALE 1024
 FUNCTION: PangoContext*
 pango_context_new ( ) ;
 
+C-STRUCT: PangoRectangle
+    { "int" "x" }
+    { "int" "y" }
+    { "int" "width" }
+    { "int" "height" } ;
+
+: PangoRectangle>rect ( PangoRectangle -- rect )
+    [ [ PangoRectangle-x ] [ PangoRectangle-y ] bi 2array ]
+    [ [ PangoRectangle-width ] [ PangoRectangle-height ] bi 2array ] bi
+    <rect> ;
+
 : dummy-pango-context ( -- context )
     \ dummy-pango-context [ pango_context_new ] initialize-alien ;
\ No newline at end of file