ladybird/Libraries/LibGUI/GFontDatabase.h
Andreas Kling 73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00

34 lines
668 B
C++

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