gi-pangocairo-1.0.30: PangoCairo bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.PangoCairo.Functions

Description

 
Synopsis

Methods

contextGetFontOptions

contextGetFontOptions Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a PangoContext, from a pangocairo font map

-> m (Maybe FontOptions)

Returns: the font options previously set on the context, or Nothing if no options have been set. This value is owned by the context and must not be modified or freed.

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

contextGetResolution Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a PangoContext, from a pangocairo font map

-> 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 #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a PangoContext, from a pangocairo font map

-> Maybe FontOptions

options: a cairo_font_options_t, or Nothing to unset any previously set options. A copy is made.

-> 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

contextSetResolution Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> a

context: a PangoContext, from a pangocairo font map

-> Double

dpi: the resolution in "dots per inch". (Physical inches aren't actually involved; the terminology is conventional.) A 0 or negative value means to use the resolution from the font map.

-> 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

context: a PangoContext, from a pangocairo font map

-> Maybe ShapeRendererFunc

func: Callback function for rendering attributes of type AttrTypeShape, or Nothing to disable shape rendering.

-> m () 

Sets callback function for context to use for rendering attributes of type AttrTypeShape.

See PangoCairoShapeRendererFunc for details.

Since: 1.18

createContext

createContext Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a Cairo context

-> m Context

Returns: the newly created PangoContext

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

createLayout Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a Cairo context

-> m Layout

Returns: the newly created PangoLayout

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

errorUnderlinePath Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a Cairo context

-> Double

x: The X coordinate of one corner of the rectangle

-> Double

y: The Y coordinate of one corner of the rectangle

-> Double

width: Non-negative width of the rectangle

-> Double

height: Non-negative height of the rectangle

-> 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

glyphStringPath Source #

Arguments

:: (HasCallStack, MonadIO m, IsFont a) 
=> Context

cr: a Cairo context

-> a

font: a PangoFont from a PangoCairoFontMap

-> GlyphString

glyphs: a PangoGlyphString

-> 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

layoutLinePath Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a Cairo context

-> LayoutLine

line: a PangoLayoutLine

-> 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

layoutPath Source #

Arguments

:: (HasCallStack, MonadIO m, IsLayout a) 
=> Context

cr: a Cairo context

-> a

layout: a Pango layout

-> 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

showErrorUnderline Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a Cairo context

-> Double

x: The X coordinate of one corner of the rectangle

-> Double

y: The Y coordinate of one corner of the rectangle

-> Double

width: Non-negative width of the rectangle

-> Double

height: Non-negative height of the rectangle

-> 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

showGlyphItem Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a Cairo context

-> Text

text: the UTF-8 text that glyphItem refers to

-> GlyphItem

glyphItem: a PangoGlyphItem

-> 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

showGlyphString Source #

Arguments

:: (HasCallStack, MonadIO m, IsFont a) 
=> Context

cr: a Cairo context

-> a

font: a PangoFont from a PangoCairoFontMap

-> GlyphString

glyphs: a PangoGlyphString

-> 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

showLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsLayout a) 
=> Context

cr: a Cairo context

-> a

layout: a Pango layout

-> 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

showLayoutLine Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Context

cr: a Cairo context

-> LayoutLine

line: a PangoLayoutLine

-> 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

updateContext Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) 
=> Context

cr: a Cairo context

-> a

context: a PangoContext, from a pangocairo font map

-> 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

updateLayout Source #

Arguments

:: (HasCallStack, MonadIO m, IsLayout a) 
=> Context

cr: a Cairo context

-> a

layout: a PangoLayout, from [funccreateLayout]

-> 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