1 ! Copyright (C) 2009 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel math sequences io.encodings.string io.encodings.utf16n
4 accessors arrays destructors alien.c-types windows windows.usp10
8 TUPLE: script-string pssa size image ;
10 : make-script-string ( dc string -- script-string )
11 [ utf16n encode ] ! pString
12 [ length ] bi ! cString
13 dup 1.5 * 16 + ! cGlyphs -- MSDN says this is "recommended size"
14 -1 ! iCharset -- Unicode
23 [ ScriptStringAnalyse ] keep
24 [ win32-error=0/f ] [ |ScriptStringFree ] bi* ;
26 : draw-script-string ( script-string -- bitmap )
30 ETO_OPAQUE ! uOptions ... ????
37 : <script-string> ( string -- script-string )
40 make-script-string |ScriptStringFree
42 [ draw-script-string ]
46 [ SIZE-cx ] [ SIZE-cy ] bi 2array
52 M: script-string dispose* pssa>> ScriptStringFree win32-error=0/f ;
54 : line-offset>x ( offset script-string -- x )
58 0 <int> [ ScriptStringCPtoX win32-error=0/f ] keep *int ;
60 : line-x>offset ( x script-string -- offset trailing )
65 [ ScriptStringXtoCP win32-error=0/f ] 2keep [ *int ] bi@ ;