indyvon
 
(Mikhail Kryshen)
2015-12-01: Workaround to allow empty text lines in labels.

Workaround to allow empty text lines in labels.

diff --git a/src/indyvon/views.clj b/src/indyvon/views.clj
--- a/src/indyvon/views.clj
+++ b/src/indyvon/views.clj
@@ -246,8 +246,11 @@
 
 (defn- get-text-layout
   [^String line ^Font font ^FontRenderContext font-context]
-  (.get text-layout-cache [line font font-context]
-        #(TextLayout. line font font-context)))
+  ;; XXX: TextLayout fails on empty strings, use zero-width space as a
+  ;; workaround.
+  (let [line (if (.isEmpty line) "\u200b" line)]
+    (.get text-layout-cache [line font font-context]
+          #(TextLayout. line font font-context))))
 
 (defn- layout-text
   [lines font font-context]