🐛 Fix font id serialization

This commit is contained in:
Elena Torro 2025-04-29 11:58:15 +02:00 committed by Belén Albeza
parent 219ddfabaf
commit f8602810eb
2 changed files with 21 additions and 10 deletions

View file

@ -145,12 +145,19 @@
(defn serialize-font-id
[font-id]
(let [google-font? (str/starts-with? font-id "gfont-")]
(if google-font?
(uuid/get-u32 (google-font-id->uuid font-id))
(let [no-prefix (subs font-id (inc (str/index-of font-id "-")))
as-uuid (uuid/uuid no-prefix)]
(uuid/get-u32 as-uuid)))))
(try
(if (nil? font-id)
(do
[uuid/zero])
(let [google-font? (str/starts-with? font-id "gfont-")]
(if google-font?
(uuid/get-u32 (google-font-id->uuid font-id))
(let [no-prefix (subs font-id (inc (str/index-of font-id "-")))]
(if (or (nil? no-prefix) (not (string? no-prefix)) (str/blank? no-prefix))
[uuid/zero]
(uuid/get-u32 (uuid/uuid no-prefix)))))))
(catch :default _e
[uuid/zero])))
(defn serialize-font-weight
[font-weight]

View file

@ -46,10 +46,14 @@
(defn serialize-uuid
[id]
(if (nil? id)
[uuid/zero]
(let [as-uuid (uuid/uuid id)]
(uuid/get-u32 as-uuid))))
(try
(if (nil? id)
(do
[uuid/zero])
(let [as-uuid (uuid/uuid id)]
(uuid/get-u32 as-uuid)))
(catch :default _e
[uuid/zero])))
(defn heapu32-set-u32
[value heap offset]