2D text decorations using GLUT fonts
This module provides the basic functions for using the GLUT library in the rendering of text on an OpenGL canvas.
Select one of the glut fonts using a font + size description.
The return value is a 4-character string representing one of the GLUT fonts.
Return GLUT font designation for the named font.
The recognized font names are:
If an unrecognized string is given, the default is ‘hv18’.
Return the height of the named glut font.
This supposes that the last two characters of the name hold the font height.
Draw a text in given font at the current rasterpoint.
font should be one of the legal fonts returned by glutFont(). If text is not a string, it will be formatted to a string before drawing. After drawing, the rasterpos will have been updated!
Compute the length in pixels of a text string in given font.
We use our own function to calculate the length because the builtin has a bug.
Draw a text at given 2D position in window.
- text: a simple string, a multiline string or a list of strings. If it is a string, it will be splitted on the occurrence of ‘