mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibGfx: Use the woff2 library to decode WOFF2 font files
This saves us the trouble of maintaining our own implementation, and instantly brings us to full WOFF2 feature parity with others. Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
This commit is contained in:
parent
9be5867eb2
commit
28d4e326f8
Notes:
sideshowbarker
2024-07-17 01:12:07 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/28d4e326f8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/78
6 changed files with 63 additions and 1018 deletions
11
Meta/CMake/woff2.cmake
Normal file
11
Meta/CMake/woff2.cmake
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
find_package(PkgConfig)
|
||||||
|
pkg_check_modules(WOFF2 REQUIRED IMPORTED_TARGET libwoff2dec)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(
|
||||||
|
WOFF2
|
||||||
|
REQUIRED_VARS
|
||||||
|
WOFF2_INCLUDE_DIRS
|
||||||
|
WOFF2_LIBRARY_DIRS
|
||||||
|
WOFF2_LIBRARIES
|
||||||
|
)
|
|
@ -1,3 +1,5 @@
|
||||||
|
include(woff2)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
AffineTransform.cpp
|
AffineTransform.cpp
|
||||||
AntiAliasingPainter.cpp
|
AntiAliasingPainter.cpp
|
||||||
|
@ -89,6 +91,11 @@ set(SOURCES
|
||||||
serenity_lib(LibGfx gfx)
|
serenity_lib(LibGfx gfx)
|
||||||
target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibFileSystem LibRIFF LibTextCodec LibIPC LibUnicode LibURL)
|
target_link_libraries(LibGfx PRIVATE LibCompress LibCore LibCrypto LibFileSystem LibRIFF LibTextCodec LibIPC LibUnicode LibURL)
|
||||||
|
|
||||||
|
# Third-party
|
||||||
|
target_include_directories(LibGfx PRIVATE ${WOFF2_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(LibGfx PRIVATE ${WOFF2_LIBRARIES})
|
||||||
|
target_link_directories(LibGfx PRIVATE ${WOFF2_LIBRARY_DIRS})
|
||||||
|
|
||||||
set(generated_sources TIFFMetadata.h TIFFTagHandler.cpp)
|
set(generated_sources TIFFMetadata.h TIFFTagHandler.cpp)
|
||||||
list(TRANSFORM generated_sources PREPEND "ImageFormats/")
|
list(TRANSFORM generated_sources PREPEND "ImageFormats/")
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -21,8 +21,6 @@ class Font : public Gfx::VectorFont {
|
||||||
AK_MAKE_NONCOPYABLE(Font);
|
AK_MAKE_NONCOPYABLE(Font);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_resource(Core::Resource const&);
|
|
||||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_externally_owned_memory(SeekableStream&);
|
|
||||||
static ErrorOr<NonnullRefPtr<Font>> try_load_from_externally_owned_memory(ReadonlyBytes);
|
static ErrorOr<NonnullRefPtr<Font>> try_load_from_externally_owned_memory(ReadonlyBytes);
|
||||||
|
|
||||||
virtual Gfx::ScaledFontMetrics metrics(float x_scale, float y_scale) const override { return m_input_font->metrics(x_scale, y_scale); }
|
virtual Gfx::ScaledFontMetrics metrics(float x_scale, float y_scale) const override { return m_input_font->metrics(x_scale, y_scale); }
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
{
|
{
|
||||||
"default-registry": {
|
|
||||||
"kind": "git",
|
|
||||||
"baseline": "01f602195983451bc83e72f4214af2cbc495aa94",
|
|
||||||
"repository": "https://github.com/microsoft/vcpkg"
|
|
||||||
},
|
|
||||||
"registries": [
|
"registries": [
|
||||||
{
|
{
|
||||||
"kind": "artifact",
|
"kind": "artifact",
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
{
|
{
|
||||||
|
"builtin-baseline": "01f602195983451bc83e72f4214af2cbc495aa94",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
"sqlite3"
|
"sqlite3",
|
||||||
|
"woff2"
|
||||||
],
|
],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"name": "sqlite3",
|
"name": "sqlite3",
|
||||||
"version": "3.45.3"
|
"version": "3.45.3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "woff2",
|
||||||
|
"version": "1.0.2#4"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue