mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Move the early exit inside stretch_glyph()
upward (#4570)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
This commit is contained in:
parent
09e0464e87
commit
993e7a45a9
@ -39,7 +39,13 @@ fn stretch_glyph(
|
|||||||
short_fall: Abs,
|
short_fall: Abs,
|
||||||
horizontal: bool,
|
horizontal: bool,
|
||||||
) -> VariantFragment {
|
) -> 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;
|
let short_target = target - short_fall;
|
||||||
|
if short_target <= advance {
|
||||||
|
return base.into_variant();
|
||||||
|
}
|
||||||
|
|
||||||
let mut min_overlap = Abs::zero();
|
let mut min_overlap = Abs::zero();
|
||||||
let construction = ctx
|
let construction = ctx
|
||||||
.table
|
.table
|
||||||
@ -55,12 +61,6 @@ fn stretch_glyph(
|
|||||||
})
|
})
|
||||||
.unwrap_or(GlyphConstruction { assembly: None, variants: LazyArray16::new(&[]) });
|
.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.
|
// Search for a pre-made variant with a good advance.
|
||||||
let mut best_id = base.id;
|
let mut best_id = base.id;
|
||||||
let mut best_advance = base.width;
|
let mut best_advance = base.width;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user