From 90efe2fa5d32ed2a1e8bdc622c396ca42d76dc70 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Mon, 26 May 2003 14:28:10 +0000 Subject: [PATCH] add font functions --- render2/.cvsignore | 1 + render2/Makefile.am | 2 +- render2/font.c | 36 ++++++++++++++++++++++++++++++++++++ render2/font.h | 3 +++ render2/render.h | 7 +++++++ 5 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 render2/font.c diff --git a/render2/.cvsignore b/render2/.cvsignore index bf0c6c54..ba11ed46 100644 --- a/render2/.cvsignore +++ b/render2/.cvsignore @@ -9,3 +9,4 @@ instance.lo init.lo debug.lo color.lo +font.lo diff --git a/render2/Makefile.am b/render2/Makefile.am index bf38aa8d..8e3e5fd8 100644 --- a/render2/Makefile.am +++ b/render2/Makefile.am @@ -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 index 00000000..f7cddcc2 --- /dev/null +++ b/render2/font.c @@ -0,0 +1,36 @@ +#include "render.h" +#include "font.h" +#include + +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; +} diff --git a/render2/font.h b/render2/font.h index 87e9f1ff..f73e4790 100644 --- a/render2/font.h +++ b/render2/font.h @@ -3,7 +3,10 @@ #include "glft/glft.h" +struct RrInstance; + struct RrFont { + struct RrInstance *inst; struct GlftFont *font; }; diff --git a/render2/render.h b/render2/render.h index 5a955d4c..947a014b 100644 --- a/render2/render.h +++ b/render2/render.h @@ -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 -- 2.34.1