1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:07:35 +00:00

LibGfx: Make FontDatabase cache store fonts in NonnullRefPtr

We don't cache failed font lookups, so there's no need for nullity here.
This commit is contained in:
Andreas Kling 2021-09-04 17:37:02 +02:00
parent 363c78e5d2
commit 500067d3a6

View file

@ -76,7 +76,7 @@ Font& FontDatabase::default_fixed_width_font()
}
struct FontDatabase::Private {
HashMap<String, RefPtr<Gfx::Font>> full_name_to_font_map;
HashMap<String, NonnullRefPtr<Gfx::Font>> full_name_to_font_map;
Vector<RefPtr<Typeface>> typefaces;
};
@ -93,7 +93,7 @@ FontDatabase::FontDatabase()
if (path.ends_with(".font"sv)) {
if (auto font = Gfx::BitmapFont::load_from_file(path)) {
m_private->full_name_to_font_map.set(font->qualified_name(), font);
m_private->full_name_to_font_map.set(font->qualified_name(), *font);
auto typeface = get_or_create_typeface(font->family(), font->variant());
typeface->add_bitmap_font(font);
}