make render-char public and allow it to be used standalone

This commit is contained in:
Gered 2014-03-29 17:26:46 -04:00
parent 9712612f66
commit b9e30d0f22

View file

@ -91,9 +91,10 @@
(defn- get-initial-output-lines [flf] (defn- get-initial-output-lines [flf]
(take (get-in flf [:header :height]) (repeat ""))) (take (get-in flf [:header :height]) (repeat "")))
(defn- render-char [^Character c flf lines] (defn render-char [^Character c flf & [initial-output]]
(let [char-lines (get-in flf [:chars c]) (let [output-lines (or initial-output (get-initial-output-lines flf))
hardblank (get-in flf [:header :hardblank-str])] char-lines (get-in flf [:chars c])
hardblank (get-in flf [:header :hardblank-str])]
(if char-lines (if char-lines
(map (map
(fn [^String char-line ^String output-line] (fn [^String char-line ^String output-line]
@ -103,8 +104,8 @@
(.replace "#" "") ; also used as an endline (.replace "#" "") ; also used as an endline
(.replace hardblank " ")))) (.replace hardblank " "))))
char-lines char-lines
lines) output-lines)
lines))) output-lines)))
(defn render-line [^String s flf & [initial-output]] (defn render-line [^String s flf & [initial-output]]
(let [output (or initial-output (get-initial-output-lines flf))] (let [output (or initial-output (get-initial-output-lines flf))]