2019-02-12 13:35:33 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/AKString.h>
|
|
|
|
#include <AK/Function.h>
|
2019-05-28 09:53:16 +00:00
|
|
|
#include <AK/HashMap.h>
|
2019-02-12 13:35:33 +00:00
|
|
|
|
|
|
|
class Font;
|
|
|
|
|
2019-05-25 23:43:15 +00:00
|
|
|
struct Metadata {
|
|
|
|
String path;
|
|
|
|
bool is_fixed_width;
|
|
|
|
int glyph_height;
|
|
|
|
};
|
|
|
|
|
2019-02-12 13:35:33 +00:00
|
|
|
class GFontDatabase {
|
|
|
|
public:
|
|
|
|
static GFontDatabase& the();
|
|
|
|
|
2019-06-21 16:37:47 +00:00
|
|
|
RefPtr<Font> get_by_name(const StringView&);
|
2019-06-02 12:58:02 +00:00
|
|
|
void for_each_font(Function<void(const StringView&)>);
|
|
|
|
void for_each_fixed_width_font(Function<void(const StringView&)>);
|
2019-02-12 13:35:33 +00:00
|
|
|
|
2019-06-02 12:58:02 +00:00
|
|
|
Metadata get_metadata_by_name(const StringView& name) const
|
2019-05-28 09:53:16 +00:00
|
|
|
{
|
2019-05-25 23:43:15 +00:00
|
|
|
return m_name_to_metadata.get(name);
|
|
|
|
};
|
|
|
|
|
2019-02-12 13:35:33 +00:00
|
|
|
private:
|
2019-04-05 03:10:18 +00:00
|
|
|
GFontDatabase();
|
2019-02-12 13:35:33 +00:00
|
|
|
~GFontDatabase();
|
|
|
|
|
2019-03-06 13:06:40 +00:00
|
|
|
HashMap<String, Metadata> m_name_to_metadata;
|
2019-02-12 13:35:33 +00:00
|
|
|
};
|