forgotten commit. disabled until egl is adapted.
[AROS-Contrib.git] / gfx / libs / glut / stroke.c
blobbb07d90fcfe05c3fd871392dc020279835e3b943
1 /*
2 * FxGLUT version 0.12 - GLUT for Voodoo 1 and 2 under Linux
3 * Copyright (C) 1999 Christopher John Purnell
4 * cjp@lost.org.uk
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "internal.h"
24 void
25 glutStrokeCharacter (void *font, int c)
27 const GLUTStrokeFont *sfp = (GLUTStrokeFont *) _glut_font(font);
28 const GLUTStrokeChar *scp;
29 const GLUTStrokeStrip *ssp;
30 const GLUTStrokeVertex *svp;
31 unsigned i, j;
33 if (((unsigned)c) >= sfp->num || !(scp = sfp->table[c]))
34 return;
36 ssp = scp->strip;
38 for (i = 0; i < scp->num; i++, ssp++) {
39 svp = ssp->vertex;
41 glBegin(GL_LINE_STRIP);
42 for (j = 0; j < ssp->num; j++, svp++) {
43 glVertex2f(svp->x, svp->y);
45 glEnd();
48 glTranslatef(scp->right, 0.0, 0.0);
52 void
53 glutStrokeString (void *font, const unsigned char *string)
55 const GLUTStrokeFont *sfp = _glut_font(font);
56 const GLUTStrokeChar *scp;
57 const GLUTStrokeStrip *ssp;
58 const GLUTStrokeVertex *svp;
59 unsigned char c;
60 unsigned i, j;
62 while ((c = *(string++))) {
63 if (c < sfp->num && (scp = sfp->table[c])) {
64 ssp = scp->strip;
66 for (i = 0; i < scp->num; i++, ssp++) {
67 svp = ssp->vertex;
69 glBegin(GL_LINE_STRIP);
70 for (j = 0; j < ssp->num; j++, svp++) {
71 glVertex2f(svp->x, svp->y);
73 glEnd();
76 glTranslatef(scp->right, 0.0, 0.0);
82 int
83 glutStrokeWidth (void *font, int c)
85 const GLUTStrokeFont *sfp = _glut_font(font);
86 const GLUTStrokeChar *scp;
88 if (((unsigned)c) >= sfp->num || !(scp = sfp->table[c]))
89 return 0;
91 return scp->right;
95 int
96 glutStrokeLength (void *font, const unsigned char *string)
98 const GLUTStrokeFont *sfp = _glut_font(font);
99 const GLUTStrokeChar *scp;
100 unsigned char c;
101 int length = 0;
103 while ((c = *(string++))) {
104 if (c < sfp->num && (scp = sfp->table[c]))
105 length += scp->right;
108 return length;
112 GLfloat
113 glutStrokeHeight (void *font)
115 const GLUTStrokeFont *sfp = _glut_font(font);
117 return sfp->height;