From 4ad6b4fc6478ef8727b69ea1692e2df238ab67b5 Mon Sep 17 00:00:00 2001 From: mkorje Date: Tue, 10 Jun 2025 20:49:02 +1000 Subject: [PATCH] Memoize try_new --- crates/typst-layout/src/math/fragment.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/typst-layout/src/math/fragment.rs b/crates/typst-layout/src/math/fragment.rs index c22af4def..2ff6893dd 100644 --- a/crates/typst-layout/src/math/fragment.rs +++ b/crates/typst-layout/src/math/fragment.rs @@ -266,12 +266,13 @@ impl GlyphFragment { /// Try to create a new glyph out of the given string. Will return None if /// the result from shaping the string is not a single glyph or is a tofu. + #[comemo::memoize] pub fn try_new( font: &Font, styles: StyleChain, str: &str, span: Span, - ) -> Option { + ) -> Option { let mut buffer = UnicodeBuffer::new(); buffer.push_str(str); buffer.set_language(language(styles));