mirror of
https://github.com/penpot/penpot.git
synced 2025-07-22 10:07:14 +02:00
🐛 Changed the text dominant-baseline to use ideographic
This commit is contained in:
parent
b2c3dc1504
commit
2500d192e8
4 changed files with 70 additions and 35 deletions
|
@ -662,3 +662,12 @@
|
|||
(defn has-children?
|
||||
[^js node]
|
||||
(> (-> node .-children .-length) 0))
|
||||
|
||||
;; WARNING: Use only for debugging. It's to costly to use for real
|
||||
(defn measure-text
|
||||
"Given a canvas' context 2d and the text info returns tis ascent/descent info"
|
||||
[context-2d font-size font-family text]
|
||||
(let [_ (set! (.-font context-2d) (str font-size " " font-family))
|
||||
measures (.measureText context-2d text)]
|
||||
{:descent (.-actualBoundingBoxDescent measures)
|
||||
:ascent (.-actualBoundingBoxAscent measures)}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue