ladybird/LibGUI/GFontDatabase.h
Andreas Kling c02c9880b6 AK: Add Eternal<T> and use it in various places.
This is useful for static locals that never need to be destroyed:

Thing& Thing::the()
{
    static Eternal<Thing> the;
    return the;
}

The object will be allocated in data segment memory and will never have
its destructor invoked.
2019-04-03 16:52:25 +02:00

29 lines
549 B
C++

#pragma once
#include <AK/AKString.h>
#include <AK/HashMap.h>
#include <AK/Function.h>
class Font;
class GFontDatabase {
public:
static GFontDatabase& the();
GFontDatabase();
RetainPtr<Font> get_by_name(const String&);
void for_each_font(Function<void(const String&)>);
void for_each_fixed_width_font(Function<void(const String&)>);
private:
~GFontDatabase();
struct Metadata {
String path;
bool is_fixed_width;
int glyph_height;
};
HashMap<String, Metadata> m_name_to_metadata;
};