From 286dc6df7f589dd6bfcecf1ab62c900db768e9ab Mon Sep 17 00:00:00 2001 From: Andrew Kaster Date: Tue, 17 Oct 2023 12:47:29 -0600 Subject: [PATCH] LibGfx: Remove ability to load fonts directly from a file path Users must now either pass a Core::Resource, a resource:// URI, or a Core::MappedFile --- Userland/Libraries/LibGfx/Font/BitmapFont.cpp | 11 ----------- Userland/Libraries/LibGfx/Font/BitmapFont.h | 2 -- 2 files changed, 13 deletions(-) diff --git a/Userland/Libraries/LibGfx/Font/BitmapFont.cpp b/Userland/Libraries/LibGfx/Font/BitmapFont.cpp index f3f5bd9fac4..db950b5271c 100644 --- a/Userland/Libraries/LibGfx/Font/BitmapFont.cpp +++ b/Userland/Libraries/LibGfx/Font/BitmapFont.cpp @@ -250,17 +250,6 @@ ErrorOr> BitmapFont::try_load_from_uri(StringView uri) return try_load_from_resource(TRY(Core::Resource::load_from_uri(uri))); } -RefPtr BitmapFont::load_from_file(DeprecatedString const& path) -{ - return MUST(try_load_from_file(move(path))); -} - -ErrorOr> BitmapFont::try_load_from_file(DeprecatedString const& path) -{ - auto mapped_file = TRY(Core::MappedFile::map(path)); - return try_load_from_mapped_file(move(mapped_file)); -} - ErrorOr BitmapFont::write_to_file(DeprecatedString const& path) { auto stream = TRY(Core::File::open(path, Core::File::OpenMode::Write)); diff --git a/Userland/Libraries/LibGfx/Font/BitmapFont.h b/Userland/Libraries/LibGfx/Font/BitmapFont.h index 333e60a37c5..60b6f794be3 100644 --- a/Userland/Libraries/LibGfx/Font/BitmapFont.h +++ b/Userland/Libraries/LibGfx/Font/BitmapFont.h @@ -31,10 +31,8 @@ public: ErrorOr> unmasked_character_set() const; static NonnullRefPtr load_from_uri(StringView); - static RefPtr load_from_file(DeprecatedString const& path); static ErrorOr> try_load_from_uri(StringView); static ErrorOr> try_load_from_resource(NonnullRefPtr); - static ErrorOr> try_load_from_file(DeprecatedString const& path); static ErrorOr> try_load_from_mapped_file(NonnullOwnPtr); static ErrorOr> try_load_from_stream(FixedMemoryStream&);