0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-30 00:21:19 -05:00

🐛 Fix bug in font embedding.

This commit is contained in:
Andrey Antukh 2021-04-15 18:17:45 +02:00 committed by Andrés Moya
parent 2b35dce037
commit dd92e5d773
2 changed files with 6 additions and 7 deletions
frontend/src/app/main/ui/shapes

View file

@ -38,7 +38,7 @@
{:style style {:style style
:xmlns "http://www.w3.org/1999/xhtml"} :xmlns "http://www.w3.org/1999/xhtml"}
(when embed? (when embed?
[ste/embed-fontfaces-style {:node node}]) [:& ste/embed-fontfaces-style {:node node}])
children])) children]))
(mf/defc render-paragraph-set (mf/defc render-paragraph-set

View file

@ -89,17 +89,16 @@
(with-cache {:key uris :max-age (dt/duration {:hours 4})} (with-cache {:key uris :max-age (dt/duration {:hours 4})}
(->> (rx/from (seq uris)) (->> (rx/from (seq uris))
(rx/mapcat (fn [uri] (rx/mapcat (fn [uri]
(http/send! {:method :get (->> (http/send! {:method :get :uri uri :response-type :blob})
:uri uri (rx/map :body)
:response-type :blob}))) (rx/mapcat wapi/read-file-as-data-url)
(rx/map :body))))) (rx/map #(vector uri %)))))
(rx/reduce conj [])))))
(defn get-font-data (defn get-font-data
"Parses the CSS and retrieves the font data as DataURI." "Parses the CSS and retrieves the font data as DataURI."
[^string css] [^string css]
(->> (fetch-font-data css) (->> (fetch-font-data css)
(rx/mapcat wapi/read-file-as-data-url)
(rx/reduce conj [])
(http/as-promise))) (http/as-promise)))
(defn embed-font (defn embed-font