@@ -78,6 +78,10 @@ glictFont* glictCreateFont(const char* name) {
78
78
return fnt;
79
79
}
80
80
81
+ /* * \brief Return the font specified by the passed name.
82
+ * \param name Specifies the name of the font, for example `system`
83
+ * \return The font specified by the name
84
+ */
81
85
glictFont* glictFindFont (const char * name) {
82
86
83
87
_GLICTFONTVECTORITERATOR it;
@@ -86,6 +90,10 @@ glictFont* glictFindFont(const char* name) {
86
90
return NULL ;
87
91
}
88
92
93
+ /* * \brief Unregisters the font specified by the passed name.
94
+ * \param name Specifies the name of the font to be deleted
95
+ * \return True if the font was deleted, false if it was not found
96
+ */
89
97
bool glictDeleteFont (const char * name) {
90
98
_GLICTFONTVECTORITERATOR it;
91
99
@@ -202,10 +210,31 @@ bool glictFontRender(const char* text, const char* fontname, float fontsize, flo
202
210
return false ;
203
211
}
204
212
213
+ /* * \brief Returns the rendered dimensions of the passed text for the passed font.
214
+ * \param text Specifies the text being drawn
215
+ * \param font Specifies the font used for rendering
216
+ * \return Returns the width of the text in pixels
217
+ *
218
+ * This is a convenience function that calls the other version of this function
219
+ * with default font size of 10.
220
+ */
205
221
float glictFontSize (const char * text, const char * font) {
206
222
return glictFontSize (text, font, 10 );
207
223
}
208
224
225
+ /* *
226
+ * \brief Returns the rendered dimensions of the passed text for the passed font.
227
+ * \param text Specifies the text being drawn
228
+ * \param font Specifies the font used for rendering
229
+ * \param size Specifies the height of the font
230
+ * \return Width of the text in pixels
231
+ *
232
+ * This function finds the font specified by font parameter, and then calls its
233
+ * size function. If the font does not support size function, it will attempt to
234
+ * resize the font by calling the render function with a scaling factor. In
235
+ * this case, the scaling factor assumes that the font is rendered at size 1
236
+ * (height of 1px).
237
+ */
209
238
float glictFontSize (const char * text, const char * font, float size) {
210
239
211
240
glictFont* fnt = glictFindFont (font);
@@ -222,6 +251,10 @@ float glictFontSize(const char* text, const char* font, float size) {
222
251
return 0 ;
223
252
}
224
253
254
+ /* * \brief Sets the currently active color for the passed font.
255
+ * \param font Specifies the font for which the color is being set
256
+ * \param col Specifies the color to be set
257
+ */
225
258
void glictFontColor (const char * font, glictColor &col) {
226
259
glictFont* fnt = glictFindFont (font);
227
260
if (!fnt) {
@@ -233,6 +266,11 @@ void glictFontColor(const char* font, glictColor &col) {
233
266
fnt->SetColor (fnt->fontparam ,col);
234
267
}
235
268
}
269
+
270
+ /* * \brief Returns the currently active color for the passed font.
271
+ * \param font Specifies the font for which the color is being retrieved
272
+ * \return Currently active color for the font
273
+ */
236
274
glictColor glictFontColor (const char * font) {
237
275
glictFont* fnt = glictFindFont (font);
238
276
if (!fnt) {
@@ -244,7 +282,10 @@ glictColor glictFontColor(const char* font) {
244
282
return fnt->activecolor ;
245
283
}
246
284
247
-
285
+ /* * \brief Counts the number of lines in the passed string.
286
+ * \param txt The text in which lines are being counted
287
+ * \return The number of lines in the text
288
+ */
248
289
int glictFontNumberOfLines (const char * txt) {
249
290
int count=1 ; // at least 1 line
250
291
for (unsigned int i=0 ;i<strlen (txt);i++) {
@@ -276,9 +317,19 @@ glictFont::~glictFont() {
276
317
// nope
277
318
}
278
319
320
+ /* * \brief Sets the name of the font represented by this class instance.
321
+ * \param name The name of the font
322
+ *
323
+ * This function sets the name of the font. The name is used to identify the
324
+ * font in the font list.
325
+ */
279
326
void glictFont::SetName (const char * name) {
280
327
this ->name = name;
281
328
}
329
+
330
+ /* * \brief Gets the name of this font.
331
+ * \return The name of the font
332
+ */
282
333
std::string glictFont::GetName () {
283
334
return this ->name ;
284
335
}
0 commit comments