GLUT-2.1.1.1: A binding for the OpenGL Utility ToolkitSource codeContentsIndex
Graphics.UI.GLUT.Fonts
Portabilityportable
Stabilitystable
Maintainersven.panne@aedion.de
Description
GLUT supports two types of font rendering: stroke fonts, meaning each character is rendered as a set of line segments; and bitmap fonts, where each character is a bitmap generated with Graphics.Rendering.OpenGL.GL.Bitmaps.bitmap. Stroke fonts have the advantage that because they are geometry, they can be arbitrarily scale and rendered. Bitmap fonts are less flexible since they are rendered as bitmaps but are usually faster than stroke fonts.
Synopsis
class Font a where
renderString :: a -> String -> IO ()
stringWidth :: a -> String -> IO GLint
fontHeight :: a -> IO GLfloat
data BitmapFont
= Fixed8By13
| Fixed9By15
| TimesRoman10
| TimesRoman24
| Helvetica10
| Helvetica12
| Helvetica18
data StrokeFont
= Roman
| MonoRoman
Documentation
class Font a whereSource
Methods
renderString :: a -> String -> IO ()Source

Render the string in the named font, without using any display lists. Rendering a nonexistent character has no effect.

If the font is a bitmap font, renderString automatically sets the OpenGL unpack pixel storage modes it needs appropriately and saves and restores the previous modes before returning. The generated call to Graphics.Rendering.OpenGL.GL.bitmap will adjust the current raster position based on the width of the string. If the font is a stroke font, Graphics.Rendering.OpenGL.GL.CoordTrans.translate is used to translate the current model view matrix to advance the width of the string.

stringWidth :: a -> String -> IO GLintSource
For a bitmap font, return the width in pixels of a string. For a stroke font, return the width in units. 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.
fontHeight :: a -> IO GLfloatSource
(freeglut only) For a bitmap font, return the maximum height of the characters in the given font measured in pixels. For a stroke font, return the width in units.
show/hide Instances
data BitmapFont Source
The bitmap fonts available in GLUT. The exact bitmap to be used is defined by the standard X glyph bitmaps for the X font with the given name.
Constructors
Fixed8By13A fixed width font with every character fitting in an 8 by 13 pixel rectangle. (-misc-fixed-medium-r-normal--13-120-75-75-C-80-iso8859-1)
Fixed9By15A fixed width font with every character fitting in an 9 by 15 pixel rectangle. (-misc-fixed-medium-r-normal--15-140-75-75-C-90-iso8859-1)
TimesRoman10A 10-point proportional spaced Times Roman font. (-adobe-times-medium-r-normal--10-100-75-75-p-54-iso8859-1)
TimesRoman24A 24-point proportional spaced Times Roman font. (-adobe-times-medium-r-normal--24-240-75-75-p-124-iso8859-1)
Helvetica10A 10-point proportional spaced Helvetica font. (-adobe-helvetica-medium-r-normal--10-100-75-75-p-56-iso8859-1)
Helvetica12A 12-point proportional spaced Helvetica font. (-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1)
Helvetica18A 18-point proportional spaced Helvetica font. (-adobe-helvetica-medium-r-normal--18-180-75-75-p-98-iso8859-1)
show/hide Instances
data StrokeFont Source
The stroke fonts available in GLUT.
Constructors
RomanA proportionally spaced Roman Simplex font for ASCII characters 32 through 127. The maximum top character in the font is 119.05 units; the bottom descends 33.33 units.
MonoRomanA mono-spaced spaced Roman Simplex font (same characters as Roman) for ASCII characters 32 through 127. The maximum top character in the font is 119.05 units; the bottom descends 33.33 units. Each character is 104.76 units wide.
show/hide Instances
Produced by Haddock version 2.4.2