1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 22:30:03 -04:00

Fix glyph cache key

This commit is contained in:
valadaptive
2025-08-08 10:24:58 -04:00
parent 58cbca1016
commit 1ccd809b61

View File

@@ -81,7 +81,8 @@ pub struct FontImpl {
ab_glyph_font: ab_glyph::FontArc, ab_glyph_font: ab_glyph::FontArc,
tweak: FontTweak, tweak: FontTweak,
glyph_info_cache: ahash::HashMap<char, GlyphInfo>, glyph_info_cache: ahash::HashMap<char, GlyphInfo>,
glyph_alloc_cache: ahash::HashMap<(GlyphInfo, OrderedFloat<f32>), GlyphAllocation>, glyph_alloc_cache:
ahash::HashMap<(GlyphInfo, OrderedFloat<f32>, OrderedFloat<f32>), GlyphAllocation>,
} }
trait FontExt { trait FontExt {
@@ -264,7 +265,11 @@ impl FontImpl {
.ab_glyph_font .ab_glyph_font
.pt_scale_factor(font_size * self.tweak.scale * pixels_per_point) .pt_scale_factor(font_size * self.tweak.scale * pixels_per_point)
.round(); .round();
let entry = match self.glyph_alloc_cache.entry((glyph_info, scale.into())) { let entry = match self.glyph_alloc_cache.entry((
glyph_info,
font_size.into(),
pixels_per_point.into(),
)) {
std::collections::hash_map::Entry::Occupied(glyph_alloc) => { std::collections::hash_map::Entry::Occupied(glyph_alloc) => {
return *glyph_alloc.get(); return *glyph_alloc.get();
} }