LibGfx+LibWeb: Replace remaining OpenType implementation with Skia

This change should move us forward toward emoji support, as we are no
longer limited by our own OpenType implementation, which was failing
to parse the TrueType Collection format used to store emoji fonts
(at least on macOS).
This commit is contained in:
Aliaksandr Kalenik 2024-09-04 17:29:01 +02:00 committed by Alexander Kalenik
commit a9d5a99568
Notes: github-actions[bot] 2024-09-05 17:22:50 +00:00
40 changed files with 309 additions and 3201 deletions

View file

@ -19,7 +19,6 @@
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/FontDatabase.h>
#include <LibGfx/Font/FontStyleMapping.h>
#include <LibGfx/Font/OpenType/Typeface.h>
#include <LibGfx/Font/ScaledFont.h>
#include <LibGfx/Font/Typeface.h>
#include <LibGfx/Font/WOFF/Loader.h>
@ -172,7 +171,7 @@ ErrorOr<NonnullRefPtr<Gfx::Typeface>> FontLoader::try_load_font()
}
if (mime_type.has_value()) {
if (mime_type->essence() == "font/ttf"sv || mime_type->essence() == "application/x-font-ttf"sv) {
if (auto result = OpenType::Typeface::try_load_from_externally_owned_memory(resource()->encoded_data()); !result.is_error()) {
if (auto result = Gfx::Typeface::try_load_from_externally_owned_memory(resource()->encoded_data()); !result.is_error()) {
return result;
}
}
@ -188,7 +187,7 @@ ErrorOr<NonnullRefPtr<Gfx::Typeface>> FontLoader::try_load_font()
}
}
auto ttf = OpenType::Typeface::try_load_from_externally_owned_memory(resource()->encoded_data());
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");