Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GI.PangoCairo.Functions
Contents
Description
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 #
Arguments
:: (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 [funcupdateContext
].
Since: 1.10
contextGetResolution
Arguments
:: (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. |
contextSetFontOptions
contextSetFontOptions Source #
Arguments
:: (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 [funcupdateContext
]
derives from the target surface.
Since: 1.10
contextSetResolution
Arguments
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the resolution for the context.
This is a scale factor between points specified in a PangoFontDescription
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 #
Arguments
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Maybe ShapeRendererFunc |
|
-> m () |
Sets callback function for context to use for rendering attributes
of type AttrTypeShape
.
See PangoCairoShapeRendererFunc
for details.
Since: 1.18
createContext
Arguments
:: (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 PangoContext
directly, you can use [funccreateLayout
] instead.
Since: 1.22
createLayout
Arguments
:: (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
[funcshowLayout
]. If you change the transformation or target
surface for cr
, you need to call [funcupdateLayout
].
This function is the most convenient way to use Cairo with Pango,
however it is slightly inefficient since it creates a separate
PangoContext
object for each layout. This might matter in an
application that was laying out large amounts of text.
Since: 1.10
errorUnderlinePath
Arguments
:: (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
Arguments
:: (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
Arguments
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> LayoutLine |
|
-> m () |
Adds the text in PangoLayoutLine
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
Arguments
:: (HasCallStack, MonadIO m, IsLayout a) | |
=> Context |
|
-> a |
|
-> m () |
Adds the text in a PangoLayout
to the current path in the
specified cairo context.
The top-left corner of the PangoLayout
will be at the
current point of the cairo context.
Since: 1.10
showErrorUnderline
Arguments
:: (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
Arguments
:: (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 [funcshowGlyphString
].
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 glyph_item->item->offset
.
Since: 1.22
showGlyphString
Arguments
:: (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
Arguments
:: (HasCallStack, MonadIO m, IsLayout a) | |
=> Context |
|
-> a |
|
-> m () |
Draws a PangoLayout
in the specified cairo context.
The top-left corner of the PangoLayout
will be drawn
at the current point of the cairo context.
Since: 1.10
showLayoutLine
Arguments
:: (HasCallStack, MonadIO m) | |
=> Context |
|
-> LayoutLine |
|
-> m () |
Draws a PangoLayoutLine
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
Arguments
:: (HasCallStack, MonadIO m, IsContext a) | |
=> Context |
|
-> a |
|
-> m () |
Updates a PangoContext
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
Arguments
:: (HasCallStack, MonadIO m, IsLayout a) | |
=> Context |
|
-> a |
|
-> m () |
Updates the private PangoContext
of a PangoLayout
created with
[funccreateLayout
] to match the current transformation and target
surface of a Cairo context.
Since: 1.10