 
 : (open-font) ( font -- open-font )
     first3 >r open-face dup 0 r> 6 shift
-    dpi dpi FT_Set_Char_Size freetype-error <font> ;
+    dpi get-global dpi get-global FT_Set_Char_Size
+    freetype-error <font> ;
 
 M: freetype-renderer open-font ( font -- open-font )
     freetype drop open-fonts get [ (open-font) ] cache ;

: ttf-path ( name -- string )
    "/fonts/" swap ".ttf" 3append resource-path ;

: (open-face) ( mapped-file -- face )
    #! We use FT_New_Memory_Face, not FT_New_Face, since
    #! FT_New_Face only takes an ASCII path name and causes
    #! problems on localized versions of Windows
    freetype swap dup mapped-file-address swap length 0 f
    <void*> [ FT_New_Memory_Face freetype-error ] keep *void* ;

: open-face ( font style -- face )
    ttf-name ttf-path dup file-length
    <mapped-file> (open-face) ;

: dpi 72 ; inline

: ft-floor -6 shift ; inline


USING: alien alien.c-types arrays io kernel libc math
math.vectors namespaces opengl opengl.gl prettyprint assocs
sequences io.files io.styles continuations freetype
ui.gadgets.worlds ui.render ui.backend byte-arrays ;
IN: ui.freetype

TUPLE: freetype-renderer ;
