#include "internal.h"
void
glutStrokeCharacter (void *font, int c)
{
const GLUTStrokeFont *sfp = _glut_font(font);
const GLUTStrokeChar *scp;
const GLUTStrokeStrip *ssp;
const GLUTStrokeVertex *svp;
unsigned i, j;
if (((unsigned)c) >= sfp->num || !(scp = sfp->table[c]))
return;
ssp = scp->strip;
for (i = 0; i < scp->num; i++, ssp++) {
svp = ssp->vertex;
glBegin(GL_LINE_STRIP);
for (j = 0; j < ssp->num; j++, svp++) {
glVertex2f(svp->x, svp->y);
}
glEnd();
}
glTranslatef(scp->right, 0.0, 0.0);
}
void
glutStrokeString (void *font, const unsigned char *string)
{
const GLUTStrokeFont *sfp = _glut_font(font);
const GLUTStrokeChar *scp;
const GLUTStrokeStrip *ssp;
const GLUTStrokeVertex *svp;
unsigned char c;
unsigned i, j;
while ((c = *(string++))) {
if (c < sfp->num && (scp = sfp->table[c])) {
ssp = scp->strip;
for (i = 0; i < scp->num; i++, ssp++) {
svp = ssp->vertex;
glBegin(GL_LINE_STRIP);
for (j = 0; j < ssp->num; j++, svp++) {
glVertex2f(svp->x, svp->y);
}
glEnd();
}
glTranslatef(scp->right, 0.0, 0.0);
}
}
}
int
glutStrokeWidth (void *font, int c)
{
const GLUTStrokeFont *sfp = _glut_font(font);
const GLUTStrokeChar *scp;
if (((unsigned)c) >= sfp->num || !(scp = sfp->table[c]))
return 0;
return scp->right;
}
int
glutStrokeLength (void *font, const unsigned char *string)
{
const GLUTStrokeFont *sfp = _glut_font(font);
const GLUTStrokeChar *scp;
unsigned char c;
int length = 0;
while ((c = *(string++))) {
if (c < sfp->num && (scp = sfp->table[c]))
length += scp->right;
}
return length;
}
GLfloat
glutStrokeHeight (void *font)
{
const GLUTStrokeFont *sfp = _glut_font(font);
return sfp->height;
}