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. */
9 #include "glutbitmap.h"
13 glutBitmapWidth(GLUTbitmapFont font
, int c
)
15 BitmapFontPtr fontinfo
;
16 const BitmapCharRec
*ch
;
18 #if defined(_WIN32) || defined(GLUT_IMPORT_LIB)
19 fontinfo
= (BitmapFontPtr
) __glutFont(font
);
21 fontinfo
= (BitmapFontPtr
) font
;
24 if (c
< fontinfo
->first
|| c
>= fontinfo
->first
+ fontinfo
->num_chars
)
26 ch
= fontinfo
->ch
[c
- fontinfo
->first
];
34 glutBitmapLength(GLUTbitmapFont font
, const unsigned char *string
)
37 BitmapFontPtr fontinfo
;
38 const BitmapCharRec
*ch
;
40 #if defined(_WIN32) || defined(GLUT_IMPORT_LIB)
41 fontinfo
= (BitmapFontPtr
) __glutFont(font
);
43 fontinfo
= (BitmapFontPtr
) font
;
47 for (; *string
!= '\0'; string
++) {
49 if (c
>= fontinfo
->first
&& c
< fontinfo
->first
+ fontinfo
->num_chars
) {
50 ch
= fontinfo
->ch
[c
- fontinfo
->first
];
52 length
+= ch
->advance
;