]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/windows/uniscribe/uniscribe.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / basis / windows / uniscribe / uniscribe.factor
index 53d2d9918f840d6707e1f3d5e7a0c7bf04784abc..457f4bc9f017e59e3301d976f16c2376fc2457b2 100755 (executable)
@@ -1,18 +1,18 @@
 ! Copyright (C) 2009 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
 USING: kernel assocs math sequences fry io.encodings.string
-io.encodings.utf16n accessors arrays combinators destructors locals
-cache namespaces init images.normalization fonts alien.c-types
-windows windows.usp10 windows.offscreen windows.gdi32
-windows.ole32 windows.types windows.fonts opengl.textures ;
+io.encodings.utf16n accessors arrays combinators destructors
+cache namespaces init fonts alien.c-types windows.usp10
+windows.offscreen windows.gdi32 windows.ole32 windows.types
+windows.fonts opengl.textures locals windows.errors ;
 IN: windows.uniscribe
 
-TUPLE: script-string font string metrics ssa size image disposed ;
+TUPLE: script-string < disposable font string metrics ssa size image ;
 
 : line-offset>x ( n script-string -- x )
     2dup string>> length = [
         ssa>> ! ssa
-        swap 1- ! icp
+        swap 1 - ! icp
         TRUE ! fTrailing
     ] [
         ssa>>
@@ -59,10 +59,10 @@ TUPLE: script-string font string metrics ssa size image disposed ;
         ssa>> ! ssa
         0 ! iX
         0 ! iY
-        0 ! uOptions
-        f ! prc
+        ETO_OPAQUE ! uOptions
     ]
-    [ selection-start/end ] bi
+    [ [ { 0 0 } ] dip size>> <RECT> ]
+    [ selection-start/end ] tri
     ! iMinSel
     ! iMaxSel
     FALSE ! fDisabled
@@ -71,11 +71,8 @@ TUPLE: script-string font string metrics ssa size image disposed ;
 : draw-script-string ( dc script-string -- )
     [ font>> set-dc-colors ] keep (draw-script-string) ;
 
-: script-string-bitmap-size ( script-string -- dim )
-    size>> dup small-texture? [ [ next-power-of-2 ] map ] when ;
-
 :: make-script-string-image ( dc script-string -- image )
-    script-string script-string-bitmap-size dc
+    script-string size>> dc
     [ dc script-string draw-script-string ] make-bitmap-image ;
 
 : set-dc-font ( dc font -- )
@@ -92,7 +89,7 @@ TUPLE: script-string font string metrics ssa size image disposed ;
     TEXTMETRIC>metrics ;
 
 : <script-string> ( font string -- script-string )
-    [ script-string new ] 2dip
+    [ script-string new-disposable ] 2dip
         [ >>font ] [ >>string ] bi*
     [
         {
@@ -111,8 +108,8 @@ M: script-string dispose*
 
 SYMBOL: cached-script-strings
 
-: cached-script-string ( string font -- script-string )
+: cached-script-string ( font string -- script-string )
     cached-script-strings get-global [ <script-string> ] 2cache ;
 
 [ <cache-assoc> cached-script-strings set-global ]
-"windows.uniscribe" add-init-hook
\ No newline at end of file
+"windows.uniscribe" add-init-hook