mirror of
https://github.com/penpot/penpot.git
synced 2025-02-15 11:38:24 -05:00
✨ Fix custom fonts embbedding issue.
This commit is contained in:
parent
2834850337
commit
897f41bc7a
1 changed files with 10 additions and 1 deletions
|
@ -61,7 +61,8 @@
|
||||||
(defn get-font-css
|
(defn get-font-css
|
||||||
"Given a font and the variant-id, retrieves the style CSS for it."
|
"Given a font and the variant-id, retrieves the style CSS for it."
|
||||||
[{:keys [id backend family variants] :as font} font-variant-id]
|
[{:keys [id backend family variants] :as font} font-variant-id]
|
||||||
(if (= :google backend)
|
(cond
|
||||||
|
(= :google backend)
|
||||||
(let [uri (fonts/generate-gfonts-url {:family family :variants [{:id font-variant-id}]})]
|
(let [uri (fonts/generate-gfonts-url {:family family :variants [{:id font-variant-id}]})]
|
||||||
(->> (http/send! {:method :get
|
(->> (http/send! {:method :get
|
||||||
:mode :cors
|
:mode :cors
|
||||||
|
@ -70,6 +71,14 @@
|
||||||
:response-type :text})
|
:response-type :text})
|
||||||
(rx/map :body)
|
(rx/map :body)
|
||||||
(http/as-promise)))
|
(http/as-promise)))
|
||||||
|
|
||||||
|
|
||||||
|
(= :custom backend)
|
||||||
|
(let [variant (d/seek #(= (:id %) font-variant-id) variants)
|
||||||
|
result (fonts/generate-custom-font-variant-css family variant)]
|
||||||
|
(p/resolved result))
|
||||||
|
|
||||||
|
:else
|
||||||
(let [{:keys [name weight style suffix] :as variant} (d/seek #(= (:id %) font-variant-id) variants)
|
(let [{:keys [name weight style suffix] :as variant} (d/seek #(= (:id %) font-variant-id) variants)
|
||||||
result (str/fmt font-face-template {:family family
|
result (str/fmt font-face-template {:family family
|
||||||
:style style
|
:style style
|
||||||
|
|
Loading…
Add table
Reference in a new issue