home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / src / exampleCode / opengl / GLUT / lib / fglut / glut_swidth.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-11  |  952 b   |  48 lines

  1.  
  2. /* Copyright (c) Mark J. Kilgard, 1995. */
  3.  
  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. */
  7.  
  8. #include <GL/glut.h>
  9. #include "glutint.h"
  10. #include "glutstroke.h"
  11.  
  12. /* CENTRY */
  13. int
  14. glutStrokeWidth(GLUTstrokeFont font, int c)
  15. {
  16.   StrokeFontPtr fontinfo = (StrokeFontPtr) font;
  17.   StrokeCharPtr ch;
  18.  
  19.   if (c < 0 || c >= fontinfo->num_chars)
  20.     return 0;
  21.   ch = &(fontinfo->ch[c]);
  22.   if (ch)
  23.     return ch->right;
  24.   else
  25.     return 0;
  26. }
  27.  
  28. int
  29. glutStrokeLength(GLUTstrokeFont font, unsigned char *string)
  30. {
  31.   int c, length;
  32.   StrokeFontPtr fontinfo = (StrokeFontPtr) font;
  33.   StrokeCharPtr ch;
  34.  
  35.   length = 0;
  36.   for (; *string != '\0'; string++) {
  37.     c = *string;
  38.     if (c < 0 || c >= fontinfo->num_chars) {
  39.       ch = &(fontinfo->ch[c]);
  40.       if (ch)
  41.     length += ch->right;
  42.     }
  43.   }
  44.   return length;
  45. }
  46.  
  47. /* ENDCENTRY */
  48.