Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
glut_bwidth.c
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <GL/glut.h>
00009 #include "glutint.h"
00010 #include "glutbitmap.h"
00011
00012 int
00013 glutBitmapWidth(GLUTbitmapFont font, int c)
00014 {
00015 BitmapFontPtr fontinfo = (BitmapFontPtr) font;
00016 BitmapCharPtr ch;
00017
00018 if (c < fontinfo->first || c >= fontinfo->first + fontinfo->num_chars)
00019 return 0;
00020 ch = fontinfo->ch[c - fontinfo->first];
00021 if (ch)
00022 return ch->advance;
00023 else
00024 return 0;
00025 }
00026
00027 int
00028 glutBitmapLength(GLUTbitmapFont font, unsigned char *string)
00029 {
00030 int c, length;
00031 BitmapFontPtr fontinfo = (BitmapFontPtr) font;
00032 BitmapCharPtr ch;
00033
00034 length = 0;
00035 for (; *string != '\0'; string++) {
00036 c = *string;
00037 if (c < fontinfo->first || c >= fontinfo->first + fontinfo->num_chars) {
00038 ch = fontinfo->ch[c - fontinfo->first];
00039 if (ch)
00040 length += ch->advance;
00041 }
00042 }
00043 return length;
00044 }
00045