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 "glutint.h"
9#include "glutstroke.h"
10
11/* CENTRY */
12int GLUTAPIENTRY
13glutStrokeWidth(GLUTstrokeFont font, int c)
14{
15  StrokeFontPtr fontinfo;
16  const StrokeCharRec *ch;
17
18#if defined(_WIN32) || defined(GLUT_IMPORT_LIB)
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 GLUTAPIENTRY
34glutStrokeLength(GLUTstrokeFont font, const unsigned char *string)
35{
36  int c, length;
37  StrokeFontPtr fontinfo;
38  const StrokeCharRec *ch;
39
40#if defined(_WIN32) || defined(GLUT_IMPORT_LIB)
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 */
59