From 2aa07e0e65c37249679db30954da0d8b7f8abb4a Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Mon, 9 Sep 2024 22:23:18 +0200 Subject: [PATCH] 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 a9d5a99568b41c83d724a9d8f81c1fdfe10a830e --- Userland/Libraries/LibWeb/CSS/StyleComputer.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index 6072a570b97..bfc71f75fea 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -190,9 +190,6 @@ ErrorOr> 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"); }