2 * Copyright 1994-1997 Mark Kilgard, All rights reserved.
3 * Distributed under the terms of the MIT License.
11 #include "glutbitmap.h"
16 glutBitmapWidth(GLUTbitmapFont font
, int c
)
18 BitmapFontPtr fontinfo
;
19 const BitmapCharRec
*ch
;
22 fontinfo
= (BitmapFontPtr
) __glutFont(font
);
24 fontinfo
= (BitmapFontPtr
) font
;
27 if (c
< fontinfo
->first
|| c
>= fontinfo
->first
+ fontinfo
->num_chars
)
29 ch
= fontinfo
->ch
[c
- fontinfo
->first
];
37 glutBitmapLength(GLUTbitmapFont font
, const unsigned char *string
)
40 BitmapFontPtr fontinfo
;
41 const BitmapCharRec
*ch
;
44 fontinfo
= (BitmapFontPtr
) __glutFont(font
);
46 fontinfo
= (BitmapFontPtr
) font
;
50 for (; *string
!= '\0'; string
++) {
52 if (c
>= fontinfo
->first
&& c
< fontinfo
->first
+ fontinfo
->num_chars
) {
53 ch
= fontinfo
->ch
[c
- fontinfo
->first
];
55 length
+= ch
->advance
;