aboutsummaryrefslogtreecommitdiff
path: root/host/matelight/font.h
diff options
context:
space:
mode:
authorjaseg <jaseg@jaseg.net>2014-01-02 02:41:50 +0100
committerjaseg <jaseg@jaseg.net>2014-01-02 02:41:50 +0100
commit6d84637d7e34dbbda8a4192b17a274810a55adc3 (patch)
tree74e464bb410411858c1bd2ef8e79f38102060e9b /host/matelight/font.h
parent21b9596a98fbe051b1b194bdd4c99293233b7922 (diff)
downloadmatelight-6d84637d7e34dbbda8a4192b17a274810a55adc3.tar.gz
matelight-6d84637d7e34dbbda8a4192b17a274810a55adc3.tar.bz2
matelight-6d84637d7e34dbbda8a4192b17a274810a55adc3.zip
Consider it a memorial.
Diffstat (limited to 'host/matelight/font.h')
-rw-r--r--host/matelight/font.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/host/matelight/font.h b/host/matelight/font.h
new file mode 100644
index 0000000..6213eb4
--- /dev/null
+++ b/host/matelight/font.h
@@ -0,0 +1,21 @@
+
+#include <stdint.h>
+#include <stdio.h>
+
+// CAUTION: A glyph struct is always followed by the glyph's bitmap.
+typedef struct {
+ uint8_t width;
+ uint8_t height;
+ int8_t x;
+ int8_t y;
+} glyph_t;
+
+// Size of Unicode's basic multilingual plane
+#define BLP_SIZE 65536
+
+// We could also use some fancy hashtable here, but unifont includes about 57k glyphs so we would hardly save any memory.
+int read_bdf(FILE *f, glyph_t **glyph_table, unsigned int glyph_table_size);
+
+// Requires buf to point to a buffer at least of size glyph->width*glyph->height.
+void render_glyph(glyph_t *glyph, char *buf, unsigned int bufwidth, unsigned int offx, unsigned int offy);
+