summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/FontDatabase.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-07-04 19:06:39 +0200
committerAndreas Kling <kling@serenityos.org>2021-07-04 21:34:26 +0200
commit560109bd42006c15170521c69a0d50d141ef65ec (patch)
treeb6213bc040d8fd76f34b32bfb0504610200bc6f4 /Userland/Libraries/LibGfx/FontDatabase.cpp
parent9321d9d83d366ad4cf686c856063ff9ac97c18a4 (diff)
downloadserenity-560109bd42006c15170521c69a0d50d141ef65ec.zip
LibTTF: Make TTF::Font loading API return error strings
Diffstat (limited to 'Userland/Libraries/LibGfx/FontDatabase.cpp')
-rw-r--r--Userland/Libraries/LibGfx/FontDatabase.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Userland/Libraries/LibGfx/FontDatabase.cpp b/Userland/Libraries/LibGfx/FontDatabase.cpp
index 76d4517b80..85c8adf7e2 100644
--- a/Userland/Libraries/LibGfx/FontDatabase.cpp
+++ b/Userland/Libraries/LibGfx/FontDatabase.cpp
@@ -99,9 +99,10 @@ FontDatabase::FontDatabase()
}
} else if (path.ends_with(".ttf"sv)) {
// FIXME: What about .otf and .woff
- if (auto font = TTF::Font::load_from_file(path)) {
+ if (auto font_or_error = TTF::Font::try_load_from_file(path); !font_or_error.is_error()) {
+ auto font = font_or_error.release_value();
auto typeface = get_or_create_typeface(font->family(), font->variant());
- typeface->set_ttf_font(font);
+ typeface->set_ttf_font(move(font));
}
}
}