+typedef struct UIFont UIFont;
typedef struct UIWin UIWin;
UIWin* WindowCreate(char* title);
void WindowDelete(UIWin* win);
void WindowShow(UIWin* win);
void WindowHide(UIWin* win);
+
+UIFont FontLoad(char* patt);
+void FontClose(UIFont font);
\ No newline at end of file
--- /dev/null
+#include <stdc.h>
+#include <liba.h>
+#include <libui.h>
+#include "libui_impl.h"
+
+UIFont FontLoad(char* patt)
+{
+ static bool inited = false;
+ if (!inited && !FcInit())
+ {
+ fatal("failed to initialize fontconfig");
+ }
+ inited = true;
+
+ XftFont* font = NULL;
+ FcPattern* pattern = FcNameParse((FcChar8 *)patt);
+ if (pattern)
+ {
+// /* load the base font */
+// FcResult result;
+// FcPattern* match = XftFontMatch(X.display, X.screen_num, pattern, &result);
+// if (match)
+// {
+// font = XftFontOpenPattern(X.display, match);
+// }
+// FcPatternDestroy(pattern);
+// FcPatternDestroy(match);
+ }
+
+ if (!font)
+ {
+ fatal("failed to load font");
+ }
+
+ return (UIFont){ .font = font };
+}