Make UEFI boot-platform build again
[haiku.git] / src / libs / glut / glut_bwidth.c
blob804ee5cebeaf5fe2ac401ac54f8f89359613d755
1 /*
2 * Copyright 1994-1997 Mark Kilgard, All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * GPL licensing not permitted.
7 * Authors:
8 * Mark Kilgard
9 */
12 #include "glutint.h"
13 #include "glutbitmap.h"
16 /* CENTRY */
17 int APIENTRY
18 glutBitmapWidth(GLUTbitmapFont font, int c)
20 BitmapFontPtr fontinfo;
21 const BitmapCharRec *ch;
23 #ifdef _WIN32
24 fontinfo = (BitmapFontPtr) __glutFont(font);
25 #else
26 fontinfo = (BitmapFontPtr) font;
27 #endif
29 if (c < fontinfo->first || c >= fontinfo->first + fontinfo->num_chars)
30 return 0;
31 ch = fontinfo->ch[c - fontinfo->first];
32 if (ch)
33 return ch->advance;
34 else
35 return 0;
38 int APIENTRY
39 glutBitmapLength(GLUTbitmapFont font, const unsigned char *string)
41 int c, length;
42 BitmapFontPtr fontinfo;
43 const BitmapCharRec *ch;
45 #ifdef _WIN32
46 fontinfo = (BitmapFontPtr) __glutFont(font);
47 #else
48 fontinfo = (BitmapFontPtr) font;
49 #endif
51 length = 0;
52 for (; *string != '\0'; string++) {
53 c = *string;
54 if (c >= fontinfo->first && c < fontinfo->first + fontinfo->num_chars) {
55 ch = fontinfo->ch[c - fontinfo->first];
56 if (ch)
57 length += ch->advance;
60 return length;
63 /* ENDCENTRY */