summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst/src/math/stretch.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/typst/src/math/stretch.rs b/crates/typst/src/math/stretch.rs
index cc71ced6..749773e3 100644
--- a/crates/typst/src/math/stretch.rs
+++ b/crates/typst/src/math/stretch.rs
@@ -39,7 +39,13 @@ fn stretch_glyph(
short_fall: Abs,
horizontal: bool,
) -> VariantFragment {
+ // If the base glyph is good enough, use it.
+ let advance = if horizontal { base.width } else { base.height() };
let short_target = target - short_fall;
+ if short_target <= advance {
+ return base.into_variant();
+ }
+
let mut min_overlap = Abs::zero();
let construction = ctx
.table
@@ -55,12 +61,6 @@ fn stretch_glyph(
})
.unwrap_or(GlyphConstruction { assembly: None, variants: LazyArray16::new(&[]) });
- // If the base glyph is good enough, use it.
- let advance = if horizontal { base.width } else { base.height() };
- if short_target <= advance {
- return base.into_variant();
- }
-
// Search for a pre-made variant with a good advance.
let mut best_id = base.id;
let mut best_advance = base.width;