Compute ascent and descent only once in shape_skip

This commit is contained in:
Héctor Ramón Jiménez 2023-06-16 02:39:54 +02:00
parent ffa08d2da1
commit 2fbd65a64f
No known key found for this signature in database
GPG key ID: 140CC052C94F138E

View file

@ -279,6 +279,9 @@ fn shape_skip(
let metrics = font.metrics(&[]); let metrics = font.metrics(&[]);
let glyph_metrics = font.glyph_metrics(&[]).scale(1.0); let glyph_metrics = font.glyph_metrics(&[]).scale(1.0);
let ascent = metrics.ascent / f32::from(metrics.units_per_em);
let descent = metrics.descent / f32::from(metrics.units_per_em);
line[start_run..end_run] line[start_run..end_run]
.chars() .chars()
.enumerate() .enumerate()
@ -293,8 +296,8 @@ fn shape_skip(
y_advance: 0.0, y_advance: 0.0,
x_offset: 0.0, x_offset: 0.0,
y_offset: 0.0, y_offset: 0.0,
ascent: metrics.ascent / f32::from(metrics.units_per_em), ascent,
descent: metrics.descent / f32::from(metrics.units_per_em), descent,
font_id, font_id,
glyph_id, glyph_id,
color_opt: attrs.color_opt, color_opt: attrs.color_opt,