gallium: add target-helpers/wrap_screen.c to C_SOURCES
[mesa/mesa-lb.git] / src / glut / beos / glut_bwidth.c
blobbee5e8827ea4a72b19a6661f859484890898172a
2 /* Copyright (c) Mark J. Kilgard, 1994. */
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. */
8 #include "glutint.h"
9 #include "glutbitmap.h"
11 /* CENTRY */
12 int APIENTRY
13 glutBitmapWidth(GLUTbitmapFont font, int c)
15 BitmapFontPtr fontinfo;
16 const BitmapCharRec *ch;
18 #ifdef _WIN32
19 fontinfo = (BitmapFontPtr) __glutFont(font);
20 #else
21 fontinfo = (BitmapFontPtr) font;
22 #endif
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;
33 int APIENTRY
34 glutBitmapLength(GLUTbitmapFont font, const unsigned char *string)
36 int c, length;
37 BitmapFontPtr fontinfo;
38 const BitmapCharRec *ch;
40 #ifdef _WIN32
41 fontinfo = (BitmapFontPtr) __glutFont(font);
42 #else
43 fontinfo = (BitmapFontPtr) font;
44 #endif
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;
55 return length;
58 /* ENDCENTRY */