summaryrefslogtreecommitdiff
path: root/LibGUI/GFontDatabase.h
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-12 14:35:33 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-12 14:36:19 +0100
commitd6326d6c2ec6a2849f3f0ad0e16c1df3ac0fc326 (patch)
treebc13a0242cf30be41188e2f1df18fefe26e4cb1c /LibGUI/GFontDatabase.h
parent7df7e5e2a62225f8dfb58426828c7d75431b33e4 (diff)
downloadserenity-d6326d6c2ec6a2849f3f0ad0e16c1df3ac0fc326.zip
LibGUI: Add a GFontDatabase class that lets you enumerate fonts and more.
"More" in this case being also giving you the ability to load a font by name. Use this as backend for Terminal's font menu. :^)
Diffstat (limited to 'LibGUI/GFontDatabase.h')
-rw-r--r--LibGUI/GFontDatabase.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/LibGUI/GFontDatabase.h b/LibGUI/GFontDatabase.h
new file mode 100644
index 0000000000..7ed0c4f7e1
--- /dev/null
+++ b/LibGUI/GFontDatabase.h
@@ -0,0 +1,21 @@
+#pragma once
+
+#include <AK/AKString.h>
+#include <AK/HashMap.h>
+#include <AK/Function.h>
+
+class Font;
+
+class GFontDatabase {
+public:
+ static GFontDatabase& the();
+
+ RetainPtr<Font> get_by_name(const String&);
+ void for_each_font(Function<void(const String&)>);
+
+private:
+ GFontDatabase();
+ ~GFontDatabase();
+
+ HashMap<String, String> m_name_to_path;
+};