Upgrade the text shaping backend

This commit is contained in:
SGavrl committed 2026-07-30 22:21:00 +00:00
1 parent 92b228059e
commit 0f06ace12b
3 files changed
+32 -64

No files matched your search

Generated
+21 -60
View File
@@ -583,18 +583,18 @@ dependencies = [
[[package]] [[package]]
name = "cosmic-text" name = "cosmic-text"
version = "0.12.1" version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59fd57d82eb4bfe7ffa9b1cec0c05e2fd378155b47f255a67983cb4afe0e80c2" checksum = "da46a9d5a8905cc538a4a5bceb6a4510de7a51049c5588c0114efce102bcbbe8"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"fontdb 0.16.2", "fontdb 0.16.2",
"log", "log",
"rangemap", "rangemap",
"rayon",
"rustc-hash 1.1.0", "rustc-hash 1.1.0",
"rustybuzz 0.14.1", "rustybuzz 0.14.1",
"self_cell", "self_cell",
"smol_str",
"swash", "swash",
"sys-locale", "sys-locale",
"ttf-parser 0.21.1", "ttf-parser 0.21.1",
@@ -622,31 +622,6 @@ dependencies = [
"cfg-if", "cfg-if",
] ]
[[package]]
name = "crossbeam-deque"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51"
dependencies = [
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e"
dependencies = [
"crossbeam-utils",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
[[package]] [[package]]
name = "crypto-common" name = "crypto-common"
version = "0.1.7" version = "0.1.7"
@@ -973,9 +948,9 @@ checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
[[package]] [[package]]
name = "font-types" name = "font-types"
version = "0.7.3" version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b3971f9a5ca983419cdc386941ba3b9e1feba01a0ab888adf78739feb2798492" checksum = "1fa6a5e5a77b5f3f7f9e32879f484aa5b3632ddfbe568a16266c904a6f32cdaf"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
] ]
@@ -2521,26 +2496,6 @@ version = "1.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68" checksum = "973443cf09a9c8656b574a866ab68dfa19f0867d0340648c7d2f6a71b8a8ea68"
[[package]]
name = "rayon"
version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
dependencies = [
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
dependencies = [
"crossbeam-deque",
"crossbeam-utils",
]
[[package]] [[package]]
name = "rcgen" name = "rcgen"
version = "0.13.2" version = "0.13.2"
@@ -2556,9 +2511,9 @@ dependencies = [
[[package]] [[package]]
name = "read-fonts" name = "read-fonts"
version = "0.22.7" version = "0.25.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69aacb76b5c29acfb7f90155d39759a29496aebb49395830e928a9703d2eec2f" checksum = "f6f9e8a4f503e5c8750e4cd3b32a4e090035c46374b305a15c70bad833dca05f"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"font-types", "font-types",
@@ -3002,9 +2957,9 @@ checksum = "8ee5873ec9cce0195efcb7a4e9507a04cd49aec9c83d0389df45b1ef7ba2e649"
[[package]] [[package]]
name = "skrifa" name = "skrifa"
version = "0.22.3" version = "0.26.6"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e1c44ad1f6c5bdd4eefed8326711b7dbda9ea45dfd36068c427d332aa382cbe" checksum = "8cc1aa86c26dbb1b63875a7180aa0819709b33348eb5b1491e4321fae388179d"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"read-fonts", "read-fonts",
@@ -3031,6 +2986,12 @@ version = "1.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90" checksum = "8ed6a63f02c8539c91a8685a86f4099661ba3da017932f6ebbea6de3f0fa7c90"
[[package]]
name = "smol_str"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd538fb6910ac1099850255cf94a94df6551fbdd602454387d0adb2d1ca6dead"
[[package]] [[package]]
name = "socket2" name = "socket2"
version = "0.6.4" version = "0.6.4"
@@ -3156,9 +3117,9 @@ dependencies = [
[[package]] [[package]]
name = "swash" name = "swash"
version = "0.1.19" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbd59f3f359ddd2c95af4758c18270eddd9c730dde98598023cdabff472c2ca2" checksum = "f0e25b48fd1c222c9fdb61148e2203b750f9840c07922fd61b87c6015560b8f6"
dependencies = [ dependencies = [
"skrifa", "skrifa",
"yazi", "yazi",
@@ -4472,9 +4433,9 @@ dependencies = [
[[package]] [[package]]
name = "yazi" name = "yazi"
version = "0.1.6" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c94451ac9513335b5e23d7a8a2b61a7102398b8cca5160829d313e84c9d98be1" checksum = "e01738255b5a16e78bbb83e7fbba0a1e7dd506905cfc53f4622d89015a03fbb5"
[[package]] [[package]]
name = "yoke" name = "yoke"
@@ -4501,9 +4462,9 @@ dependencies = [
[[package]] [[package]]
name = "zeno" name = "zeno"
version = "0.2.3" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd15f8e0dbb966fd9245e7498c7e9e5055d9e5c8b676b95bd67091cd11a1e697" checksum = "6df3dc4292935e51816d896edcd52aa30bc297907c26167fec31e2b0c6a32524"
[[package]] [[package]]
name = "zerocopy" name = "zerocopy"
+3 -3
View File
@@ -21,11 +21,11 @@ ab_glyph = { workspace = true, optional = true }
# Real inline text layout: HarfBuzz-class shaping (rustybuzz) + UAX#14 line # Real inline text layout: HarfBuzz-class shaping (rustybuzz) + UAX#14 line
# breaking, the same algorithms browsers use. Built with only our embedded # breaking, the same algorithms browsers use. Built with only our embedded
# fonts (no system-font scan) so layout stays deterministic across hosts. # fonts (no system-font scan) so layout stays deterministic across hosts.
cosmic-text = { version = "=0.12.1", default-features = false, features = ["std", "swash"], optional = true } cosmic-text = { version = "=0.14.2", default-features = false, features = ["std", "swash"], optional = true }
# Keep this exactly aligned with cosmic-text 0.12's raster backend. Cosmic # Keep this exactly aligned with cosmic-text 0.14's raster backend. Cosmic
# does not expose variation coordinates, so variable font instances are # does not expose variation coordinates, so variable font instances are
# rasterized through Swash directly while Cosmic remains the shaper. # rasterized through Swash directly while Cosmic remains the shaper.
swash = { version = "=0.1.19", optional = true } swash = { version = "=0.2.0", default-features = false, features = ["std", "scale", "render"], optional = true }
image = { version = "0.25", default-features = false, features = ["jpeg", "png", "webp"], optional = true } image = { version = "0.25", default-features = false, features = ["jpeg", "png", "webp"], optional = true }
ureq = { version = "2.9", default-features = false, features = ["tls"], optional = true } ureq = { version = "2.9", default-features = false, features = ["tls"], optional = true }
base64 = { workspace = true, optional = true } base64 = { workspace = true, optional = true }
+8 -1
View File
@@ -861,7 +861,14 @@ impl TextEngine {
// with links ends up coloring the wrong glyphs), and shaping is a // with links ends up coloring the wrong glyphs), and shaping is a
// small fraction of a page's CSS-cascade-dominated render time. // small fraction of a page's CSS-cascade-dominated render time.
let rich = spans.iter().map(|(t, a)| (t.as_str(), a.to_attrs())); let rich = spans.iter().map(|(t, a)| (t.as_str(), a.to_attrs()));
buffer.set_rich_text(&mut self.font_system, rich, Attrs::new().family(Family::Name(FAMILY)), Shaping::Advanced); let defaults = Attrs::new().family(Family::Name(FAMILY));
buffer.set_rich_text(
&mut self.font_system,
rich,
&defaults,
Shaping::Advanced,
None,
);
let align = match base.text_align { let align = match base.text_align {
Some(taffy::AlignItems::CENTER) => Some(Align::Center), Some(taffy::AlignItems::CENTER) => Some(Align::Center),