Remove extra entries in texture atlas for monospace characters
This commit is contained in:
parent
c969b8d9eb
commit
a30eef11bc
1 changed files with 10 additions and 11 deletions
|
@ -74,23 +74,13 @@ impl FontImpl {
|
||||||
|
|
||||||
let scale_in_pixels = pixels_per_point * scale_in_points;
|
let scale_in_pixels = pixels_per_point * scale_in_points;
|
||||||
|
|
||||||
let font = Self {
|
Self {
|
||||||
rusttype_font,
|
rusttype_font,
|
||||||
scale_in_pixels,
|
scale_in_pixels,
|
||||||
pixels_per_point,
|
pixels_per_point,
|
||||||
glyph_info_cache: Default::default(),
|
glyph_info_cache: Default::default(),
|
||||||
atlas,
|
atlas,
|
||||||
};
|
|
||||||
|
|
||||||
// Preload the printable ASCII characters [32, 126] (which excludes control codes):
|
|
||||||
const FIRST_ASCII: usize = 32; // 32 == space
|
|
||||||
const LAST_ASCII: usize = 126;
|
|
||||||
for c in (FIRST_ASCII..=LAST_ASCII).map(|c| c as u8 as char) {
|
|
||||||
font.glyph_info(c);
|
|
||||||
}
|
}
|
||||||
font.glyph_info('°');
|
|
||||||
|
|
||||||
font
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `\n` will result in `None`
|
/// `\n` will result in `None`
|
||||||
|
@ -181,6 +171,15 @@ impl Font {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
slf.replacement_glyph = replacement_glyph;
|
slf.replacement_glyph = replacement_glyph;
|
||||||
|
|
||||||
|
// Preload the printable ASCII characters [32, 126] (which excludes control codes):
|
||||||
|
const FIRST_ASCII: usize = 32; // 32 == space
|
||||||
|
const LAST_ASCII: usize = 126;
|
||||||
|
for c in (FIRST_ASCII..=LAST_ASCII).map(|c| c as u8 as char) {
|
||||||
|
slf.glyph_info(c);
|
||||||
|
}
|
||||||
|
slf.glyph_info('°');
|
||||||
|
|
||||||
slf
|
slf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue