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