Maintainer | gtk2hs-users@lists.sourceforge.net |
---|---|
Stability | provisional |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
Pango specific functions to for redering with Cairo.
Cairo is a graphics library that supports vector graphics and image compositing that can be used with Pango. The functions in this module provide ways of rendering text in Cairo using Pango.
- cairoFontMapGetDefault :: IO FontMap
- cairoFontMapSetResolution :: FontMap -> Double -> IO ()
- cairoFontMapGetResolution :: FontMap -> IO Double
- cairoCreateContext :: Maybe FontMap -> IO PangoContext
- cairoContextSetResolution :: PangoContext -> Double -> IO ()
- cairoContextGetResolution :: PangoContext -> IO Double
- cairoContextSetFontOptions :: PangoContext -> FontOptions -> IO ()
- cairoContextGetFontOptions :: PangoContext -> IO FontOptions
- setSourceColor :: Color -> Render ()
- updateContext :: PangoContext -> Render ()
- createLayout :: GlibString string => string -> Render PangoLayout
- updateLayout :: PangoLayout -> Render ()
- showGlyphString :: GlyphItem -> Render ()
- showLayoutLine :: LayoutLine -> Render ()
- showLayout :: PangoLayout -> Render ()
- glyphStringPath :: GlyphItem -> Render ()
- layoutLinePath :: LayoutLine -> Render ()
- layoutPath :: PangoLayout -> Render ()
Global Cairo settings.
cairoFontMapGetDefault :: IO FontMap Source #
Retrieve the default FontMap
that contains a
list of available fonts.
- One purpose of creating an explicit
FontMap
is to set a different scaling factor between font sizes (in points, pt) and Cairo units (in pixels). The default is 96dpi (dots per inch) which corresponds to an average screen as output medium. A 10pt font will therefore scale to10pt * (1/72 pt/inch) * (96 pixel/inch) = 13.3 pixel
.
cairoFontMapSetResolution :: FontMap -> Double -> IO () Source #
Set the scaling factor between font size and Cairo units.
- Value is in dots per inch (dpi). See
cairoFontMapGetDefault
.
cairoFontMapGetResolution :: FontMap -> IO Double Source #
Ask for the scaling factor between font size and Cairo units.
- Value is in dots per inch (dpi). See
cairoFontMapGetDefault
.
cairoCreateContext :: Maybe FontMap -> IO PangoContext Source #
Create a PangoContext
.
- If no
FontMap
is specified, it uses the defaultFontMap
that has a scaling factor of 96 dpi. SeecairoFontMapGetDefault
.
cairoContextSetResolution :: PangoContext -> Double -> IO () Source #
Set the scaling factor of the PangoContext
.
- Supplying zero or a negative value will result in the resolution value
of the underlying
FontMap
to be used. See alsocairoFontMapGetDefault
.
cairoContextGetResolution :: PangoContext -> IO Double Source #
Ask for the scaling factor of the PangoContext
.
- A negative value will be returned if no resolution has been set.
See
cairoContextSetResolution
.
cairoContextSetFontOptions :: PangoContext -> FontOptions -> IO () Source #
Set Cairo font options.
- Apply the given font options to the context. Values set through this
functions override those that are set by
updateContext
.
cairoContextGetFontOptions :: PangoContext -> IO FontOptions Source #
Retrieve Cairo font options.
Functions for the Render
monad.
setSourceColor :: Color -> Render () Source #
updateContext :: PangoContext -> Render () Source #
Update a PangoContext
with respect to changes in a Render
environment.
- The
PangoContext
must have been created withcairoCreateContext
. AnyPangoLayout
s that have been previously created with this context have to be update usinglayoutContextChanged
.
createLayout :: GlibString string => string -> Render PangoLayout Source #
Create a PangoLayout
within a Render
context.
- This is a convenience function that creates a new
PangoContext
within thisRender
context and creates a newPangoLayout
. If the transformation or target surface of theRender
context change,updateLayout
has to be called on this layout.
updateLayout :: PangoLayout -> Render () Source #
Propagate changed to the Render
context to a PangoLayout
.
- This is a convenience function that calls
updateContext
on the (private)PangoContext
of the given layout to propagate changes from theRender
context to thePangoContext
and then callslayoutContextChanged
on the layout. This function is necessary forcreateLayout
since a privatePangoContext
is created that is not visible to the user.
showGlyphString :: GlyphItem -> Render () Source #
Draw a glyph string.
- The origin of the glyphs (the left edge of the baseline) will be drawn at the current point of the cairo context.
showLayoutLine :: LayoutLine -> Render () Source #
Draw a LayoutLine
.
- The origin of the glyphs (the left edge of the baseline) will be drawn at the current point of the cairo context.
showLayout :: PangoLayout -> Render () Source #
Draw a PangoLayout
.
- The top-left corner of the
PangoLayout
will be drawn at the current point of the cairo context.
glyphStringPath :: GlyphItem -> Render () Source #
Add the extent of a glyph string to the current path.
- The origin of the glyphs (the left edge of the line) will be at the current point of the cairo context.
layoutLinePath :: LayoutLine -> Render () Source #
Add the extent of a layout line to the current path.
- The origin of the glyphs (the left edge of the line) will be at the current point of the cairo context.
layoutPath :: PangoLayout -> Render () Source #
Add the layout to the current path.
- Adds the top-left corner of the text to the current path. Afterwards,
the path position is at the bottom-right corner of the
PangoLayout
.