|
@@ -1775,9 +1775,7 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
|
|
auto* parent_element = element_to_inherit_style_from(element, pseudo_element);
|
|
|
|
|
|
auto width = font_stretch.to_font_width();
|
|
|
-
|
|
|
auto weight = font_weight.to_font_weight();
|
|
|
- bool bold = weight > Gfx::FontWeight::Regular;
|
|
|
|
|
|
// FIXME: Should be based on "user's default font size"
|
|
|
CSSPixels font_size_in_px = 16;
|
|
@@ -1915,9 +1913,6 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
|
|
|
|
|
// FIXME: Implement the full font-matching algorithm: https://www.w3.org/TR/css-fonts-4/#font-matching-algorithm
|
|
|
|
|
|
- // Note: This is modified by the find_font() lambda
|
|
|
- bool monospace = false;
|
|
|
-
|
|
|
float const font_size_in_pt = font_size_in_px * 0.75f;
|
|
|
|
|
|
auto find_font = [&](FlyString const& family) -> RefPtr<Gfx::FontCascadeList const> {
|
|
@@ -1954,7 +1949,6 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
|
|
case Keyword::Monospace:
|
|
|
case Keyword::UiMonospace:
|
|
|
generic_font = Platform::GenericFont::Monospace;
|
|
|
- monospace = true;
|
|
|
break;
|
|
|
case Keyword::Serif:
|
|
|
generic_font = Platform::GenericFont::Serif;
|
|
@@ -2009,12 +2003,20 @@ RefPtr<Gfx::FontCascadeList const> StyleComputer::compute_font_for_style_values(
|
|
|
font_list->extend(*other_font_list);
|
|
|
}
|
|
|
|
|
|
+ auto default_font = Platform::FontPlugin::the().default_font(font_size_in_pt);
|
|
|
+ if (font_list->is_empty()) {
|
|
|
+ // This is needed to make sure we check default font before reaching to emojis.
|
|
|
+ font_list->add(*default_font);
|
|
|
+ }
|
|
|
+
|
|
|
if (auto emoji_font = Platform::FontPlugin::the().default_emoji_font(font_size_in_pt); emoji_font) {
|
|
|
font_list->add(*emoji_font);
|
|
|
}
|
|
|
|
|
|
- auto found_font = ComputedProperties::font_fallback(monospace, bold, font_size_in_pt);
|
|
|
- font_list->set_last_resort_font(found_font->with_size(font_size_in_pt));
|
|
|
+ // The default font is already included in the font list, but we explicitly set it
|
|
|
+ // as the last-resort font. This ensures that if none of the specified fonts contain
|
|
|
+ // the requested code point, there is still a font available to provide a fallback glyph.
|
|
|
+ font_list->set_last_resort_font(*default_font);
|
|
|
|
|
|
return font_list;
|
|
|
}
|