From 007acc4bc2bc70af98645208ea1a830390b9367d Mon Sep 17 00:00:00 2001 From: Niklas Wimmer Date: Tue, 19 Mar 2024 19:38:22 +0100 Subject: [PATCH] gpui: Update cosmic-text and resvg dependency This unifies the rustybuzz dependency to the same version. Signed-off-by: Niklas Wimmer --- Cargo.lock | 314 ++++++++---------- crates/gpui/Cargo.toml | 6 +- crates/gpui/src/platform/linux/text_system.rs | 3 + crates/gpui/src/svg_renderer.rs | 27 +- 4 files changed, 168 insertions(+), 182 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c7abc158d..6430951215 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -239,12 +239,6 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" -[[package]] -name = "arrayvec" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" - [[package]] name = "arrayvec" version = "0.7.4" @@ -2548,19 +2542,21 @@ dependencies = [ [[package]] name = "cosmic-text" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75acbfb314aeb4f5210d379af45ed1ec2c98c7f1790bf57b8a4c562ac0c51b71" +checksum = "c578f2b9abb4d5f3fbb12aba4008084d435dc6a8425c195cfe0b3594bfea0c25" dependencies = [ - "fontdb 0.15.0", + "bitflags 2.4.2", + "fontdb", "libm", "log", "rangemap", "rustc-hash", - "rustybuzz 0.11.0", + "rustybuzz", "self_cell", "swash", "sys-locale", + "ttf-parser", "unicode-bidi", "unicode-linebreak", "unicode-script", @@ -2931,12 +2927,9 @@ checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" [[package]] name = "data-url" -version = "0.1.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" -dependencies = [ - "matches", -] +checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a" [[package]] name = "db" @@ -3583,6 +3576,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "fdeflate" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f9bfee30e4dedf0ab8b422f03af778d9612b63f502710fc500a334ebe2de645" +dependencies = [ + "simd-adler32", +] + [[package]] name = "feature_flags" version = "0.1.0" @@ -3690,9 +3692,9 @@ dependencies = [ [[package]] name = "float-cmp" -version = "0.5.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75224bec9bfe1a65e2d34132933f2de7fe79900c96a0174307554244ece8150e" +checksum = "98de4bbd547a563b716d8dfa9aad1cb19bfab00f4fa09a6a4ed21dbcf44ce9c4" [[package]] name = "float-ord" @@ -3754,32 +3756,21 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a595cb550439a117696039dfc69830492058211b771a2a165379f2a1a53d84d" dependencies = [ - "roxmltree 0.19.0", + "roxmltree", ] [[package]] name = "fontdb" -version = "0.5.4" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e58903f4f8d5b58c7d300908e4ebe5289c1bfdf5587964330f12023b8ff17fd1" -dependencies = [ - "log", - "memmap2 0.2.3", - "ttf-parser 0.12.3", -] - -[[package]] -name = "fontdb" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020e203f177c0fb250fb19455a252e838d2bbbce1f80f25ecc42402aafa8cd38" +checksum = "b0299020c3ef3f60f526a4f64ab4a3d4ce116b1acbf24cdd22da0068e5d81dc3" dependencies = [ "fontconfig-parser", "log", - "memmap2 0.8.0", + "memmap2 0.9.4", "slotmap", "tinyvec", - "ttf-parser 0.19.2", + "ttf-parser", ] [[package]] @@ -4146,6 +4137,16 @@ dependencies = [ "weezl", ] +[[package]] +name = "gif" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80792593675e051cf94a4b111980da2ba60d4a83e43e0048c5693baab3977045" +dependencies = [ + "color_quant", + "weezl", +] + [[package]] name = "gimli" version = "0.28.0" @@ -4355,8 +4356,6 @@ dependencies = [ "taffy", "thiserror", "time", - "tiny-skia", - "usvg", "util", "uuid", "waker-fn", @@ -4754,12 +4753,12 @@ dependencies = [ "bytemuck", "byteorder", "color_quant", - "gif", - "jpeg-decoder", + "gif 0.11.4", + "jpeg-decoder 0.1.22", "num-iter", "num-rational 0.3.2", "num-traits", - "png", + "png 0.16.8", "scoped_threadpool", "tiff", ] @@ -4777,6 +4776,12 @@ dependencies = [ "workspace", ] +[[package]] +name = "imagesize" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" + [[package]] name = "indexmap" version = "1.9.3" @@ -5073,6 +5078,12 @@ dependencies = [ "rayon", ] +[[package]] +name = "jpeg-decoder" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" + [[package]] name = "js-sys" version = "0.3.64" @@ -5129,11 +5140,21 @@ dependencies = [ [[package]] name = "kurbo" -version = "0.8.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a53776d271cfb873b17c618af0298445c88afc52837f3e948fa3fafd131f449" +checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", +] + +[[package]] +name = "kurbo" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1618d4ebd923e97d67e7cd363d80aef35fe961005cbbbb3d2dad8bdd1bc63440" +dependencies = [ + "arrayvec", + "smallvec", ] [[package]] @@ -5643,12 +5664,6 @@ dependencies = [ "regex-automata 0.1.10", ] -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - [[package]] name = "matchit" version = "0.7.3" @@ -5697,15 +5712,6 @@ dependencies = [ "rustix 0.38.32", ] -[[package]] -name = "memmap2" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "723e3ebdcdc5c023db1df315364573789f8857c11b631a2fdfad7c00f5c046b4" -dependencies = [ - "libc", -] - [[package]] name = "memmap2" version = "0.8.0" @@ -5803,6 +5809,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", + "simd-adler32", ] [[package]] @@ -6705,7 +6712,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90fcb95eef784c2ac79119d1dd819e162b5da872ce6f3c3abe1e8ca1c082f72b" dependencies = [ - "siphasher 0.3.11", + "siphasher", ] [[package]] @@ -6725,9 +6732,9 @@ dependencies = [ [[package]] name = "pico-args" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8bcd96cb740d03149cbad5518db9fd87126a10ab519c011893b1754134c468" +checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315" [[package]] name = "pin-project" @@ -6835,6 +6842,19 @@ dependencies = [ "miniz_oxide 0.3.7", ] +[[package]] +name = "png" +version = "0.17.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" +dependencies = [ + "bitflags 1.3.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.7.1", +] + [[package]] name = "polling" version = "2.8.0" @@ -7389,12 +7409,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "rctree" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be9e29cb19c8fe84169fcb07f8f11e66bc9e6e0280efd4715c54818296f8a4a8" - [[package]] name = "read-fonts" version = "0.15.3" @@ -7596,16 +7610,17 @@ dependencies = [ [[package]] name = "resvg" -version = "0.14.1" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09697862c5c3f940cbaffef91969c62188b5c8ed385b0aef43a5ff01ddc8000f" +checksum = "024e40e1ba7313fc315b1720298988c0cd6f8bfe3754b52838aafecebd11355a" dependencies = [ - "jpeg-decoder", + "gif 0.12.0", + "jpeg-decoder 0.3.1", "log", "pico-args", - "png", + "png 0.17.13", "rgb", - "svgfilters", + "svgtypes", "tiny-skia", "usvg", ] @@ -7736,7 +7751,7 @@ dependencies = [ name = "rope" version = "0.1.0" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "bromberg_sl2", "gpui", "log", @@ -7746,15 +7761,6 @@ dependencies = [ "util", ] -[[package]] -name = "roxmltree" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "921904a62e410e37e215c40381b7117f830d9d89ba60ab5236170541dd25646b" -dependencies = [ - "xmlparser", -] - [[package]] name = "roxmltree" version = "0.19.0" @@ -7868,7 +7874,7 @@ version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c4216490d5a413bc6d10fa4742bd7d4955941d062c0ef873141d6b0e7b30fd" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "borsh", "bytes 1.5.0", "num-traits", @@ -7990,31 +7996,15 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rustybuzz" -version = "0.3.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ab463a295d00f3692e0974a0bfd83c7a9bcd119e27e07c2beecdb1b44a09d10" +checksum = "f0ae5692c5beaad6a9e22830deeed7874eae8a4e3ba4076fb48e12c56856222c" dependencies = [ - "bitflags 1.3.2", - "bytemuck", - "smallvec", - "ttf-parser 0.9.0", - "unicode-bidi-mirroring", - "unicode-ccc", - "unicode-general-category", - "unicode-script", -] - -[[package]] -name = "rustybuzz" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ee8fe2a8461a0854a37101fe7a1b13998d0cfa987e43248e81d2a5f4570f6fa" -dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.2", "bytemuck", "libm", "smallvec", - "ttf-parser 0.20.0", + "ttf-parser", "unicode-bidi-mirroring", "unicode-ccc", "unicode-properties", @@ -8027,15 +8017,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" -[[package]] -name = "safe_arch" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ff3d6d9696af502cc3110dacce942840fb06ff4514cad92236ecc455f2ce05" -dependencies = [ - "bytemuck", -] - [[package]] name = "safemem" version = "0.3.3" @@ -8578,6 +8559,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "simd-adler32" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" + [[package]] name = "simdutf8" version = "0.1.4" @@ -8622,12 +8609,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "siphasher" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" - [[package]] name = "siphasher" version = "0.3.11" @@ -9118,6 +9099,15 @@ dependencies = [ "ui", ] +[[package]] +name = "strict-num" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6637bab7722d379c8b41ba849228d680cc12d0a45ba1fa2b48f2a30577a06731" +dependencies = [ + "float-cmp", +] + [[package]] name = "stringprep" version = "0.1.4" @@ -9177,7 +9167,7 @@ checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" name = "sum_tree" version = "0.1.0" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "ctor", "env_logger", "log", @@ -9259,24 +9249,14 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2" -[[package]] -name = "svgfilters" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0dce2fee79ac40c21dafba48565ff7a5fa275e23ffe9ce047a40c9574ba34e" -dependencies = [ - "float-cmp", - "rgb", -] - [[package]] name = "svgtypes" -version = "0.5.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c536faaff1a10837cfe373142583f6e27d81e96beba339147e77b67c9f260ff" +checksum = "59d7618f12b51be8171a7cfdda1e7a93f79cbc57c4e7adf89a749cf671125241" dependencies = [ - "float-cmp", - "siphasher 0.2.3", + "kurbo 0.10.4", + "siphasher", ] [[package]] @@ -9363,7 +9343,7 @@ name = "taffy" version = "0.3.11" source = "git+https://github.com/DioxusLabs/taffy?rev=1876f72bee5e376023eaa518aa7b8a34c769bd1b#1876f72bee5e376023eaa518aa7b8a34c769bd1b" dependencies = [ - "arrayvec 0.7.4", + "arrayvec", "grid", "num-traits", "slotmap", @@ -9653,7 +9633,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a53f4706d65497df0c4349241deddf35f84cee19c87ed86ea8ca590f4464437" dependencies = [ - "jpeg-decoder", + "jpeg-decoder 0.1.22", "miniz_oxide 0.4.4", "weezl", ] @@ -9713,16 +9693,28 @@ dependencies = [ [[package]] name = "tiny-skia" -version = "0.5.1" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bf81f2900d2e235220e6f31ec9f63ade6a7f59090c556d74fe949bb3b15e9fe" +checksum = "83d13394d44dae3207b52a326c0c85a8bf87f1541f23b0d143811088497b09ab" dependencies = [ "arrayref", - "arrayvec 0.5.2", + "arrayvec", "bytemuck", "cfg-if", - "png", - "safe_arch", + "log", + "png 0.17.13", + "tiny-skia-path", +] + +[[package]] +name = "tiny-skia-path" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e7fc0c2e86a30b117d0462aa261b72b7a99b7ebd7deb3a14ceda95c5bdc93" +dependencies = [ + "arrayref", + "bytemuck", + "strict-num", ] [[package]] @@ -10505,24 +10497,6 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" -[[package]] -name = "ttf-parser" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62ddb402ac6c2af6f7a2844243887631c4e94b51585b229fcfddb43958cd55ca" - -[[package]] -name = "ttf-parser" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ae2f58a822f08abdaf668897e96a5656fe72f5a9ce66422423e8849384872e6" - -[[package]] -name = "ttf-parser" -version = "0.19.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1" - [[package]] name = "ttf-parser" version = "0.20.0" @@ -10628,12 +10602,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" -[[package]] -name = "unicode-general-category" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9af028e052a610d99e066b33304625dea9613170a2563314490a4e6ec5cf7f" - [[package]] name = "unicode-ident" version = "1.0.12" @@ -10735,25 +10703,25 @@ checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "usvg" -version = "0.14.1" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8352f317d8f9a918ba5154797fb2a93e2730244041cf7d5be35148266adfa5" +checksum = "c04150a94f0bfc3b2c15d4e151524d14cd06765fc6641d8b1c59a248360d4474" dependencies = [ - "base64 0.13.1", + "base64 0.21.4", "data-url", "flate2", - "fontdb 0.5.4", - "kurbo", + "fontdb", + "imagesize", + "kurbo 0.9.5", "log", - "memmap2 0.2.3", "pico-args", - "rctree", - "roxmltree 0.14.1", - "rustybuzz 0.3.0", + "roxmltree", + "rustybuzz", "simplecss", - "siphasher 0.2.3", + "siphasher", + "strict-num", "svgtypes", - "ttf-parser 0.12.3", + "tiny-skia-path", "unicode-bidi", "unicode-script", "unicode-vo", diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml index 1f49943fb2..ba9781194f 100644 --- a/crates/gpui/Cargo.toml +++ b/crates/gpui/Cargo.toml @@ -54,7 +54,7 @@ profiling.workspace = true rand.workspace = true raw-window-handle = "0.6" refineable.workspace = true -resvg = "0.14" +resvg = "0.40" schemars.workspace = true seahash = "4.1" serde.workspace = true @@ -67,8 +67,6 @@ sum_tree.workspace = true taffy = { git = "https://github.com/DioxusLabs/taffy", rev = "1876f72bee5e376023eaa518aa7b8a34c769bd1b" } thiserror.workspace = true time.workspace = true -tiny-skia = "0.5" -usvg = { version = "0.14", features = [] } util.workspace = true uuid = { version = "1.1.2", features = ["v4", "v5"] } waker-fn = "1.1.0" @@ -101,7 +99,7 @@ blade-graphics.workspace = true blade-macros.workspace = true blade-rwh.workspace = true bytemuck = "1" -cosmic-text = "0.10.0" +cosmic-text = "0.11.2" copypasta = "0.10.1" [target.'cfg(target_os = "linux")'.dependencies] diff --git a/crates/gpui/src/platform/linux/text_system.rs b/crates/gpui/src/platform/linux/text_system.rs index 7906a2f6fb..e1d5648c13 100644 --- a/crates/gpui/src/platform/linux/text_system.rs +++ b/crates/gpui/src/platform/linux/text_system.rs @@ -286,6 +286,7 @@ impl LinuxTextSystemState { params.glyph_id.0 as u16, (params.font_size * params.scale_factor).into(), (0.0, 0.0), + cosmic_text::CacheKeyFlags::empty(), ) .0, ) @@ -319,6 +320,7 @@ impl LinuxTextSystemState { params.glyph_id.0 as u16, (params.font_size * params.scale_factor).into(), (0.0, 0.0), + cosmic_text::CacheKeyFlags::empty(), ) .0, ) @@ -381,6 +383,7 @@ impl LinuxTextSystemState { font_size.0, f32::MAX, // We do our own wrapping cosmic_text::Wrap::None, + None, ); let mut runs = Vec::new(); diff --git a/crates/gpui/src/svg_renderer.rs b/crates/gpui/src/svg_renderer.rs index 978d5a626b..c1aa8881de 100644 --- a/crates/gpui/src/svg_renderer.rs +++ b/crates/gpui/src/svg_renderer.rs @@ -1,6 +1,9 @@ use crate::{AssetSource, DevicePixels, IsZero, Result, SharedString, Size}; use anyhow::anyhow; -use std::{hash::Hash, sync::Arc}; +use std::{ + hash::Hash, + sync::{Arc, OnceLock}, +}; #[derive(Clone, PartialEq, Hash, Eq)] pub(crate) struct RenderSvgParams { @@ -24,15 +27,19 @@ impl SvgRenderer { // Load the tree. let bytes = self.asset_source.load(¶ms.path)?; - let tree = usvg::Tree::from_data(&bytes, &usvg::Options::default())?; + let tree = + resvg::usvg::Tree::from_data(&bytes, &resvg::usvg::Options::default(), svg_fontdb())?; // Render the SVG to a pixmap with the specified width and height. let mut pixmap = - tiny_skia::Pixmap::new(params.size.width.into(), params.size.height.into()).unwrap(); + resvg::tiny_skia::Pixmap::new(params.size.width.into(), params.size.height.into()) + .unwrap(); + + let ratio = params.size.width.0 as f32 / tree.size().width(); resvg::render( &tree, - usvg::FitTo::Width(params.size.width.into()), - pixmap.as_mut(), + resvg::tiny_skia::Transform::from_scale(ratio, ratio), + &mut pixmap.as_mut(), ); // Convert the pixmap's pixels into an alpha mask. @@ -44,3 +51,13 @@ impl SvgRenderer { Ok(alpha_mask) } } + +/// Returns the global font database used for SVG rendering. +fn svg_fontdb() -> &'static resvg::usvg::fontdb::Database { + static FONTDB: OnceLock = OnceLock::new(); + FONTDB.get_or_init(|| { + let mut fontdb = resvg::usvg::fontdb::Database::new(); + fontdb.load_system_fonts(); + fontdb + }) +}