0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-19 03:01:27 -05:00

Initial work on fontSize rendering on text shapes.

This commit is contained in:
Andrey Antukh 2016-02-27 21:12:40 +02:00
parent 016b43e1a5
commit abed5dd35d

View file

@ -132,6 +132,13 @@
:style {:stroke "#333" :fill "transparent"
:stroke-opacity "0.4"}})
(def ^:const +style-attrs+
[:font-size])
(defn- build-style
[{:keys [font-size]}]
(merge {} (when font-size {:fontSize (str font-size "px")})))
(defmethod uusc/render-shape :builtin/text
[{:keys [id x1 y1 x2 y2 content drawing? editing?] :as shape}]
(let [key (str id)
@ -139,12 +146,14 @@
size (ush/size shape)
props {:x x1 :y y1
:transform (str rfm)}
attrs (merge props size)]
attrs (merge props size)
style (build-style shape)]
(html
[:g
(if (or drawing? editing?)
[:g
[:rect (merge attrs +select-rect-attrs+)]])
[:foreignObject attrs
[:p {:ref "container"} content]]])))
[:p {:ref "container" :style style} content]]])))