From ea0cc4c7e34068dcc3c255f391a9bf74f9eee792 Mon Sep 17 00:00:00 2001 From: Joscha Date: Sat, 22 Feb 2025 16:32:49 +0100 Subject: [PATCH] Update typst and related packages --- Cargo.lock | 619 +++++++++++++++++---------- Cargo.toml | 7 +- showbits-common/Cargo.toml | 1 - showbits-common/src/widgets/typst.rs | 38 +- 4 files changed, 404 insertions(+), 261 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e23f37a..599bd01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -231,12 +231,6 @@ dependencies = [ "windows-targets", ] -[[package]] -name = "base64" -version = "0.21.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" - [[package]] name = "base64" version = "0.22.1" @@ -245,9 +239,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "biblatex" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27fe7285040d0227cd8b5395e1c4783f44f0b673eca5a657f4432ae401f2b7b8" +checksum = "a35a7317fcbdbef94b60d0dd0a658711a936accfce4a631fea4bf8e527eff3c2" dependencies = [ "numerals", "paste", @@ -446,11 +440,11 @@ dependencies = [ [[package]] name = "citationberg" -version = "0.3.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d259fe9fd78ffa05a119581d20fddb50bfba428311057b12741ffb9015123d0b" +checksum = "e4595e03beafb40235070080b5286d3662525efc622cca599585ff1d63f844fa" dependencies = [ - "quick-xml 0.31.0", + "quick-xml 0.36.2", "serde", ] @@ -482,7 +476,7 @@ version = "4.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "syn", @@ -500,6 +494,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67ba02a97a2bd10f4b59b25c7973101c79642302776489e030cd13cdab09ed15" +[[package]] +name = "codex" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "724d27a0ee38b700e5e164350e79aba601a0db673ac47fce1cb74c3e38864036" + [[package]] name = "color_quant" version = "1.1.0" @@ -521,7 +521,7 @@ dependencies = [ "comemo-macros", "once_cell", "parking_lot", - "siphasher 1.0.1", + "siphasher", ] [[package]] @@ -551,7 +551,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59fd57d82eb4bfe7ffa9b1cec0c05e2fd378155b47f255a67983cb4afe0e80c2" dependencies = [ "bitflags 2.8.0", - "fontdb", + "fontdb 0.16.2", "log", "rangemap", "rayon", @@ -823,6 +823,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "font-types" version = "0.7.3" @@ -838,7 +844,7 @@ version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1fcfcd44ca6e90c921fee9fa665d530b21ef1327a4c1a6c5250ea44b776ada7" dependencies = [ - "roxmltree 0.20.0", + "roxmltree", ] [[package]] @@ -855,6 +861,18 @@ dependencies = [ "ttf-parser 0.20.0", ] +[[package]] +name = "fontdb" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37be9fc20d966be438cd57a45767f73349477fb0f85ce86e000557f787298afb" +dependencies = [ + "log", + "slotmap", + "tinyvec", + "ttf-parser 0.24.1", +] + [[package]] name = "form_urlencoded" version = "1.2.1" @@ -930,16 +948,6 @@ dependencies = [ "windows-targets", ] -[[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 = "gif" version = "0.13.1" @@ -977,12 +985,15 @@ name = "hashbrown" version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" +dependencies = [ + "foldhash", +] [[package]] name = "hayagriva" -version = "0.5.3" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0d20c98b77b86ce737876b2a1653e2e6abbeee84afbb39d72111091191c97a" +checksum = "954907554bb7fcba29a4f917c2d43e289ec21b69d872ccf97db160eca6caeed8" dependencies = [ "biblatex", "ciborium", @@ -999,12 +1010,6 @@ dependencies = [ "url", ] -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "heck" version = "0.5.0" @@ -1297,21 +1302,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb56e1aa765b4b4f3aadfab769793b7087bb03a4ea4920644a6d238e2df5b9ed" -[[package]] -name = "image" -version = "0.24.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "gif 0.13.1", - "jpeg-decoder", - "num-traits", - "png", -] - [[package]] name = "image" version = "0.25.5" @@ -1322,8 +1312,8 @@ dependencies = [ "byteorder-lite", "color_quant", "exr", - "gif 0.13.1", - "image-webp", + "gif", + "image-webp 0.2.1", "num-traits", "png", "qoi", @@ -1335,6 +1325,16 @@ dependencies = [ "zune-jpeg", ] +[[package]] +name = "image-webp" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f79afb8cbee2ef20f59ccd477a218c12a93943d075b492015ecb1bb81f8ee904" +dependencies = [ + "byteorder-lite", + "quick-error", +] + [[package]] name = "image-webp" version = "0.2.1" @@ -1347,9 +1347,9 @@ dependencies = [ [[package]] name = "imagesize" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "029d73f573d8e8d63e6d5020011d3255b28c3ba85d6cf870a07184ed23de9284" +checksum = "edcd27d72f2f071c64249075f42e205ff93c9a4c5f6c6da53e79ed9f9832c285" [[package]] name = "imgref" @@ -1368,12 +1368,6 @@ dependencies = [ "serde", ] -[[package]] -name = "indexmap-nostd" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" - [[package]] name = "interpolate_name" version = "0.2.4" @@ -1423,20 +1417,21 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" [[package]] name = "kamadak-exif" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef4fc70d0ab7e5b6bafa30216a6b48705ea964cdfc29c050f2412295eba58077" +checksum = "1130d80c7374efad55a117d715a3af9368f0fa7a2c54573afc15a188cd984837" dependencies = [ "mutate_once", ] [[package]] name = "kurbo" -version = "0.9.5" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd85a5776cd9500c2e2059c8c76c3b01528566b7fcbaf8098b55a33fc298849b" +checksum = "89234b2cc610a7dd927ebde6b41dd1a5d4214cffaef4cf1fb2195d592f92518f" dependencies = [ "arrayvec", + "smallvec", ] [[package]] @@ -1522,7 +1517,7 @@ name = "mark" version = "0.0.0" source = "git+https://github.com/Garmelon/mark.git#2345d80d803e0e9590681a49743491c477d28126" dependencies = [ - "image 0.25.5", + "image", "palette", "rand 0.8.5", ] @@ -1618,6 +1613,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "multi-stash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" + [[package]] name = "mutate_once" version = "0.1.1" @@ -1822,7 +1823,7 @@ version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" dependencies = [ - "siphasher 1.0.1", + "siphasher", ] [[package]] @@ -1845,11 +1846,11 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pixglyph" -version = "0.3.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e0f8ad4c197db38125b880c3c44544788665c7d5f4c42f5a35da44bca1a712" +checksum = "d15afa937836bf3d876f5a04ce28810c06045857bf46c3d0d31073b8aada5494" dependencies = [ - "ttf-parser 0.20.0", + "ttf-parser 0.24.1", ] [[package]] @@ -1864,7 +1865,7 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016" dependencies = [ - "base64 0.22.1", + "base64", "indexmap", "quick-xml 0.32.0", "serde", @@ -1975,16 +1976,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" -[[package]] -name = "quick-xml" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33" -dependencies = [ - "memchr", - "serde", -] - [[package]] name = "quick-xml" version = "0.32.0" @@ -1994,6 +1985,16 @@ dependencies = [ "memchr", ] +[[package]] +name = "quick-xml" +version = "0.36.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7649a7b4df05aed9ea7ec6f628c67c9953a43869b8bc50929569b2999d443fe" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "quote" version = "1.0.38" @@ -2190,19 +2191,19 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "resvg" -version = "0.38.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c34501046959e06470ba62a2dc7f31c15f94ac250d842a45f9e012f4ee40c1e" +checksum = "c7314563c59c7ce31c18e23ad3dd092c37b928a0fa4e1c0a1a6504351ab411d1" dependencies = [ - "gif 0.12.0", - "jpeg-decoder", + "gif", + "image-webp 0.1.3", "log", "pico-args", - "png", "rgb", "svgtypes", "tiny-skia", "usvg", + "zune-jpeg", ] [[package]] @@ -2214,12 +2215,6 @@ dependencies = [ "bytemuck", ] -[[package]] -name = "roxmltree" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f" - [[package]] name = "roxmltree" version = "0.20.0" @@ -2260,6 +2255,16 @@ dependencies = [ "walkdir", ] +[[package]] +name = "rust_decimal" +version = "1.36.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" +dependencies = [ + "arrayvec", + "num-traits", +] + [[package]] name = "rustc-demangle" version = "0.1.24" @@ -2278,22 +2283,6 @@ version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7c45b9784283f1b2e7fb61b42047c2fd678ef0960d4f6f1eba131594cc369d4" -[[package]] -name = "rustybuzz" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0ae5692c5beaad6a9e22830deeed7874eae8a4e3ba4076fb48e12c56856222c" -dependencies = [ - "bitflags 2.8.0", - "bytemuck", - "smallvec", - "ttf-parser 0.20.0", - "unicode-bidi-mirroring 0.1.0", - "unicode-ccc 0.1.2", - "unicode-properties", - "unicode-script", -] - [[package]] name = "rustybuzz" version = "0.14.1" @@ -2311,6 +2300,24 @@ dependencies = [ "unicode-script", ] +[[package]] +name = "rustybuzz" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85d1ccd519e61834798eb52c4e886e8c2d7d698dd3d6ce0b1b47eb8557f1181" +dependencies = [ + "bitflags 2.8.0", + "bytemuck", + "core_maths", + "log", + "smallvec", + "ttf-parser 0.24.1", + "unicode-bidi-mirroring 0.3.0", + "unicode-ccc 0.3.0", + "unicode-properties", + "unicode-script", +] + [[package]] name = "ryu" version = "1.0.19" @@ -2440,9 +2447,8 @@ name = "showbits-common" version = "0.0.0" dependencies = [ "anyhow", - "comemo", "cosmic-text", - "image 0.25.5", + "image", "mark", "palette", "paste", @@ -2461,7 +2467,7 @@ dependencies = [ "axum", "clap", "escpos", - "image 0.25.5", + "image", "mime_guess", "palette", "rand 0.9.0", @@ -2507,12 +2513,6 @@ dependencies = [ "log", ] -[[package]] -name = "siphasher" -version = "0.3.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" - [[package]] name = "siphasher" version = "1.0.1" @@ -2588,6 +2588,16 @@ dependencies = [ "float-cmp", ] +[[package]] +name = "string-interner" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a3275464d7a9f2d4cac57c89c2ef96a8524dba2864c8d6f82e3980baf136f9b" +dependencies = [ + "hashbrown", + "serde", +] + [[package]] name = "strsim" version = "0.11.1" @@ -2609,7 +2619,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be" dependencies = [ - "heck 0.5.0", + "heck", "proc-macro2", "quote", "rustversion", @@ -2618,12 +2628,12 @@ dependencies = [ [[package]] name = "svgtypes" -version = "0.13.0" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e44e288cd960318917cbd540340968b90becc8bc81f171345d706e7a89d9d70" +checksum = "68c7541fff44b35860c1a7a47a7cadf3e4a304c457b58f9870d9706ece028afc" dependencies = [ "kurbo", - "siphasher 0.3.11", + "siphasher", ] [[package]] @@ -2703,7 +2713,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" dependencies = [ "cfg-expr", - "heck 0.5.0", + "heck", "pkg-config", "toml", "version-compare", @@ -2728,6 +2738,12 @@ version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" +[[package]] +name = "thin-vec" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a38c90d48152c236a3ab59271da4f4ae63d678c5d7ad6b7714d7cb9760be5e4b" + [[package]] name = "thiserror" version = "1.0.69" @@ -2966,10 +2982,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8" [[package]] -name = "two-face" -version = "0.3.0" +name = "ttf-parser" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37bed2135b2459c7eefba72c906d374697eb15949c205f2f124e3636a46b5eeb" +checksum = "5be21190ff5d38e8b4a2d3b6a3ae57f612cc39c96e83cedeaf7abc338a8bac4a" +dependencies = [ + "core_maths", +] + +[[package]] +name = "two-face" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384eda438ddf62e2c6f39a174452d952d9d9df5a8ad5ade22198609f8dcaf852" dependencies = [ "once_cell", "serde", @@ -2990,115 +3015,237 @@ checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "typst" -version = "0.11.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12492297d20937494f0143ae50ef339e5fd3d927b4096af1c52fe73fb9c5fa9a" +checksum = "1f7791c2c9984cb363bdc68009d4f8114bc2a7111a8214f96e26f75df9778063" +dependencies = [ + "comemo", + "ecow", + "typst-eval", + "typst-html", + "typst-layout", + "typst-library", + "typst-macros", + "typst-realize", + "typst-syntax", + "typst-timing", + "typst-utils", +] + +[[package]] +name = "typst-assets" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1051c56bbbf74d31ea6c6b1661e62fa0ebb8104403ee53f6dcd321600426e0b6" + +[[package]] +name = "typst-eval" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7790ff20466fc803ea636f78868e00325aeb6ee426e6078f609c401b7ec96b" +dependencies = [ + "comemo", + "ecow", + "if_chain", + "indexmap", + "stacker", + "toml", + "typst-library", + "typst-macros", + "typst-syntax", + "typst-timing", + "typst-utils", + "unicode-segmentation", +] + +[[package]] +name = "typst-html" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0fdf956ae7105baae607edcbef9e339017c9939478104863a1bd6c39a9f499" +dependencies = [ + "comemo", + "ecow", + "typst-library", + "typst-macros", + "typst-svg", + "typst-syntax", + "typst-timing", + "typst-utils", +] + +[[package]] +name = "typst-layout" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd5df06b1452461c0905444c15608b30374a07dfcb64163f07f9047101e777fc" dependencies = [ "az", - "bitflags 2.8.0", - "chinese-number", - "ciborium", + "bumpalo", "comemo", - "csv", "ecow", - "fontdb", - "hayagriva", "hypher", "icu_properties", "icu_provider", "icu_provider_adapters", "icu_provider_blob", "icu_segmenter", - "if_chain", - "image 0.24.9", + "kurbo", + "rustybuzz 0.18.0", + "smallvec", + "ttf-parser 0.24.1", + "typst-assets", + "typst-library", + "typst-macros", + "typst-syntax", + "typst-timing", + "typst-utils", + "unicode-bidi", + "unicode-math-class", + "unicode-script", + "unicode-segmentation", +] + +[[package]] +name = "typst-library" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "166ce1da78382fe0cba6535da219e157ec6c446903d9a044ccd364a46189f0b8" +dependencies = [ + "az", + "bitflags 2.8.0", + "bumpalo", + "chinese-number", + "ciborium", + "codex", + "comemo", + "csv", + "ecow", + "flate2", + "fontdb 0.21.0", + "hayagriva", + "icu_properties", + "icu_provider", + "icu_provider_blob", + "image", "indexmap", "kamadak-exif", "kurbo", "lipsum", - "log", - "once_cell", + "memchr", "palette", "phf", "png", - "portable-atomic", "qcms", "rayon", "regex", - "roxmltree 0.19.0", - "rustybuzz 0.12.1", + "regex-syntax", + "roxmltree", + "rust_decimal", + "rustybuzz 0.18.0", "serde", "serde_json", "serde_yaml", - "siphasher 1.0.1", + "siphasher", "smallvec", - "stacker", "syntect", "time", "toml", - "ttf-parser 0.20.0", + "ttf-parser 0.24.1", "two-face", "typed-arena", "typst-assets", "typst-macros", "typst-syntax", "typst-timing", - "unicode-bidi", + "typst-utils", "unicode-math-class", - "unicode-script", "unicode-segmentation", + "unscanny", "usvg", "wasmi", + "xmlwriter", ] -[[package]] -name = "typst-assets" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b3061f8d268e8eec7481c9ab24540455cb4912983c49aae38fa6e8bf8ef4d9c" - [[package]] name = "typst-macros" -version = "0.11.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a0fdfd46b4920b0f8e4215e5b8438c737e8bc3498a681ea59b0130228363fc" +checksum = "c748b2655e1cc5e68701b8b5e899b76aa8c046cb5f516ffcc0af3e2a25ed8d65" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", "syn", ] [[package]] -name = "typst-render" -version = "0.11.1" +name = "typst-realize" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f122fa9fde65683fde5ac444ecfbdc1a5ad4822dbaa537fe278345bb6b6ad7e" +checksum = "1488fb1780212ef38bfa813945f356e5788485bbb5e25cd75b093e886d4b31af" +dependencies = [ + "arrayvec", + "bumpalo", + "comemo", + "ecow", + "regex", + "typst-library", + "typst-macros", + "typst-syntax", + "typst-timing", + "typst-utils", +] + +[[package]] +name = "typst-render" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4946ab44f614b16ce63f1238c45c03a5c755b44dc5280950d7415c5ff3a249fd" dependencies = [ "bytemuck", "comemo", - "flate2", - "image 0.24.9", + "image", "pixglyph", "resvg", - "roxmltree 0.19.0", "tiny-skia", - "ttf-parser 0.20.0", - "typst", + "ttf-parser 0.24.1", + "typst-library", "typst-macros", "typst-timing", - "usvg", +] + +[[package]] +name = "typst-svg" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b805876107eec612b6f45c78097c137d428064f8c11714beb6ab373f907b99d6" +dependencies = [ + "base64", + "comemo", + "ecow", + "flate2", + "image", + "ttf-parser 0.24.1", + "typst-library", + "typst-macros", + "typst-timing", + "typst-utils", + "xmlparser", + "xmlwriter", ] [[package]] name = "typst-syntax" -version = "0.11.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3db69f2f41613b1ff6edbec44fd7dc524137f099ee36c46f560cedeaadb40c4" +checksum = "abe870e191c392cad35acff28095e99896033e3f2ddcd36b01bebc485e192711" dependencies = [ - "comemo", "ecow", - "once_cell", "serde", + "toml", + "typst-timing", + "typst-utils", "unicode-ident", "unicode-math-class", "unicode-script", @@ -3108,14 +3255,27 @@ dependencies = [ [[package]] name = "typst-timing" -version = "0.11.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b58e17192bcacb2a39aace6d3eece70f008b2949ce384ac501a58357fafee67" +checksum = "153d288af73d7d5f476a906a1984680b0f2c6020f15cd900243a5a8223cae4f2" dependencies = [ "parking_lot", "serde", "serde_json", - "typst-syntax", +] + +[[package]] +name = "typst-utils" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be823333fb1860b9f725f9e2bc848f2b85e4ef62fe94a793cd9500ad9ef554a9" +dependencies = [ + "once_cell", + "portable-atomic", + "rayon", + "siphasher", + "thin-vec", + "unicode-math-class", ] [[package]] @@ -3149,12 +3309,6 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" -[[package]] -name = "unicode-bidi-mirroring" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56d12260fb92d52f9008be7e4bca09f584780eb2266dc8fecc6a192bec561694" - [[package]] name = "unicode-bidi-mirroring" version = "0.2.0" @@ -3162,10 +3316,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86" [[package]] -name = "unicode-ccc" -version = "0.1.2" +name = "unicode-bidi-mirroring" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" +checksum = "64af057ad7466495ca113126be61838d8af947f41d93a949980b2389a118082f" [[package]] name = "unicode-ccc" @@ -3173,6 +3327,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656" +[[package]] +name = "unicode-ccc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "260bc6647b3893a9a90668360803a15f96b85a5257b1c3a0c3daf6ae2496de42" + [[package]] name = "unicode-ident" version = "1.0.17" @@ -3250,62 +3410,29 @@ dependencies = [ [[package]] name = "usvg" -version = "0.38.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "377f62b4a3c173de8654c1aa80ab1dac1154e6f13a779a9943e53780120d1625" -dependencies = [ - "base64 0.21.7", - "log", - "pico-args", - "usvg-parser", - "usvg-text-layout", - "usvg-tree", - "xmlwriter", -] - -[[package]] -name = "usvg-parser" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351a05e6f2023d6b4e946f734240a3927aefdcf930d7d42587a2c8a8869814b0" +checksum = "6803057b5cbb426e9fb8ce2216f3a9b4ca1dd2c705ba3cbebc13006e437735fd" dependencies = [ + "base64", "data-url", "flate2", + "fontdb 0.21.0", "imagesize", "kurbo", "log", - "roxmltree 0.19.0", + "pico-args", + "roxmltree", + "rustybuzz 0.18.0", "simplecss", - "siphasher 0.3.11", - "svgtypes", - "usvg-tree", -] - -[[package]] -name = "usvg-text-layout" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c41888b9d5cf431fe852eaf9d047bbde83251b98f1749c2f08b1071e6db46e2" -dependencies = [ - "fontdb", - "kurbo", - "log", - "rustybuzz 0.12.1", - "unicode-bidi", - "unicode-script", - "unicode-vo", - "usvg-tree", -] - -[[package]] -name = "usvg-tree" -version = "0.38.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18863e0404ed153d6e56362c5b1146db9f4f262a3244e3cf2dbe7d8a85909f05" -dependencies = [ + "siphasher", "strict-num", "svgtypes", "tiny-skia-path", + "unicode-bidi", + "unicode-script", + "unicode-vo", + "xmlwriter", ] [[package]] @@ -3434,42 +3561,56 @@ dependencies = [ [[package]] name = "wasmi" -version = "0.31.2" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8281d1d660cdf54c76a3efa9ddd0c270cada1383a995db3ccb43d166456c7" +checksum = "a19af97fcb96045dd1d6b4d23e2b4abdbbe81723dbc5c9f016eb52145b320063" dependencies = [ + "arrayvec", + "multi-stash", "smallvec", "spin", - "wasmi_arena", + "wasmi_collections", "wasmi_core", - "wasmparser-nostd", + "wasmi_ir", + "wasmparser", ] [[package]] -name = "wasmi_arena" -version = "0.4.1" +name = "wasmi_collections" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +checksum = "e80d6b275b1c922021939d561574bf376613493ae2b61c6963b15db0e8813562" +dependencies = [ + "string-interner", +] [[package]] name = "wasmi_core" -version = "0.13.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +checksum = "3a8c51482cc32d31c2c7ff211cd2bedd73c5bd057ba16a2ed0110e7a96097c33" dependencies = [ "downcast-rs", "libm", - "num-traits", - "paste", ] [[package]] -name = "wasmparser-nostd" -version = "0.100.2" +name = "wasmi_ir" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +checksum = "6e431a14c186db59212a88516788bd68ed51f87aa1e08d1df742522867b5289a" dependencies = [ - "indexmap-nostd", + "wasmi_core", +] + +[[package]] +name = "wasmparser" +version = "0.221.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d06bfa36ab3ac2be0dee563380147a5b81ba10dd8885d7fbbc9eb574be67d185" +dependencies = [ + "bitflags 2.8.0", + "indexmap", ] [[package]] @@ -3599,6 +3740,12 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" +[[package]] +name = "xmlparser" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66fee0b777b0f5ac1c69bb06d361268faafa61cd4682ae064a171c16c433e9e4" + [[package]] name = "xmlwriter" version = "0.1.0" diff --git a/Cargo.toml b/Cargo.toml index 7546438..d1621a1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,6 @@ edition = "2024" anyhow = "1.0.96" axum = "0.8.1" clap = { version = "4.5.30", features = ["derive", "deprecated"] } -comemo = "0.4.0" cosmic-text = "0.12.1" escpos = "0.15.0" image = "0.25.5" @@ -25,9 +24,9 @@ showbits-assets.path = "./showbits-assets" showbits-common.path = "./showbits-common" time = "0.3.37" tokio = "1.43.0" -typst = "0.11.0" -typst-assets = { version = "0.11.0", features = ["fonts"] } -typst-render = "0.11.0" +typst = "0.13.0" +typst-assets = { version = "0.13.0", features = ["fonts"] } +typst-render = "0.13.0" [workspace.dependencies.taffy] version = "0.4.3" diff --git a/showbits-common/Cargo.toml b/showbits-common/Cargo.toml index 19256d1..59865ff 100644 --- a/showbits-common/Cargo.toml +++ b/showbits-common/Cargo.toml @@ -5,7 +5,6 @@ edition = { workspace = true } [dependencies] anyhow = { workspace = true } -comemo = { workspace = true } cosmic-text = { workspace = true } image = { workspace = true } mark = { workspace = true } diff --git a/showbits-common/src/widgets/typst.rs b/showbits-common/src/widgets/typst.rs index d49df92..ad88d37 100644 --- a/showbits-common/src/widgets/typst.rs +++ b/showbits-common/src/widgets/typst.rs @@ -1,7 +1,6 @@ use std::{fs, path::PathBuf, sync::OnceLock}; use anyhow::anyhow; -use comemo::Prehashed; use image::RgbaImage; use taffy::{ Layout, @@ -10,11 +9,11 @@ use taffy::{ use typst::{ Library, World, diag::{FileError, FileResult}, - eval::Tracer, foundations::{Bytes, Datetime}, layout::Abs, syntax::{FileId, Source}, text::{Font, FontBook}, + utils::LazyHash, visualize::Color, }; @@ -34,8 +33,8 @@ impl FontSlot { pub fn get(&self) -> Option { self.font .get_or_init(|| { - let data = fs::read(&self.path).ok()?.into(); - Font::new(data, self.index) + let data = fs::read(&self.path).ok()?; + Font::new(Bytes::new(data), self.index) }) .clone() } @@ -57,7 +56,7 @@ impl FontLoader { fn load_embedded_fonts(&mut self) { // https://github.com/typst/typst/blob/be12762d942e978ddf2e0ac5c34125264ab483b7/crates/typst-cli/src/fonts.rs#L107-L121 for font_file in typst_assets::fonts() { - let font_data = Bytes::from_static(font_file); + let font_data = Bytes::new(font_file); for (i, font) in Font::iter(font_data).enumerate() { self.book.push(font.info().clone()); self.fonts.push(FontSlot { @@ -71,8 +70,8 @@ impl FontLoader { } struct DummyWorld { - library: Prehashed, - book: Prehashed, + library: LazyHash, + book: LazyHash, main: Source, fonts: Vec, } @@ -83,8 +82,8 @@ impl DummyWorld { loader.load_embedded_fonts(); Self { - library: Prehashed::new(Library::builder().build()), - book: Prehashed::new(loader.book), + library: LazyHash::new(Library::builder().build()), + book: LazyHash::new(loader.book), main: Source::detached(main), fonts: loader.fonts, } @@ -92,19 +91,22 @@ impl DummyWorld { } impl World for DummyWorld { - fn library(&self) -> &Prehashed { + fn library(&self) -> &LazyHash { &self.library } - fn book(&self) -> &Prehashed { + fn book(&self) -> &LazyHash { &self.book } - fn main(&self) -> Source { - self.main.clone() + fn main(&self) -> FileId { + self.main.id() } - fn source(&self, _id: FileId) -> FileResult { + fn source(&self, id: FileId) -> FileResult { + if id == self.main.id() { + return Ok(self.main.clone()); + } Err(FileError::AccessDenied) } @@ -149,19 +151,15 @@ impl Typst { source.push_str(&self.code); let world = DummyWorld::new(source); - let mut tracer = Tracer::new(); - let document = typst::compile(&world, &mut tracer).map_err(|errs| { + let document = typst::compile(&world).output.map_err(|errs| { errs.into_iter() .map(|sd| sd.message.to_string()) .collect::>() })?; - let pixmap = - typst_render::render_merged(&document, SCALE, Color::WHITE, Abs::zero(), Color::WHITE); - + let pixmap = typst_render::render_merged(&document, SCALE, Abs::zero(), Some(Color::WHITE)); let buffer = RgbaImage::from_raw(pixmap.width(), pixmap.height(), pixmap.take()).unwrap(); - Ok(buffer) } }