changeset 182:fefcd73386c2

Workaround to allow empty text lines in labels.
author Mikhail Kryshen <mikhail@kryshen.net>
date Tue, 01 Dec 2015 19:31:17 +0300
parents fc9c674a4d54
children a43e3c9b007e
files src/indyvon/views.clj
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line diff
     1.1 --- a/src/indyvon/views.clj	Wed Nov 18 19:12:12 2015 +0300
     1.2 +++ b/src/indyvon/views.clj	Tue Dec 01 19:31:17 2015 +0300
     1.3 @@ -246,8 +246,11 @@
     1.4  
     1.5  (defn- get-text-layout
     1.6    [^String line ^Font font ^FontRenderContext font-context]
     1.7 -  (.get text-layout-cache [line font font-context]
     1.8 -        #(TextLayout. line font font-context)))
     1.9 +  ;; XXX: TextLayout fails on empty strings, use zero-width space as a
    1.10 +  ;; workaround.
    1.11 +  (let [line (if (.isEmpty line) "\u200b" line)]
    1.12 +    (.get text-layout-cache [line font font-context]
    1.13 +          #(TextLayout. line font font-context))))
    1.14  
    1.15  (defn- layout-text
    1.16    [lines font font-context]