mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 09:01:48 +02:00
🐛 Fix take new lines into account when rendering text (#6337)
This commit is contained in:
parent
eb29a42209
commit
14e8026e30
1 changed files with 4 additions and 2 deletions
|
@ -10,7 +10,8 @@
|
||||||
[app.render-wasm.helpers :as h]
|
[app.render-wasm.helpers :as h]
|
||||||
[app.render-wasm.mem :as mem]
|
[app.render-wasm.mem :as mem]
|
||||||
[app.render-wasm.serializers :as sr]
|
[app.render-wasm.serializers :as sr]
|
||||||
[app.render-wasm.wasm :as wasm]))
|
[app.render-wasm.wasm :as wasm]
|
||||||
|
[clojure.string :as str]))
|
||||||
|
|
||||||
(defn utf8->buffer [text]
|
(defn utf8->buffer [text]
|
||||||
(let [encoder (js/TextEncoder.)]
|
(let [encoder (js/TextEncoder.)]
|
||||||
|
@ -20,7 +21,8 @@
|
||||||
;; buffer has the following format:
|
;; buffer has the following format:
|
||||||
;; [<num-leaves> <paragraph_attributes> <leaves_attributes> <text>]
|
;; [<num-leaves> <paragraph_attributes> <leaves_attributes> <text>]
|
||||||
[leaves paragraph]
|
[leaves paragraph]
|
||||||
(let [num-leaves (count leaves)
|
(let [leaves (filter #(not (str/blank? (:text %))) leaves)
|
||||||
|
num-leaves (count leaves)
|
||||||
paragraph-attr-size 48
|
paragraph-attr-size 48
|
||||||
leaf-attr-size 52
|
leaf-attr-size 52
|
||||||
metadata-size (+ 1 paragraph-attr-size (* num-leaves leaf-attr-size))
|
metadata-size (+ 1 paragraph-attr-size (* num-leaves leaf-attr-size))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue