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. */
10 #include "glutbitmap.h"
14 glutBitmapWidth(GLUTbitmapFont font
, int c
)
16 BitmapFontPtr fontinfo
;
17 const BitmapCharRec
*ch
;
20 fontinfo
= (BitmapFontPtr
) __glutFont(font
);
22 fontinfo
= (BitmapFontPtr
) font
;
25 if (c
< fontinfo
->first
|| c
>= fontinfo
->first
+ fontinfo
->num_chars
)
27 ch
= fontinfo
->ch
[c
- fontinfo
->first
];
29 return (int)ch
->advance
;
35 glutBitmapLength(GLUTbitmapFont font
, const char *string
)
38 BitmapFontPtr fontinfo
;
39 const BitmapCharRec
*ch
;
42 fontinfo
= (BitmapFontPtr
) __glutFont(font
);
44 fontinfo
= (BitmapFontPtr
) font
;
48 for (; *string
!= '\0'; string
++) {
50 if (c
>= fontinfo
->first
&& c
< fontinfo
->first
+ fontinfo
->num_chars
) {
51 ch
= fontinfo
->ch
[c
- fontinfo
->first
];
53 length
+= (int)ch
->advance
;