Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- contextGetFontOptions :: (HasCallStack, MonadIO m, IsContext a) => a -> m (Maybe FontOptions)
- contextGetResolution :: (HasCallStack, MonadIO m, IsContext a) => a -> m Double
- contextSetFontOptions :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe FontOptions -> m ()
- contextSetResolution :: (HasCallStack, MonadIO m, IsContext a) => a -> Double -> m ()
- contextSetShapeRenderer :: (HasCallStack, MonadIO m, IsContext a) => a -> Maybe ShapeRendererFunc -> m ()
- createContext :: (HasCallStack, MonadIO m) => Context -> m Context
- createLayout :: (HasCallStack, MonadIO m) => Context -> m Layout
- errorUnderlinePath :: (HasCallStack, MonadIO m) => Context -> Double -> Double -> Double -> Double -> m ()
- glyphStringPath :: (HasCallStack, MonadIO m, IsFont a) => Context -> a -> GlyphString -> m ()
- layoutLinePath :: (HasCallStack, MonadIO m) => Context -> LayoutLine -> m ()
- layoutPath :: (HasCallStack, MonadIO m, IsLayout a) => Context -> a -> m ()
- showErrorUnderline :: (HasCallStack, MonadIO m) => Context -> Double -> Double -> Double -> Double -> m ()
- showGlyphItem :: (HasCallStack, MonadIO m) => Context -> Text -> GlyphItem -> m ()
- showGlyphString :: (HasCallStack, MonadIO m, IsFont a) => Context -> a -> GlyphString -> m ()
- showLayout :: (HasCallStack, MonadIO m, IsLayout a) => Context -> a -> m ()
- showLayoutLine :: (HasCallStack, MonadIO m) => Context -> LayoutLine -> m ()
- updateContext :: (HasCallStack, MonadIO m, IsContext a) => Context -> a -> m ()
- updateLayout :: (HasCallStack, MonadIO m, IsLayout a) => Context -> a -> m ()
Methods
contextGetFontOptions
contextGetFontOptions Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m (Maybe FontOptions) | Returns: the font options previously set on the
context, or |
Retrieves any font rendering options previously set with
contextSetFontOptions
. This function does not report options
that are derived from the target surface by updateContext
Since: 1.10
contextGetResolution
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> m Double | Returns: the resolution in "dots per inch". A negative value will be returned if no resolution has previously been set. |
Gets the resolution for the context. See contextSetResolution
Since: 1.10
contextSetFontOptions
contextSetFontOptions Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Maybe FontOptions |
|
-> m () |
Sets the font options used when rendering text with this context.
These options override any options that updateContext
derives from the target surface.
Since: 1.10
contextSetResolution
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the resolution for the context. This is a scale factor between
points specified in a FontDescription
and Cairo units. The
default value is 96, meaning that a 10 point font will be 13
units high. (10 * 96. / 72. = 13.3).
Since: 1.10
contextSetShapeRenderer
contextSetShapeRenderer Source #
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Maybe ShapeRendererFunc |
|
-> m () |
Sets callback function for context to use for rendering attributes
of type AttrTypeShape
. See ShapeRendererFunc
for
details.
Since: 1.18
createContext
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> m Context | Returns: the newly created |
Creates a context object set up to match the current transformation
and target surface of the Cairo context. This context can then be
used to create a layout using layoutNew
.
This function is a convenience function that creates a context using
the default font map, then updates it to cr
. If you just need to
create a layout for use with cr
and do not need to access Context
directly, you can use createLayout
instead.
Since: 1.22
createLayout
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> m Layout | Returns: the newly created |
Creates a layout object set up to match the current transformation
and target surface of the Cairo context. This layout can then be
used for text measurement with functions like
layoutGetSize
or drawing with functions like
showLayout
. If you change the transformation
or target surface for cr
, you need to call updateLayout
This function is the most convenient way to use Cairo with Pango,
however it is slightly inefficient since it creates a separate
Context
object for each layout. This might matter in an
application that was laying out large amounts of text.
Since: 1.10
errorUnderlinePath
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> m () |
Add a squiggly line to the current path in the specified cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error. (The width of the underline is rounded to an integer number of up/down segments and the resulting rectangle is centered in the original rectangle)
Since: 1.14
glyphStringPath
:: (HasCallStack, MonadIO m, IsFont a) | |
=> Context |
|
-> a | |
-> GlyphString |
|
-> m () |
Adds the glyphs in glyphs
to the current path in the specified
cairo context. The origin of the glyphs (the left edge of the baseline)
will be at the current point of the cairo context.
Since: 1.10
layoutLinePath
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> LayoutLine |
|
-> m () |
Adds the text in LayoutLine
to the current path in the
specified cairo context. The origin of the glyphs (the left edge
of the line) will be at the current point of the cairo context.
Since: 1.10
layoutPath
:: (HasCallStack, MonadIO m, IsLayout a) | |
=> Context |
|
-> a |
|
-> m () |
showErrorUnderline
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> Double |
|
-> m () |
Draw a squiggly line in the specified cairo context that approximately covers the given rectangle in the style of an underline used to indicate a spelling error. (The width of the underline is rounded to an integer number of up/down segments and the resulting rectangle is centered in the original rectangle)
Since: 1.14
showGlyphItem
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> Text |
|
-> GlyphItem |
|
-> m () |
Draws the glyphs in glyphItem
in the specified cairo context,
embedding the text associated with the glyphs in the output if the
output format supports it (PDF for example), otherwise it acts
similar to showGlyphString
.
The origin of the glyphs (the left edge of the baseline) will be drawn at the current point of the cairo context.
Note that text
is the start of the text for layout, which is then
indexed by <literal>glyphItem
->item->offset</literal>.
Since: 1.22
showGlyphString
:: (HasCallStack, MonadIO m, IsFont a) | |
=> Context |
|
-> a | |
-> GlyphString |
|
-> m () |
Draws the glyphs in glyphs
in the specified cairo context.
The origin of the glyphs (the left edge of the baseline) will
be drawn at the current point of the cairo context.
Since: 1.10
showLayout
:: (HasCallStack, MonadIO m, IsLayout a) | |
=> Context |
|
-> a |
|
-> m () |
showLayoutLine
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> LayoutLine |
|
-> m () |
Draws a LayoutLine
in the specified cairo context.
The origin of the glyphs (the left edge of the line) will
be drawn at the current point of the cairo context.
Since: 1.10
updateContext
:: (HasCallStack, MonadIO m, IsContext a) | |
=> Context |
|
-> a |
|
-> m () |
Updates a Context
previously created for use with Cairo to
match the current transformation and target surface of a Cairo
context. If any layouts have been created for the context,
it's necessary to call layoutContextChanged
on those
layouts.
Since: 1.10
updateLayout
:: (HasCallStack, MonadIO m, IsLayout a) | |
=> Context |
|
-> a |
|
-> m () |
Updates the private Context
of a Layout
created with
createLayout
to match the current transformation
and target surface of a Cairo context.
Since: 1.10