render playlist
[uwplayer.git] / application / nfont.h
diff --git a/application/nfont.h b/application/nfont.h
new file mode 100644 (file)
index 0000000..179d289
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2022 Olaf Wintermann
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a 
+ * copy of this software and associated documentation files (the "Software"), 
+ * to deal in the Software without restriction, including without limitation 
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
+ * and/or sell copies of the Software, and to permit persons to whom the 
+ * Software is furnished to do so, subject to the following conditions:
+ * 
+ * The above copyright notice and this permission notice shall be included in 
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef NFONT_H
+#define NFONT_H
+
+#include <X11/Xlib.h>
+#include <X11/Xft/Xft.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+    
+typedef struct NFont NFont;
+typedef struct NFontList NFontList;
+typedef struct NCharSetList NCharSetList;
+struct NFontList {
+    XftFont *font;
+    NFontList *next;
+};
+
+struct NCharSetList {
+    FcCharSet *charset;
+    NCharSetList *next;
+};
+
+struct NFont {
+    NFontList *fonts;
+    NCharSetList *fail;
+    Display *display;
+    FcPattern *pattern;
+    double size;
+    unsigned int ref;
+};
+
+NFont *FontCreate(Display *dp, FcPattern *pattern);
+NFont *FontFromName(Display *dp, const char *name);
+XftFont *FontListAddFontForChar(NFont *f, FcChar32 c);
+XftFont *FontDefault(NFont *f);
+void FontAddFail(NFont *f, FcCharSet *c);
+XftFont *FindFont(NFont *f, FcChar32 c);
+void FontDestroy(NFont *f);
+NFont *FontRef(NFont *font);
+void FontUnref(NFont *font);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* NFONT_H */
+