Update glyph_brush and glow_glyph

This commit is contained in:
Héctor Ramón Jiménez 2020-05-27 23:09:27 +02:00
parent 22ced3485e
commit 823ea15732
7 changed files with 41 additions and 86 deletions

View file

@ -37,16 +37,9 @@ where
fn measure_value(&self, value: &str, size: u16, font: Font) -> f32 {
let backend = self.backend();
let (mut width, _) =
let (width, _) =
backend.measure(value, f32::from(size), font, Size::INFINITY);
let spaces_around = value.len() - value.trim().len();
if spaces_around > 0 {
let space_width = backend.space_width(size as f32);
width += spaces_around as f32 * space_width;
}
width
}