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

+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
# breaking, the same algorithms browsers use. Built with only our embedded
# 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 }
# Keep this exactly aligned with cosmic-text 0.12's raster backend. Cosmic
cosmic-text = { version = "=0.14.2", default-features = false, features = ["std", "swash"], optional = true }
# Keep this exactly aligned with cosmic-text 0.14's raster backend. Cosmic
# does not expose variation coordinates, so variable font instances are
# 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 }
ureq = { version = "2.9", default-features = false, features = ["tls"], 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
// small fraction of a page's CSS-cascade-dominated render time.
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 {
Some(taffy::AlignItems::CENTER) => Some(Align::Center),