1 /* 2 * Copyright 1994-1997 Mark Kilgard, All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Mark Kilgard 7 */ 8 9 10 #include "glutint.h" 11 #include "glutstroke.h" 12 13 14 /* CENTRY */ 15 int APIENTRY 16 glutStrokeWidth(GLUTstrokeFont font, int c) 17 { 18 StrokeFontPtr fontinfo; 19 const StrokeCharRec *ch; 20 21 #if defined(_WIN32) 22 fontinfo = (StrokeFontPtr) __glutFont(font); 23 #else 24 fontinfo = (StrokeFontPtr) font; 25 #endif 26 27 if (c < 0 || c >= fontinfo->num_chars) 28 return 0; 29 ch = &(fontinfo->ch[c]); 30 if (ch) 31 return ch->right; 32 else 33 return 0; 34 } 35 36 int APIENTRY 37 glutStrokeLength(GLUTstrokeFont font, const unsigned char *string) 38 { 39 int c, length; 40 StrokeFontPtr fontinfo; 41 const StrokeCharRec *ch; 42 43 #if defined(_WIN32) 44 fontinfo = (StrokeFontPtr) __glutFont(font); 45 #else 46 fontinfo = (StrokeFontPtr) font; 47 #endif 48 49 length = 0; 50 for (; *string != '\0'; string++) { 51 c = *string; 52 if (c >= 0 && c < fontinfo->num_chars) { 53 ch = &(fontinfo->ch[c]); 54 if (ch) 55 length += ch->right; 56 } 57 } 58 return length; 59 } 60 61 /* ENDCENTRY */ 62