0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-13 15:31:26 -05:00

🐛 Fix problem when exporting single text

This commit is contained in:
alonso.torres 2022-05-10 11:50:10 +02:00
parent 82d744b94a
commit 8df93c2707
3 changed files with 11 additions and 8 deletions

View file

@ -402,7 +402,7 @@
:style {:-webkit-print-color-adjust :exact}
:fill "none"}
(let [fonts (ff/frame->fonts object objects)]
(let [fonts (ff/shape->fonts object objects)]
[:& ff/fontfaces-style {:fonts fonts}])
(case (:type object)

View file

@ -73,12 +73,15 @@
(when (d/not-empty? style)
[:style style])))
(defn frame->fonts
[frame objects]
(->> (cph/get-children objects (:id frame))
(filter cph/text-shape?)
(map (comp fonts/get-content-fonts :content))
(reduce set/union #{})))
(defn shape->fonts
[shape objects]
(let [initial (cond-> #{}
(cph/text-shape? shape)
(into (fonts/get-content-fonts (:content shape))))]
(->> (cph/get-children objects (:id shape))
(filter cph/text-shape?)
(map (comp fonts/get-content-fonts :content))
(reduce set/union initial))))
(defn shapes->fonts
[shapes]

View file

@ -61,7 +61,7 @@
thumbnail? (unchecked-get props "thumbnail?")
objects (unchecked-get props "objects")
fonts (mf/use-memo (mf/deps shape objects) #(ff/frame->fonts shape objects))
fonts (mf/use-memo (mf/deps shape objects) #(ff/shape->fonts shape objects))
fonts (-> fonts (hooks/use-equal-memo))
force-render (mf/use-state false)