mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
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:
parent
bd9c4a6de5
commit
a9ec0c30eb
Notes:
sideshowbarker
2024-07-17 20:43:45 +09:00
Author: https://github.com/tomuta Commit: https://github.com/SerenityOS/serenity/commit/a9ec0c30eba Pull-request: https://github.com/SerenityOS/serenity/pull/11959
1 changed files with 6 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue