37 {
38
39
40
41
42
44 if (font == GLUT_STROKE_ROMAN)
return (SFG_StrokeFont*)&
fgStrokeRoman;
45 if (font == GLUT_STROKE_MONO_ROMAN)
47
48 std::cerr << "stroke font " << (int)font << " not found" << std::endl;
49 return 0;
50}
51
53 const unsigned char* string = reinterpret_cast<const unsigned char*>(string_);
54 unsigned char c;
55 int i, j;
56 float length = 0.0;
58
61 if (!string || !*string) return;
62
63
64
65
66
67
68 while ((c = *string++))
69 if (c < font->Quantity) {
70 if (c == '\n') {
71 glTranslatef(-length, -(float)(font->Height), 0.0);
72 length = 0.0;
73 } else
74 {
76 if (schar) {
78
79 for (i = 0; i < schar->Number; i++, strip++) {
80 glBegin(GL_LINE_STRIP);
81 for (j = 0; j < strip->Number; j++)
82 glVertex2f(strip->Vertices[j].X, strip->Vertices[j].Y);
83
84 glEnd();
85 }
86
87 length += schar->Right;
88 glTranslatef(schar->Right, 0.0f, 0.0f);
89 }
90 }
91 }
92}
93
94
95
96
98 const unsigned char* string = reinterpret_cast<const unsigned char*>(string_);
99 unsigned char c;
100 float length = 0.0;
101 float this_line_length = 0.0;
103
106 if (!string || !*string) return 0;
107
108 while ((c = *string++))
109 if (c < font->Quantity) {
110 if (c == '\n')
111 {
112 if (length < this_line_length) length = this_line_length;
113 this_line_length = 0.0;
114 } else
115 {
117 if (schar) this_line_length += schar->
Right;
118 }
119 }
120 if (length < this_line_length) length = this_line_length;
121 return (int)(length + 0.5);
122}
123
124
125
126
129
132 return font->Height;
133}
134
135}
136
137
#define freeglut_return_if_fail(expr)
#define freeglut_return_val_if_fail(expr, val)
struct tagSFG_StrokeChar SFG_StrokeChar
const SFG_StrokeFont fgStrokeMonoRoman
static SFG_StrokeFont * fghStrokeByID(FontID font)
void glutStrokeString(FontID fontID, const char *string_)
const SFG_StrokeFont fgStrokeRoman
struct tagSFG_StrokeFont SFG_StrokeFont
struct tagSFG_StrokeStrip SFG_StrokeStrip
int glutStrokeLength(FontID fontID, const char *string_)
GLfloat glutStrokeHeight(FontID fontID)