configure: allow C{,XX}FLAGS override
[mesa.git] / src / glut / beos / glut_bwidth.c
1
2 /* Copyright (c) Mark J. Kilgard, 1994. */
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 "glutint.h"
9 #include "glutbitmap.h"
10
11 /* CENTRY */
12 int APIENTRY
13 glutBitmapWidth(GLUTbitmapFont font, int c)
14 {
15 BitmapFontPtr fontinfo;
16 const BitmapCharRec *ch;
17
18 #ifdef _WIN32
19 fontinfo = (BitmapFontPtr) __glutFont(font);
20 #else
21 fontinfo = (BitmapFontPtr) font;
22 #endif
23
24 if (c < fontinfo->first || c >= fontinfo->first + fontinfo->num_chars)
25 return 0;
26 ch = fontinfo->ch[c - fontinfo->first];
27 if (ch)
28 return ch->advance;
29 else
30 return 0;
31 }
32
33 int APIENTRY
34 glutBitmapLength(GLUTbitmapFont font, const unsigned char *string)
35 {
36 int c, length;
37 BitmapFontPtr fontinfo;
38 const BitmapCharRec *ch;
39
40 #ifdef _WIN32
41 fontinfo = (BitmapFontPtr) __glutFont(font);
42 #else
43 fontinfo = (BitmapFontPtr) font;
44 #endif
45
46 length = 0;
47 for (; *string != '\0'; string++) {
48 c = *string;
49 if (c >= fontinfo->first && c < fontinfo->first + fontinfo->num_chars) {
50 ch = fontinfo->ch[c - fontinfo->first];
51 if (ch)
52 length += ch->advance;
53 }
54 }
55 return length;
56 }
57
58 /* ENDCENTRY */