Move glyph reset to stretch function

This commit is contained in:
mkorje 2025-06-01 16:18:54 +10:00
parent 9b1be3bd82
commit 3b2bb9bbcc
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -437,6 +437,8 @@ impl GlyphFragment {
/// ///
/// The resulting frame may not have the exact desired width or height. /// The resulting frame may not have the exact desired width or height.
pub fn stretch(&mut self, ctx: &mut MathContext, target: Abs, axis: Axis) { pub fn stretch(&mut self, ctx: &mut MathContext, target: Abs, axis: Axis) {
self.reset_glyph();
// If the base glyph is good enough, use it. // If the base glyph is good enough, use it.
let mut advance = self.size.get(axis); let mut advance = self.size.get(axis);
if axis == Axis::X && !self.extended_shape { if axis == Axis::X && !self.extended_shape {

View File

@ -60,8 +60,6 @@ pub fn stretch_fragment(
} }
}; };
glyph.reset_glyph();
let relative_to_size = relative_to.unwrap_or_else(|| size.get(stretch_axis)); let relative_to_size = relative_to.unwrap_or_else(|| size.get(stretch_axis));
glyph.stretch(ctx, stretch.relative_to(relative_to_size) - short_fall, stretch_axis); glyph.stretch(ctx, stretch.relative_to(relative_to_size) - short_fall, stretch_axis);