source: trunk/src/opengl/glut/glut_swidth.c

Last change on this file was 2689, checked in by jeroen, 26 years ago

* empty log message *

File size: 1.2 KB
Line 
1/* $Id: glut_swidth.c,v 1.2 2000-02-09 08:46:17 jeroen Exp $ */
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 "glutint.h"
9#include "glutstroke.h"
10
11/* CENTRY */
12int APIENTRY
13glutStrokeWidth(GLUTstrokeFont font, int c)
14{
15 StrokeFontPtr fontinfo;
16 const StrokeCharRec *ch;
17
18#if defined(_WIN32)
19 fontinfo = (StrokeFontPtr) __glutFont(font);
20#else
21 fontinfo = (StrokeFontPtr) font;
22#endif
23
24 if (c < 0 || c >= fontinfo->num_chars)
25 return 0;
26 ch = &(fontinfo->ch[c]);
27 if (ch)
28 return ch->right;
29 else
30 return 0;
31}
32
33int APIENTRY
34glutStrokeLength(GLUTstrokeFont font, const unsigned char *string)
35{
36 int c, length;
37 StrokeFontPtr fontinfo;
38 const StrokeCharRec *ch;
39
40#if defined(_WIN32)
41 fontinfo = (StrokeFontPtr) __glutFont(font);
42#else
43 fontinfo = (StrokeFontPtr) font;
44#endif
45
46 length = 0;
47 for (; *string != '\0'; string++) {
48 c = *string;
49 if (c >= 0 && c < fontinfo->num_chars) {
50 ch = &(fontinfo->ch[c]);
51 if (ch)
52 length += ch->right;
53 }
54 }
55 return length;
56}
57
58/* ENDCENTRY */
Note: See TracBrowser for help on using the repository browser.