HGL-3.2.0.2: A simple graphics library based on X11 or Win32Source codeContentsIndex
Graphics.HGL.Draw.Text
Portabilitynon-portable (requires concurrency)
Stabilityprovisional
Maintainerlibraries@haskell.org
Contents
Drawing text
Color
Alignment
Description
Drawing text.
Synopsis
text :: Point -> String -> Graphic
textInfo :: String -> Draw (Point, Size)
data RGB = RGB Word8 Word8 Word8
setTextColor :: RGB -> Draw RGB
setBkColor :: RGB -> Draw RGB
data BkMode
= Opaque
| Transparent
setBkMode :: BkMode -> Draw BkMode
type Alignment = (HAlign, VAlign)
data HAlign
= Left'
| Center
| Right'
data VAlign
= Top
| Baseline
| Bottom
setTextAlignment :: Alignment -> Draw Alignment
Drawing text
text :: Point -> String -> GraphicSource
Render a String positioned relative to the specified Point.
textInfo :: String -> Draw (Point, Size)Source

textInfo s returns:

  1. The offset at which the string would be drawn according to the current text alignment (e.g., (Center, Baseline) will result in an offset of (-width/2,0))
  2. The size at which the text would be drawn using the current font.
Color
data RGB Source
A color, comprising red, green and blue components.
Constructors
RGB Word8 Word8 Word8
setTextColor :: RGB -> Draw RGBSource
Set the foreground color for drawing text, returning the previous value.
setBkColor :: RGB -> Draw RGBSource
Set the background color for drawing text, returning the previous value. The background color is ignored when the mode is Transparent.
data BkMode Source
Background mode for drawing text.
Constructors
OpaqueDraw text on a bounding rectangle filled with the current background color.
TransparentDraw text without a background rectangle.
setBkMode :: BkMode -> Draw BkModeSource
Set the background mode for drawing text, returning the previous value.
Alignment
type Alignment = (HAlign, VAlign)Source
How strings drawn with Graphics.HGL.Draw.Text.text are positioned relative to the specified reference point.
data HAlign Source
Horizontal alignment of text. Names have a tick to distinguish them from Prelude names.
Constructors
Left'align the left edge of the text with the reference point
Centercenter the text with the reference point
Right'align the right edge of the text with the reference point
show/hide Instances
data VAlign Source
Vertical alignment of text.
Constructors
Topalign the top edge of the text with the reference point
Baselinealign the baseline of the text with the reference point
Bottomalign the bottom edge of the text with the reference point
show/hide Instances
setTextAlignment :: Alignment -> Draw AlignmentSource
Set the alignment for drawing text, returning the previous value.
Produced by Haddock version 2.4.2