]> icculus.org git repositories - dana/openbox.git/blob - glft/render.c
most of the glft is contained herein. but buggy :)
[dana/openbox.git] / glft / render.c
1 #include "render.h"
2 #include "font.h"
3 #include "debug.h"
4 #include <glib.h>
5 #include <GL/glx.h>
6
7 void GlftRenderGlyph(FT_Face face, unsigned int dlist)
8 {
9     FT_GlyphSlot slot = face->glyph;
10 }
11
12 void GlftRenderString(struct GlftFont *font, const char *str, int bytes,
13                       int x, int y)
14 {
15     const char *c;
16     struct GlftGlyph *g;
17
18     if (!g_utf8_validate(str, bytes, NULL)) {
19         GlftDebug("Invalid UTF-8 in string\n");
20         return;
21     }
22
23     glPushMatrix();
24
25     c = str;
26     while (c) {
27         g = GlftFontGlyph(font, c);
28         if (g) {
29             glCallList(g->dlist);
30             glTranslatef(g->width, 0.0, 0.0);
31         } else
32             glTranslatef(font->max_advance_width, 0.0, 0.0);
33         c = g_utf8_next_char(c);
34         if (c - str >= bytes) break;
35     }
36
37     glPopMatrix();
38 }