mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +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:
committed by
Alexander Kalenik
parent
8f784243a1
commit
464d7d5858
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user