2 * Copyright 1994-1997 Mark Kilgard, All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * GPL licensing not permitted.
13 #include "glutbitmap.h"
18 glutBitmapWidth(GLUTbitmapFont font
, int c
)
20 BitmapFontPtr fontinfo
;
21 const BitmapCharRec
*ch
;
24 fontinfo
= (BitmapFontPtr
) __glutFont(font
);
26 fontinfo
= (BitmapFontPtr
) font
;
29 if (c
< fontinfo
->first
|| c
>= fontinfo
->first
+ fontinfo
->num_chars
)
31 ch
= fontinfo
->ch
[c
- fontinfo
->first
];
39 glutBitmapLength(GLUTbitmapFont font
, const unsigned char *string
)
42 BitmapFontPtr fontinfo
;
43 const BitmapCharRec
*ch
;
46 fontinfo
= (BitmapFontPtr
) __glutFont(font
);
48 fontinfo
= (BitmapFontPtr
) font
;
52 for (; *string
!= '\0'; string
++) {
54 if (c
>= fontinfo
->first
&& c
< fontinfo
->first
+ fontinfo
->num_chars
) {
55 ch
= fontinfo
->ch
[c
- fontinfo
->first
];
57 length
+= ch
->advance
;