glutStrokeWidth(3) freeglut glutStrokeWidth(3)

glutStrokeWidthf, glutStrokeWidth - returns the width of a stroke character.
glutStrokeLengthf, glutStrokeLength - returns the length of a stroke font string.

float glutStrokeWidthf(void *font, int character);
float glutStrokeLengthf(void *font, const unsigned char *string);
Deprecated interfaces
int glutStrokeWidth(void *font, int character);
int glutStrokeLength(void *font, const unsigned char *string);

Stroke font to use. For valid values, see the glutStrokeWidth description.
Character to return width of (not confined to 8 bits).
Text string (8-bit characters), nul terminated.

glutStrokeWidthf returns the width in modeling units of a stroke character in a supported stroke font. While the width of characters in a font may vary (though fixed width fonts do not vary), the maximum height characteristics of a particular font are fixed.

glutStrokeLengthf returns the length in modeling units of a string (8-bit characters). This length is equivalent to summing all the widths returned by glutStrokeWidthf for each character in the string.

The deprecated glutStrokeWidth and glutStrokeLength routines return an integer rather than a float. Newer GLUT programs should use the newer float-returning iroutine glutStrokeWidthf and glutStrokeLengthf. Note that these newer float routines do not exist in implementations prior to GLUT 3.8. Also, the glutStrokeLength routine summed integerized character widths so it underestimated the length of strings prior to GLUT 3.8, but the implementation of glutStrokeLength in GLUT 3.8 and beyond sums the character widths for the strings in a float (though glutStrokeLength still returns an integer).

glutStrokeCharacter, glutBitmapWidth

Mark J. Kilgard (mjk@nvidia.com)

April 2025 freeglut