]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/ui/text/uniscribe/uniscribe.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / basis / ui / text / uniscribe / uniscribe.factor
index f7d4207927b8817489a82574d0342123cbd61b1b..d5e836044bd4a48d30613d83d2964f5c81e99d01 100755 (executable)
@@ -1,6 +1,6 @@
 ! Copyright (C) 2009 Slava Pestov.\r
 ! See http://factorcode.org/license.txt for BSD license.\r
-USING: accessors assocs cache kernel math.vectors sequences\r
+USING: accessors assocs cache kernel math math.vectors sequences fonts\r
 namespaces opengl.textures ui.text ui.text.private ui.gadgets.worlds \r
 windows.uniscribe ;\r
 IN: ui.text.uniscribe\r
@@ -16,15 +16,16 @@ M: uniscribe-renderer flush-layout-cache
 \r
 : rendered-script-string ( font string -- texture )\r
     world get world-text-handle\r
-    [ cached-script-string [ image>> ] [ text-position vneg ] bi <texture> ]\r
+    [ cached-script-string image>> { 0 0 } <texture> ]\r
     2cache ;\r
 \r
 M: uniscribe-renderer draw-string ( font string -- )\r
-    [ drop ] [ rendered-script-string draw-texture ] if-empty ;\r
+    dup dup selection? [ string>> ] when empty?\r
+    [ 2drop ] [ rendered-script-string draw-texture ] if ;\r
 \r
 M: uniscribe-renderer x>offset ( x font string -- n )\r
     [ 2drop 0 ] [\r
-        cached-script-string x>line-offset drop\r
+        cached-script-string x>line-offset 0 = [ 1 + ] unless\r
     ] if-empty ;\r
 \r
 M: uniscribe-renderer offset>x ( n font string -- x )\r