🐛 Fix font family not being updated when changed from dropdown

This commit is contained in:
Belén Albeza
2025-11-11 15:52:18 +01:00
parent 483a1bd703
commit 5c2dde7308
3 changed files with 11 additions and 6 deletions

View File

@@ -904,7 +904,7 @@
(map :id)
(run! f/update-text-layout)))
(defn process-pending
(defn process-pending!
[shapes thumbnails full]
(let [event (js/CustomEvent. "wasm:set-objects-finished")
pending-thumbnails (-> (d/index-by :key :callback thumbnails) vals)
@@ -925,7 +925,7 @@
(defn process-object
[shape]
(let [{:keys [thumbnails full]} (set-object [] shape)]
(process-pending [shape] thumbnails full)))
(process-pending! [shape] thumbnails full)))
(defn set-objects
[objects]
@@ -943,7 +943,7 @@
(into full-acc full)))
{:thumbnails thumbnails-acc :full full-acc}))]
(perf/end-measure "set-objects")
(process-pending shapes thumbnails full)))
(process-pending! shapes thumbnails full)))
(defn clear-focus-mode
[]

View File

@@ -86,7 +86,7 @@
(aget shape-id-buffer 2)
(aget shape-id-buffer 3))))
;; IMPORTANT: It should be noted that only TTF fonts can be stored.
;; IMPORTANT: Only TTF fonts can be stored.
(defn- store-font-buffer
[shape-id font-data font-array-buffer emoji? fallback?]
(let [font-id-buffer (:family-id-buffer font-data)
@@ -232,6 +232,7 @@
(store-font-id shape-id font-data asset-id emoji? fallback?)))
(defn store-fonts
[shape-id fonts]
(keep (fn [font] (store-font shape-id font)) fonts))

View File

@@ -187,8 +187,12 @@
(api/set-shape-svg-raw-content (api/get-static-markup shape))
(= (:type shape) :text)
(do (api/set-shape-text-content id v)
(api/set-shape-text-images id v)))
(let [pending-thumbnails (into [] (concat (api/set-shape-text-content id v)))
pending-full (into [] (concat (api/set-shape-text-images id v)))]
;; FIXME: this is a hack to process the pending tasks asynchronously
;; we should probably modify set-wasm-attr! to return a list of callbacks to be executed in a second pass.
(api/process-pending! [shape] pending-thumbnails pending-full)
nil))
:grow-type
(api/set-shape-grow-type v)