0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-13 10:38:13 -05:00

Fix custom fonts embbedding issue.

This commit is contained in:
Andrey Antukh 2021-05-26 12:39:41 +02:00
parent 2834850337
commit 897f41bc7a

View file

@ -61,7 +61,8 @@
(defn get-font-css
"Given a font and the variant-id, retrieves the style CSS for it."
[{: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}]})]
(->> (http/send! {:method :get
:mode :cors
@ -70,6 +71,14 @@
:response-type :text})
(rx/map :body)
(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)
result (str/fmt font-face-template {:family family
:style style