mirror of
https://github.com/penpot/penpot.git
synced 2025-07-24 17:17:12 +02:00
🐛 Fix problem with line-height and texts
This commit is contained in:
parent
cc6b3dcec6
commit
fdbcf977f5
7 changed files with 22 additions and 9 deletions
|
@ -91,6 +91,11 @@
|
|||
(when event
|
||||
(.stopPropagation event)))
|
||||
|
||||
(defn stop-immediate-propagation
|
||||
[^js event]
|
||||
(when event
|
||||
(.stopImmediatePropagation event)))
|
||||
|
||||
(defn prevent-default
|
||||
[^js event]
|
||||
(when event
|
||||
|
@ -596,3 +601,12 @@
|
|||
(defn load-font [font]
|
||||
(let [fonts (.-fonts globals/document)]
|
||||
(.load fonts font)))
|
||||
|
||||
(defn text-measure [font]
|
||||
(let [element (.createElement globals/document "canvas")
|
||||
context (.getContext element "2d")
|
||||
_ (set! (.-font context) font)
|
||||
measure ^js (.measureText context "Ag")]
|
||||
|
||||
{:ascent (.-fontBoundingBoxAscent measure)
|
||||
:descent (.-fontBoundingBoxDescent measure)}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue