LibWeb/CSS: Don't overwrite active font load when requesting a pt size

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 :^)
This commit is contained in:
Sam Atkins 2024-12-20 14:54:08 +00:00 committed by Jelle Raaijmakers
parent b3edbd7bf2
commit 28388f1fd2
Notes: github-actions[bot] 2024-12-20 17:20:38 +00:00

View file

@ -228,7 +228,8 @@ void FontLoader::resource_did_load_or_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);