add font functions
authorDana Jansens <danakj@orodu.net>
Mon, 26 May 2003 14:28:10 +0000 (14:28 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 26 May 2003 14:28:10 +0000 (14:28 +0000)
render2/.cvsignore
render2/Makefile.am
render2/font.c [new file with mode: 0644]
render2/font.h
render2/render.h

index bf0c6c54f41037d697142da6c0d3f24c7d918fa4..ba11ed4675aa285d98a5aac8228894d28eb0a7de 100644 (file)
@@ -9,3 +9,4 @@ instance.lo
 init.lo
 debug.lo
 color.lo
+font.lo
index bf38aa8dbc82f7d0abd18d92c42e4c79181c52d1..8e3e5fd88e896fe7b15338e1111cd96fc3d71297 100644 (file)
@@ -15,7 +15,7 @@ rendertest_LDFLAGS=-lobrender2 -L.
 rendertest_SOURCES=test.c
 
 lib_LTLIBRARIES=libobrender2.la
-libobrender2_la_SOURCES=init.c instance.c color.c debug.c
+libobrender2_la_SOURCES=init.c instance.c color.c debug.c font.c
 
 
 noinst_HEADERS=render.h instance.h debug.h
diff --git a/render2/font.c b/render2/font.c
new file mode 100644 (file)
index 0000000..f7cddcc
--- /dev/null
@@ -0,0 +1,36 @@
+#include "render.h"
+#include "font.h"
+#include <stdlib.h>
+
+struct RrFont *RrFontOpen(struct RrInstance *inst, const char *fontstring)
+{
+    struct RrFont *font;
+
+    font = malloc(sizeof(struct RrFont));
+    font->inst = inst;
+/*XXX    font->font = GlftFontOpen(fontstring);*/
+    return font;
+}
+
+void RrFontClose(struct RrFont *font)
+{
+    if (font) {
+/*XXX        GlftFontClose(font->font);*/
+        free(font);
+    }
+}
+
+int RrFontMeasureString(struct RrFont *font, const char *string)
+{
+    return 20;
+}
+
+int RrFontHeight(struct RrFont *font)
+{
+    return 8;
+}
+
+int RrFontMaxCharWidth(struct RrFont *font)
+{
+    return 5;
+}
index 87e9f1ff1acba602dce8583bce0af2b0647574a3..f73e4790adb88c17b2c9e717f368827a26c3fdfb 100644 (file)
@@ -3,7 +3,10 @@
 
 #include "glft/glft.h"
 
+struct RrInstance;
+
 struct RrFont {
+    struct RrInstance *inst;
     struct GlftFont *font;
 };
 
index 5a955d4c1c036d5b3e7fb7329bacaa1bd387bf66..947a014b76821e31f3feccd094b2e0c3e83c7e1a 100644 (file)
@@ -66,4 +66,11 @@ int RrColorParse(struct RrInstance *inst, const char *colorname,
 
 struct RrFont;
 
+struct RrFont *RrFontOpen(struct RrInstance *inst, const char *fontstring);
+void RrFontClose(struct RrFont *font);
+
+int RrFontMeasureString(struct RrFont *font, const char *string);
+int RrFontHeight(struct RrFont *font);
+int RrFontMaxCharWidth(struct RrFont *font);
+
 #endif