mirror of
https://github.com/penpot/penpot.git
synced 2025-03-15 17:21:17 -05:00
🐛 Fix inspect code text fonts
This commit is contained in:
parent
bf6e467abf
commit
8d20220330
2 changed files with 11 additions and 9 deletions
|
@ -18,7 +18,6 @@
|
|||
[app.util.http :as http]
|
||||
[app.util.object :as obj]
|
||||
[beicon.v2.core :as rx]
|
||||
[clojure.set :as set]
|
||||
[cuerdas.core :as str]
|
||||
[lambdaisland.uri :as u]
|
||||
[okulary.core :as l]
|
||||
|
@ -273,13 +272,17 @@
|
|||
|
||||
(defn get-content-fonts
|
||||
"Extracts the fonts used by the content of a text shape"
|
||||
[{font-id :font-id children :children :as content}]
|
||||
(let [current-font
|
||||
(if (some? font-id)
|
||||
#{(select-keys content [:font-id :font-variant-id])}
|
||||
#{(select-keys txt/default-text-attrs [:font-id :font-variant-id])})
|
||||
children-font (->> children (mapv get-content-fonts))]
|
||||
(reduce set/union (conj children-font current-font))))
|
||||
[content]
|
||||
(->> (txt/node-seq content)
|
||||
(filter txt/is-text-node?)
|
||||
(reduce
|
||||
(fn [result {:keys [font-id] :as node}]
|
||||
(let [current-font
|
||||
(if (some? font-id)
|
||||
(select-keys node [:font-id :font-variant-id])
|
||||
(select-keys txt/default-text-attrs [:font-id :font-variant-id]))]
|
||||
(conj result current-font)))
|
||||
#{})))
|
||||
|
||||
(defn fetch-font-css
|
||||
"Given a font and the variant-id, retrieves the fontface CSS"
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
(let [valign (:vertical-align node "top")
|
||||
base #js {:height (fmt/format-pixels height)
|
||||
:width (fmt/format-pixels width)
|
||||
:fontFamily "sourcesanspro"
|
||||
:display "flex"
|
||||
:whiteSpace "break-spaces"}]
|
||||
(cond-> base
|
||||
|
|
Loading…
Add table
Reference in a new issue