mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
LibGfx+LibWeb: Allow inexact size lookups when requesting scaled fonts
For bitmap fonts, we will often not have an exact match for requested sizes. Return the closest match instead of a nullptr. LibWeb is currently the only user of this API. If it needs to be configurable in the future to only allow exact matches, we can add a parameter or another method at that time.
This commit is contained in:
parent
8f784243a1
commit
464d7d5858
Notes:
sideshowbarker
2024-07-16 22:14:49 +09:00
Author: https://github.com/trflynn89
Commit: 464d7d5858
Pull-request: https://github.com/SerenityOS/serenity/pull/24243
Issue: https://github.com/SerenityOS/serenity/issues/24238
12 changed files with 17 additions and 18 deletions
|
@ -2089,11 +2089,7 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
|||
}
|
||||
|
||||
auto found_font = StyleProperties::font_fallback(monospace, bold);
|
||||
if (auto scaled_fallback_font = found_font->with_size(font_size_in_pt)) {
|
||||
font_list->add(*scaled_fallback_font);
|
||||
} else {
|
||||
font_list->add(*found_font);
|
||||
}
|
||||
font_list->add(found_font->with_size(font_size_in_pt));
|
||||
|
||||
return font_list;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue