mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:37:43 +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:
parent
363c78e5d2
commit
500067d3a6
1 changed files with 2 additions and 2 deletions
|
@ -76,7 +76,7 @@ Font& FontDatabase::default_fixed_width_font()
|
||||||
}
|
}
|
||||||
|
|
||||||
struct FontDatabase::Private {
|
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;
|
Vector<RefPtr<Typeface>> typefaces;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ FontDatabase::FontDatabase()
|
||||||
|
|
||||||
if (path.ends_with(".font"sv)) {
|
if (path.ends_with(".font"sv)) {
|
||||||
if (auto font = Gfx::BitmapFont::load_from_file(path)) {
|
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());
|
auto typeface = get_or_create_typeface(font->family(), font->variant());
|
||||||
typeface->add_bitmap_font(font);
|
typeface->add_bitmap_font(font);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue