xref: /haiku/src/libs/glut/glut_stroke.c (revision 002f37b0cca92e4cf72857c72ac95db5a8b09615)
1 /*
2  * Copyright 1994-1997 Mark Kilgard, All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *      Mark Kilgard
7  */
8 
9 
10 #include "glutint.h"
11 #include "glutstroke.h"
12 
13 
14 void APIENTRY
15 glutStrokeCharacter(GLUTstrokeFont font, int c)
16 {
17   const StrokeCharRec *ch;
18   const StrokeRec *stroke;
19   const CoordRec *coord;
20   StrokeFontPtr fontinfo;
21   int i, j;
22 
23 
24 #if defined(_WIN32)
25   fontinfo = (StrokeFontPtr) __glutFont(font);
26 #else
27   fontinfo = (StrokeFontPtr) font;
28 #endif
29 
30   if (c < 0 || c >= fontinfo->num_chars)
31     return;
32   ch = &(fontinfo->ch[c]);
33   if (ch) {
34     for (i = ch->num_strokes, stroke = ch->stroke;
35       i > 0; i--, stroke++) {
36       glBegin(GL_LINE_STRIP);
37       for (j = stroke->num_coords, coord = stroke->coord;
38         j > 0; j--, coord++) {
39         glVertex2f(coord->x, coord->y);
40       }
41       glEnd();
42     }
43     glTranslatef(ch->right, 0.0, 0.0);
44   }
45 }
46