2 * Mesa 3-D graphics library
4 * Copyright (C) 1995-2006 Brian Paul
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free
18 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 * Library for glut using mesa fbdev driver
24 * Written by Sean D'Epagnier (c) 2006
26 * To improve on this library, maybe support subwindows or overlays,
27 * I (sean at depagnier dot com) will do my best to help.
31 #include "glutstroke.h"
33 void glutStrokeCharacter(GLUTstrokeFont font
, int c
)
35 const StrokeCharRec
*ch
;
36 const StrokeRec
*stroke
;
37 const CoordRec
*coord
;
38 StrokeFontPtr fontinfo
= (StrokeFontPtr
) font
;
41 if (c
< 0 || c
>= fontinfo
->num_chars
)
43 ch
= &(fontinfo
->ch
[c
]);
45 for (i
= ch
->num_strokes
, stroke
= ch
->stroke
;
46 i
> 0; i
--, stroke
++) {
47 glBegin(GL_LINE_STRIP
);
48 for (j
= stroke
->num_coords
, coord
= stroke
->coord
;
49 j
> 0; j
--, coord
++) {
50 glVertex2f(coord
->x
, coord
->y
);
54 glTranslatef(ch
->right
, 0.0, 0.0);
58 int glutStrokeWidth(GLUTstrokeFont font
, int c
)
60 StrokeFontPtr fontinfo
;
61 const StrokeCharRec
*ch
;
63 fontinfo
= (StrokeFontPtr
) font
;
65 if (c
< 0 || c
>= fontinfo
->num_chars
)
67 ch
= &(fontinfo
->ch
[c
]);
74 int glutStrokeLength(GLUTstrokeFont font
, const unsigned char *string
)
78 for (; *string
; string
++)
79 length
+= glutStrokeWidth(font
, *string
);