WindowServer: Pick font with glyphs for digits for ScreenNumberOverlay

We want to make sure we pick a font that has at least glyphs defined
for all the digits that we may need to display.
This commit is contained in:
Tom 2022-01-16 17:40:55 -07:00 committed by Andreas Kling
parent bd9c4a6de5
commit a9ec0c30eb
Notes: sideshowbarker 2024-07-17 20:43:45 +09:00

View file

@ -178,6 +178,12 @@ void ScreenNumberOverlay::pick_font()
// with default_font.name(). But the default font currently does not provide larger sizes
auto size = font.glyph_height();
if (size * 2 <= screen_number_content_rect_size.height() && size > best_font_size) {
for (unsigned ch = '0'; ch <= '9'; ch++) {
if (!font.contains_glyph(ch)) {
// Skip this font, it doesn't have glyphs for digits
return;
}
}
best_font_name = font.qualified_name();
best_font_size = size;
}