14 static struct GlftWalkState state;
16 int GlftMoveToFunc(FT_Vector *to, void *user)
18 state.x = (to->x >> 6) + (to->x & 63)/64;
19 state.y = (to->y >> 6) + (to->y & 63)/64;
20 printf("move to %f:%f\n", state.x, state.y);
28 int GlftLineToFunc(FT_Vector *to, void *user)
32 glVertex2f(state.x, state.y);
35 glVertex2f(state.x, state.y);
36 state.x = (to->x >> 6) + (to->x & 63)/64;
37 state.y = (to->y >> 6) + (to->y & 63)/64;
38 printf("line to %f:%f\n", state.x, state.y);
39 glVertex2f(state.x, state.y);
43 int GlftConicToFunc(FT_Vector *c, FT_Vector *to, void *user)
45 GlftLineToFunc(to, user);
46 printf("conic the hedgehog!\n");
50 int GlftCubicToFunc(FT_Vector *c1, FT_Vector *c2, FT_Vector *to, void
53 GlftLineToFunc(to, user);
58 FT_Outline_Funcs GlftFuncs = {
67 void GlftRenderGlyph(FT_Face face, unsigned int dlist)
70 FT_GlyphSlot slot = face->glyph;
76 glNewList(dlist, GL_COMPILE);
77 err = FT_Outline_Decompose(&slot->outline, &GlftFuncs, NULL);
84 void GlftRenderString(struct GlftFont *font, const char *str, int bytes,
90 if (!g_utf8_validate(str, bytes, NULL)) {
91 GlftDebug("Invalid UTF-8 in string\n");
98 while (c - str < bytes) {
99 g = GlftFontGlyph(font, c);
101 glCallList(g->dlist);
102 glTranslatef(g->width, 0.0, 0.0);
104 glTranslatef(font->max_advance_width, 0.0, 0.0);
105 c = g_utf8_next_char(c);
111 void GlftMeasureString(struct GlftFont *font,
120 if (!g_utf8_validate(str, bytes, NULL)) {
121 GlftDebug("Invalid UTF-8 in string\n");
129 while (c - str < bytes) {
130 g = GlftFontGlyph(font, c);
133 *h = MAX(g->height, *h);
135 *w += font->max_advance_width;
137 c = g_utf8_next_char(c);