diff --git a/Cargo.lock b/Cargo.lock index 6b35e38..9bc305f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -546,21 +546,21 @@ dependencies = [ [[package]] name = "cosmic-text" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c578f2b9abb4d5f3fbb12aba4008084d435dc6a8425c195cfe0b3594bfea0c25" +checksum = "59fd57d82eb4bfe7ffa9b1cec0c05e2fd378155b47f255a67983cb4afe0e80c2" dependencies = [ "bitflags 2.8.0", "fontdb", - "libm", "log", "rangemap", + "rayon", "rustc-hash", - "rustybuzz", + "rustybuzz 0.14.1", "self_cell", "swash", "sys-locale", - "ttf-parser", + "ttf-parser 0.21.1", "unicode-bidi", "unicode-linebreak", "unicode-script", @@ -853,7 +853,7 @@ dependencies = [ "memmap2", "slotmap", "tinyvec", - "ttf-parser", + "ttf-parser 0.20.0", ] [[package]] @@ -1844,7 +1844,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e0f8ad4c197db38125b880c3c44544788665c7d5f4c42f5a35da44bca1a712" dependencies = [ - "ttf-parser", + "ttf-parser 0.20.0", ] [[package]] @@ -2247,14 +2247,30 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfb9cf8877777222e4a3bc7eb247e398b56baba500c38c1c46842431adc8b55c" dependencies = [ "bitflags 2.8.0", "bytemuck", "libm", "smallvec", - "ttf-parser", - "unicode-bidi-mirroring", - "unicode-ccc", + "ttf-parser 0.21.1", + "unicode-bidi-mirroring 0.2.0", + "unicode-ccc 0.2.0", "unicode-properties", "unicode-script", ] @@ -2907,6 +2923,12 @@ version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" +[[package]] +name = "ttf-parser" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c591d83f69777866b9126b24c6dd9a18351f177e49d625920d19f989fd31cf8" + [[package]] name = "two-face" version = "0.3.0" @@ -2967,7 +2989,7 @@ dependencies = [ "rayon", "regex", "roxmltree 0.19.0", - "rustybuzz", + "rustybuzz 0.12.1", "serde", "serde_json", "serde_yaml", @@ -2977,7 +2999,7 @@ dependencies = [ "syntect", "time", "toml", - "ttf-parser", + "ttf-parser 0.20.0", "two-face", "typed-arena", "typst-assets", @@ -3024,7 +3046,7 @@ dependencies = [ "resvg", "roxmltree 0.19.0", "tiny-skia", - "ttf-parser", + "ttf-parser 0.20.0", "typst", "typst-macros", "typst-timing", @@ -3097,12 +3119,24 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23cb788ffebc92c5948d0e997106233eeb1d8b9512f93f41651f52b6c5f5af86" + [[package]] name = "unicode-ccc" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cc2520efa644f8268dce4dcd3050eaa7fc044fca03961e9998ac7e2e92b77cf1" +[[package]] +name = "unicode-ccc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df77b101bcc4ea3d78dafc5ad7e4f58ceffe0b2b16bf446aeb50b6cb4157656" + [[package]] name = "unicode-ident" version = "1.0.17" @@ -3220,7 +3254,7 @@ dependencies = [ "fontdb", "kurbo", "log", - "rustybuzz", + "rustybuzz 0.12.1", "unicode-bidi", "unicode-script", "unicode-vo", diff --git a/Cargo.toml b/Cargo.toml index 94eb500..e5cace6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ anyhow = "1.0.96" axum = "0.8.1" clap = { version = "4.5.30", features = ["derive", "deprecated"] } comemo = "0.4.0" -cosmic-text = "0.11.2" +cosmic-text = "0.12.1" escpos = "0.12.2" image = "0.25.1" mark.git = "https://github.com/Garmelon/mark.git" diff --git a/showbits-common/src/widgets/text.rs b/showbits-common/src/widgets/text.rs index 48e8ae1..76b7f5f 100644 --- a/showbits-common/src/widgets/text.rs +++ b/showbits-common/src/widgets/text.rs @@ -121,7 +121,7 @@ impl Text { pub fn widget(self, font_stuff: &mut FontStuff) -> impl Widget + use { let fs = &mut font_stuff.font_system; let mut buffer = Buffer::new_empty(self.metrics); - buffer.set_size(fs, f32::INFINITY, f32::INFINITY); + buffer.set_size(fs, None, None); let spans = self .chunks @@ -161,12 +161,13 @@ impl Widget for TextWidget { }); let fs = &mut ctx.font_stuff().font_system; - self.buffer.set_size(fs, width, f32::INFINITY); + self.buffer.set_size(fs, Some(width), None); self.buffer.shape_until_scroll(fs, false); - let runs = self.buffer.layout_runs(); + let runs = self.buffer.layout_runs().collect::>(); let height = runs.len() as f32 * self.buffer.metrics().line_height; let width = runs + .into_iter() .map(|run| run.line_w) .max_by(|a, b| a.partial_cmp(b).unwrap()) .unwrap_or(0.0); @@ -193,7 +194,8 @@ impl Widget for TextWidget { swash_cache: sc, } = ctx.font_stuff(); - self.buffer.set_size(fs, size.x as f32, size.y as f32); + self.buffer + .set_size(fs, Some(size.x as f32), Some(size.y as f32)); self.buffer.shape_until_scroll(fs, true); let color = color::to_text_color(self.color);