🐛 Fix custom fonts not rendered correctly

This commit is contained in:
Alejandro Alonso 2023-02-24 10:50:35 +01:00 committed by Alonso Torres
parent 1f3f6ce1e9
commit ccf91a129c
2 changed files with 54 additions and 45 deletions

View file

@ -3,6 +3,7 @@
### :bug: Bugs fixed ### :bug: Bugs fixed
- Fix copy and paste very nested inside itself [Taiga #4848](https://tree.taiga.io/project/penpot/issue/4848) - Fix copy and paste very nested inside itself [Taiga #4848](https://tree.taiga.io/project/penpot/issue/4848)
- Fix custom fonts not rendered correctly [Taiga #4874](https://tree.taiga.io/project/penpot/issue/4874)
## 1.17.2 ## 1.17.2

View file

@ -177,56 +177,64 @@
(watch [_ _ stream] (watch [_ _ stream]
(let [team-id (:team-id project) (let [team-id (:team-id project)
stoper (rx/filter (ptk/type? ::bundle-fetched) stream)] stoper (rx/filter (ptk/type? ::bundle-fetched) stream)]
(->> (rx/merge (->> (rx/concat
;; Initialize notifications & load team fonts ;; Initialize notifications
(rx/of (dwn/initialize team-id id) (rx/of (dwn/initialize team-id id)
(dwsl/initialize) (dwsl/initialize))
(df/load-team-fonts team-id))
;; Load all pages, independently if they are pointers or already ;; Load team fonts. We must ensure custom fonts are fully loadad before starting the workspace load
;; resolved values. (rx/merge
(->> (rx/from (seq (:pages-index data))) (->> stream
(rx/merge-map (rx/filter (ptk/type? :app.main.data.fonts/team-fonts-loaded))
(fn [[_ page :as kp]] (rx/take 1)
(if (t/pointer? page) (rx/ignore))
(resolve-pointer id kp) (rx/of (df/load-team-fonts team-id)))
(rx/of kp))))
(rx/merge-map
(fn [[id page]]
(let [page (update page :objects ctst/start-page-index)]
(->> (uw/ask! {:cmd :initialize-page-index :page page})
(rx/map (constantly [id page]))))))
(rx/reduce conj {})
(rx/map (fn [pages-index]
(-> data
(assoc :pages-index pages-index)
(workspace-data-loaded)))))
;; Once workspace data is loaded, proceed asynchronously load (rx/merge
;; the local library and all referenced libraries, without ;; Load all pages, independently if they are pointers or already
;; blocking the main workspace load process. ;; resolved values.
(->> stream (->> (rx/from (seq (:pages-index data)))
(rx/filter (ptk/type? ::workspace-data-loaded)) (rx/merge-map
(rx/take 1) (fn [[_ page :as kp]]
(rx/merge-map (if (t/pointer? page)
(fn [_] (resolve-pointer id kp)
(rx/merge (rx/of kp))))
(rx/of (workspace-initialized)) (rx/merge-map
(fn [[id page]]
(let [page (update page :objects ctst/start-page-index)]
(->> (uw/ask! {:cmd :initialize-page-index :page page})
(rx/map (constantly [id page]))))))
(rx/reduce conj {})
(rx/map (fn [pages-index]
(-> data
(assoc :pages-index pages-index)
(workspace-data-loaded)))))
(->> data ;; Once workspace data is loaded, proceed asynchronously load
(filter (comp t/pointer? val)) ;; the local library and all referenced libraries, without
(resolve-pointers id) ;; blocking the main workspace load process.
(rx/map workspace-data-pointers-loaded)) (->> stream
(rx/filter (ptk/type? ::workspace-data-loaded))
(rx/take 1)
(rx/merge-map
(fn [_]
(rx/merge
(rx/of (workspace-initialized))
(->> (rp/cmd! :get-file-libraries {:file-id id :features features}) (->> data
(rx/mapcat identity) (filter (comp t/pointer? val))
(rx/mapcat (resolve-pointers id)
(fn [{:keys [id data] :as file}] (rx/map workspace-data-pointers-loaded))
(->> (filter (comp t/pointer? val) data)
(resolve-pointers id) (->> (rp/cmd! :get-file-libraries {:file-id id :features features})
(rx/map #(update file :data merge %))))) (rx/mapcat identity)
(rx/reduce conj []) (rx/mapcat
(rx/map libraries-fetched))))))) (fn [{:keys [id data] :as file}]
(->> (filter (comp t/pointer? val) data)
(resolve-pointers id)
(rx/map #(update file :data merge %)))))
(rx/reduce conj [])
(rx/map libraries-fetched))))))))
(rx/take-until stoper))))))) (rx/take-until stoper)))))))