LibWeb: Do not try to load a font if format detection has failed

Skia is more permissive when it comes to font loading, compared to our
own OpenType implementation, which it has superseded, parsing an invalid
TTF does not result in an error but rather produces a font that is
incorrectly displayed. This change updates the FontLoader to address
this behavior and to stop attempting to parse a font as a last resort
when format detection has failed.

Fixes regression on x.com when text is not displayed introduced in
a9d5a99568
This commit is contained in:
Aliaksandr Kalenik 2024-09-09 22:23:18 +02:00 committed by Andreas Kling
commit 2aa07e0e65
Notes: github-actions[bot] 2024-09-10 05:41:14 +00:00

View file

@ -190,9 +190,6 @@ ErrorOr<NonnullRefPtr<Gfx::Typeface>> FontLoader::try_load_font()
}
}
auto ttf = Gfx::Typeface::try_load_from_externally_owned_memory(resource()->encoded_data());
if (!ttf.is_error())
return ttf.release_value();
return Error::from_string_literal("Automatic format detection failed");
}