mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:57:35 +00:00
LibGfx+Utilities: Add helpers to load vector fonts from Core::Resources
This commit is contained in:
parent
286dc6df7f
commit
86ce502ae2
8 changed files with 19 additions and 21 deletions
|
@ -9,7 +9,7 @@
|
|||
#include <AK/BitStream.h>
|
||||
#include <AK/MemoryStream.h>
|
||||
#include <LibCompress/Brotli.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/Resource.h>
|
||||
#include <LibGfx/Font/Font.h>
|
||||
#include <LibGfx/Font/OpenType/Font.h>
|
||||
#include <LibGfx/Font/WOFF2/Font.h>
|
||||
|
@ -831,10 +831,9 @@ static ErrorOr<GlyfAndLocaTableBuffers> create_glyf_and_loca_tables_from_transfo
|
|||
return GlyfAndLocaTableBuffers { .glyf_table = move(reconstructed_glyf_table), .loca_table = move(loca_table_buffer) };
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_file(StringView path)
|
||||
ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_resource(Core::Resource const& resource)
|
||||
{
|
||||
auto woff2_file_stream = TRY(Core::File::open(path, Core::File::OpenMode::Read));
|
||||
return try_load_from_externally_owned_memory(*woff2_file_stream);
|
||||
return try_load_from_externally_owned_memory(resource.data());
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Font>> Font::try_load_from_externally_owned_memory(ReadonlyBytes bytes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue