| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Draw.Text
Synopsis
- showTextAligned :: CairoString string => HAlign -> VAlign -> string -> Render ()
- plotText :: PlotTextOptions -> String -> [Polyline]
- data PlotTextOptions = PlotTextOptions {}
- data HAlign
- data VAlign
Documentation
Arguments
| :: CairoString string | |
| => HAlign | Horizontal alignment |
| -> VAlign | Vertical alignment |
| -> string | Text |
| -> Render () |
Like Cairo’s showText, but with alignment parameters. Since Cairo’s text API
is pretty wonky, you may have to sprinkle this with moveTo/moveToVec or
newPath.
(image code)
>>>:{haddockRender "Draw/Text/show_text_aligned.svg" 200 30 $ \_ -> do coordinateSystem CairoStandard_ZeroTopLeft_XRight_YDown C.moveTo (200/2) (30/2) C.scale 3 3 showTextAligned HCenter VCenter "Hello world!" :} Generated file: size 8KB, crc32: 0xefcaecf4
plotText :: PlotTextOptions -> String -> [Polyline] Source #
Some text as pure geometry.
(image code)
>>>:{haddockRender "Draw/Text/plot_text.svg" 200 30 $ \_ -> do let opts = PlotTextOptions { _textStartingPoint = Vec2 (200/2) (30/2) , _textHeight = 20 , _textHAlign = HCenter , _textVAlign = VCenter } glyphs = plotText opts "Hello world!" for_ glyphs $ \glyph -> sketch glyph >> stroke :} Generated file: size 7KB, crc32: 0xd253d9dd
data PlotTextOptions Source #
Constructors
| PlotTextOptions | |
Fields
| |
Instances
| Default PlotTextOptions Source # | |
Defined in Draw.Text Methods | |