Copyright | (c) Sven Panne 2002-2018 |
---|---|
License | BSD3 |
Maintainer | Sven Panne <svenpanne@gmail.com> |
Stability | stable |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
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
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 :: MonadIO m => a -> String -> m ()
- stringWidth :: MonadIO m => a -> String -> m GLint
- fontHeight :: MonadIO m => a -> m GLfloat
- data BitmapFont
- data StrokeFont
Documentation
renderString :: MonadIO m => a -> String -> m () 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
bitmap
will adjust the current raster
position based on the width of the string.
If the font is a stroke font,
translate
is used to translate
the current model view matrix to advance the width of the string.
stringWidth :: MonadIO m => a -> String -> m GLint Source #
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 :: MonadIO m => a -> m GLfloat Source #
(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 height in units.
Instances
Font StrokeFont Source # | |
Defined in Graphics.UI.GLUT.Fonts renderString :: MonadIO m => StrokeFont -> String -> m () Source # stringWidth :: MonadIO m => StrokeFont -> String -> m GLint Source # fontHeight :: MonadIO m => StrokeFont -> m GLfloat Source # | |
Font BitmapFont Source # | |
Defined in Graphics.UI.GLUT.Fonts renderString :: MonadIO m => BitmapFont -> String -> m () Source # stringWidth :: MonadIO m => BitmapFont -> String -> m GLint Source # fontHeight :: MonadIO m => BitmapFont -> m GLfloat Source # |
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.
Fixed8By13 | A fixed width font with every character fitting in an 8
by 13 pixel rectangle.
( |
Fixed9By15 | A fixed width font with every character fitting in an 9
by 15 pixel rectangle.
( |
TimesRoman10 | A 10-point proportional spaced Times Roman font.
( |
TimesRoman24 | A 24-point proportional spaced Times Roman font.
( |
Helvetica10 | A 10-point proportional spaced Helvetica font.
( |
Helvetica12 | A 12-point proportional spaced Helvetica font.
( |
Helvetica18 | A 18-point proportional spaced Helvetica font.
( |
Instances
Eq BitmapFont Source # | |
Defined in Graphics.UI.GLUT.Raw.Fonts (==) :: BitmapFont -> BitmapFont -> Bool # (/=) :: BitmapFont -> BitmapFont -> Bool # | |
Ord BitmapFont Source # | |
Defined in Graphics.UI.GLUT.Raw.Fonts compare :: BitmapFont -> BitmapFont -> Ordering # (<) :: BitmapFont -> BitmapFont -> Bool # (<=) :: BitmapFont -> BitmapFont -> Bool # (>) :: BitmapFont -> BitmapFont -> Bool # (>=) :: BitmapFont -> BitmapFont -> Bool # max :: BitmapFont -> BitmapFont -> BitmapFont # min :: BitmapFont -> BitmapFont -> BitmapFont # | |
Show BitmapFont Source # | |
Defined in Graphics.UI.GLUT.Raw.Fonts showsPrec :: Int -> BitmapFont -> ShowS # show :: BitmapFont -> String # showList :: [BitmapFont] -> ShowS # | |
Font BitmapFont Source # | |
Defined in Graphics.UI.GLUT.Fonts renderString :: MonadIO m => BitmapFont -> String -> m () Source # stringWidth :: MonadIO m => BitmapFont -> String -> m GLint Source # fontHeight :: MonadIO m => BitmapFont -> m GLfloat Source # |
data StrokeFont Source #
The stroke fonts available in GLUT.
Roman | A 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. |
MonoRoman | A mono-spaced spaced Roman Simplex font (same characters as
|
Instances
Eq StrokeFont Source # | |
Defined in Graphics.UI.GLUT.Raw.Fonts (==) :: StrokeFont -> StrokeFont -> Bool # (/=) :: StrokeFont -> StrokeFont -> Bool # | |
Ord StrokeFont Source # | |
Defined in Graphics.UI.GLUT.Raw.Fonts compare :: StrokeFont -> StrokeFont -> Ordering # (<) :: StrokeFont -> StrokeFont -> Bool # (<=) :: StrokeFont -> StrokeFont -> Bool # (>) :: StrokeFont -> StrokeFont -> Bool # (>=) :: StrokeFont -> StrokeFont -> Bool # max :: StrokeFont -> StrokeFont -> StrokeFont # min :: StrokeFont -> StrokeFont -> StrokeFont # | |
Show StrokeFont Source # | |
Defined in Graphics.UI.GLUT.Raw.Fonts showsPrec :: Int -> StrokeFont -> ShowS # show :: StrokeFont -> String # showList :: [StrokeFont] -> ShowS # | |
Font StrokeFont Source # | |
Defined in Graphics.UI.GLUT.Fonts renderString :: MonadIO m => StrokeFont -> String -> m () Source # stringWidth :: MonadIO m => StrokeFont -> String -> m GLint Source # fontHeight :: MonadIO m => StrokeFont -> m GLfloat Source # |