add render-line function

This commit is contained in:
Gered 2014-03-29 16:49:34 -04:00
parent 0625197023
commit 5bc8f1810c

View file

@ -89,6 +89,9 @@
(parse-ext-chars header ext-chars) (parse-ext-chars header ext-chars)
(parse-other-chars header other-chars))}))) (parse-other-chars header other-chars))})))
(defn- get-initial-output-lines [flf]
(take (get-in flf [:header :height]) (repeat "")))
(defn- render-char [c flf lines] (defn- render-char [c flf lines]
(let [char-lines (get-in flf [:chars c]) (let [char-lines (get-in flf [:chars c])
hardblank (get-in flf [:header :hardblank-str])] hardblank (get-in flf [:header :hardblank-str])]
@ -101,4 +104,12 @@
(.replaceAll hardblank " ")))) (.replaceAll hardblank " "))))
char-lines char-lines
lines) lines)
lines))) lines)))
(defn render-line [s flf]
(let [output (get-initial-output-lines flf)]
(reduce
(fn [out c]
(render-char c flf out))
output
s)))