Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
glut_swidth.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 "glutstroke.h"
00011 
00012 int
00013 glutStrokeWidth(GLUTstrokeFont font, int c)
00014 {
00015   StrokeFontPtr fontinfo = (StrokeFontPtr) font;
00016   StrokeCharPtr ch;
00017 
00018   if (c < 0 || c >= fontinfo->num_chars)
00019     return 0;
00020   ch = &(fontinfo->ch[c]);
00021   if (ch)
00022     return ch->right;
00023   else
00024     return 0;
00025 }
00026 
00027 int
00028 glutStrokeLength(GLUTstrokeFont font, unsigned char *string)
00029 {
00030   int c, length;
00031   StrokeFontPtr fontinfo = (StrokeFontPtr) font;
00032   StrokeCharPtr ch;
00033 
00034   length = 0;
00035   for (; *string != '\0'; string++) {
00036     c = *string;
00037     if (c < 0 || c >= fontinfo->num_chars) {
00038       ch = &(fontinfo->ch[c]);
00039       if (ch)
00040         length += ch->right;
00041     }
00042   }
00043   return length;
00044 }
00045