Skip to content

Commit

Permalink
LibWeb/CSS: Don't overwrite active font load when requesting a pt size
Browse files Browse the repository at this point in the history
start_loading_next_url() is a no-op if there's a pending resource load,
but not if that resource load has successfully loaded already. There is
a delay between the font resource loading, and it being processed into
a vector font. Calling font_with_point_size() in that gap would
previously erase the previously-loaded font, if the font had multiple
URLs to choose from.

This fixes the icon font on mods.factorio.com :^)

(cherry picked from commit 28388f1fd24c0019d2c4be7900584c6c536527ad)
  • Loading branch information
AtkinsSJ authored and nico committed Dec 21, 2024
1 parent 2fccdf6 commit fadd346
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Userland/Libraries/LibWeb/CSS/StyleComputer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ void FontLoader::resource_did_fail()
RefPtr<Gfx::Font> FontLoader::font_with_point_size(float point_size)
{
if (!m_vector_font) {
start_loading_next_url();
if (!resource())
start_loading_next_url();
return nullptr;
}
return m_vector_font->scaled_font(point_size);
Expand Down

0 comments on commit fadd346

Please sign in to comment.