initial check-in
[mesa.git] / src / glut / beos / glut_swidth.cpp
1
2 /* Copyright (c) Mark J. Kilgard, 1995. */
3
4 /* This program is freely distributable without licensing fees
5 and is provided without guarantee or warrantee expressed or
6 implied. This program is -not- in the public domain. */
7
8 #include <GL/glut.h>
9 #include "glutint.h"
10 #include "glutstroke.h"
11
12 /* CENTRY */
13 int APIENTRY
14 glutStrokeWidth(GLUTstrokeFont font, int c)
15 {
16 StrokeFontPtr fontinfo;
17 const StrokeCharRec *ch;
18
19 #if defined(WIN32)
20 fontinfo = (StrokeFontPtr) __glutFont(font);
21 #else
22 fontinfo = (StrokeFontPtr) font;
23 #endif
24
25 if (c < 0 || c >= fontinfo->num_chars)
26 return 0;
27 ch = &(fontinfo->ch[c]);
28 if (ch)
29 return (int)ch->right;
30 else
31 return 0;
32 }
33
34 int APIENTRY
35 glutStrokeLength(GLUTstrokeFont font, const char *string)
36 {
37 int c, length;
38 StrokeFontPtr fontinfo;
39 const StrokeCharRec *ch;
40
41 #if defined(WIN32)
42 fontinfo = (StrokeFontPtr) __glutFont(font);
43 #else
44 fontinfo = (StrokeFontPtr) font;
45 #endif
46
47 length = 0;
48 for (; *string != '\0'; string++) {
49 c = *string;
50 if (c >= 0 && c < fontinfo->num_chars) {
51 ch = &(fontinfo->ch[c]);
52 if (ch)
53 length += (int)ch->right;
54 }
55 }
56 return length;
57 }
58
59 /* ENDCENTRY */