LibWeb: Honor the font-size even if the font-family is not found
This commit is contained in:
parent
81b6723b29
commit
10ceacf5fb
Notes:
sideshowbarker
2024-07-17 04:10:16 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/10ceacf5fb
1 changed files with 6 additions and 1 deletions
|
@ -1304,8 +1304,9 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
|
|||
FontSelector font_selector;
|
||||
bool monospace = false;
|
||||
|
||||
float const font_size_in_pt = font_size_in_px * 0.75f;
|
||||
|
||||
auto find_font = [&](String const& family) -> RefPtr<Gfx::Font const> {
|
||||
float font_size_in_pt = font_size_in_px * 0.75f;
|
||||
font_selector = { family, font_size_in_pt, weight, width, slope };
|
||||
|
||||
if (auto it = m_loaded_fonts.find(family); it != m_loaded_fonts.end()) {
|
||||
|
@ -1380,6 +1381,10 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
|
|||
|
||||
if (!found_font) {
|
||||
found_font = StyleProperties::font_fallback(monospace, bold);
|
||||
if (found_font) {
|
||||
if (auto scaled_fallback_font = found_font->with_size(font_size_in_pt))
|
||||
found_font = scaled_fallback_font;
|
||||
}
|
||||
}
|
||||
|
||||
FontCache::the().set(font_selector, *found_font);
|
||||
|
|
Loading…
Add table
Reference in a new issue