gi-pango-1.0.30: Pango bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Pango.Structs.LayoutIter

Contents

- Exported types
- Methods
  - atLastLine
  - copy
  - free
  - getBaseline
  - getCharExtents
  - getClusterExtents
  - getIndex
  - getLayout
  - getLayoutExtents
  - getLine
  - getLineExtents
  - getLineReadonly
  - getLineYrange
  - getRun
  - getRunBaseline
  - getRunExtents
  - getRunReadonly
  - nextChar
  - nextCluster
  - nextLine
  - nextRun

Description

A `PangoLayoutIter` can be used to iterate over the visual extents of a `PangoLayout`.

To obtain a `PangoLayoutIter`, use `layoutGetIter`.

The `PangoLayoutIter` structure is opaque, and has no user-visible fields.

Synopsis

- newtype LayoutIter = LayoutIter (ManagedPtr LayoutIter)
- layoutIterAtLastLine :: (HasCallStack, MonadIO m) => LayoutIter -> m Bool
- layoutIterCopy :: (HasCallStack, MonadIO m) => Maybe LayoutIter -> m (Maybe LayoutIter)
- layoutIterFree :: (HasCallStack, MonadIO m) => Maybe LayoutIter -> m ()
- layoutIterGetBaseline :: (HasCallStack, MonadIO m) => LayoutIter -> m Int32
- layoutIterGetCharExtents :: (HasCallStack, MonadIO m) => LayoutIter -> m Rectangle
- layoutIterGetClusterExtents :: (HasCallStack, MonadIO m) => LayoutIter -> m (Rectangle, Rectangle)
- layoutIterGetIndex :: (HasCallStack, MonadIO m) => LayoutIter -> m Int32
- layoutIterGetLayout :: (HasCallStack, MonadIO m) => LayoutIter -> m (Maybe Layout)
- layoutIterGetLayoutExtents :: (HasCallStack, MonadIO m) => LayoutIter -> m (Rectangle, Rectangle)
- layoutIterGetLine :: (HasCallStack, MonadIO m) => LayoutIter -> m (Maybe LayoutLine)
- layoutIterGetLineExtents :: (HasCallStack, MonadIO m) => LayoutIter -> m (Rectangle, Rectangle)
- layoutIterGetLineReadonly :: (HasCallStack, MonadIO m) => LayoutIter -> m (Maybe LayoutLine)
- layoutIterGetLineYrange :: (HasCallStack, MonadIO m) => LayoutIter -> m (Int32, Int32)
- layoutIterGetRun :: (HasCallStack, MonadIO m) => LayoutIter -> m (Maybe GlyphItem)
- layoutIterGetRunBaseline :: (HasCallStack, MonadIO m) => LayoutIter -> m Int32
- layoutIterGetRunExtents :: (HasCallStack, MonadIO m) => LayoutIter -> m (Rectangle, Rectangle)
- layoutIterGetRunReadonly :: (HasCallStack, MonadIO m) => LayoutIter -> m (Maybe GlyphItem)
- layoutIterNextChar :: (HasCallStack, MonadIO m) => LayoutIter -> m Bool
- layoutIterNextCluster :: (HasCallStack, MonadIO m) => LayoutIter -> m Bool
- layoutIterNextLine :: (HasCallStack, MonadIO m) => LayoutIter -> m Bool
- layoutIterNextRun :: (HasCallStack, MonadIO m) => LayoutIter -> m Bool

# Exported types

newtype LayoutIter Source #

Memory-managed wrapper type.

Constructors

LayoutIter (ManagedPtr LayoutIter) |

#### Instances

Instances details

Eq LayoutIter Source # |
Instance details Defined in GI.Pango.Structs.LayoutIter Methods (==) :: LayoutIter -> LayoutIter -> Bool Source # (/=) :: LayoutIter -> LayoutIter -> Bool Source #
GBoxed LayoutIter Source # |
Instance details Defined in GI.Pango.Structs.LayoutIter
ManagedPtrNewtype LayoutIter Source # |
Instance details Defined in GI.Pango.Structs.LayoutIter Methods toManagedPtr :: LayoutIter -> ManagedPtr LayoutIter Source #
TypedObject LayoutIter Source # |
Instance details Defined in GI.Pango.Structs.LayoutIter Methods glibType :: IO GType Source #
HasParentTypes LayoutIter Source # |
Instance details Defined in GI.Pango.Structs.LayoutIter
IsGValue (Maybe LayoutIter) Source # | Convert `LayoutIter` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Pango.Structs.LayoutIter Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe LayoutIter -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe LayoutIter) Source #
type ParentTypes LayoutIter Source # |
Instance details Defined in GI.Pango.Structs.LayoutIter type ParentTypes LayoutIter = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

atLastLine, copy, free, nextChar, nextCluster, nextLine, nextRun.

#### Getters

getBaseline, getCharExtents, getClusterExtents, getIndex, getLayout, getLayoutExtents, getLine, getLineExtents, getLineReadonly, getLineYrange, getRun, getRunBaseline, getRunExtents, getRunReadonly.

#### Setters

None.

## atLastLine

layoutIterAtLastLine Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Bool | Returns: `True` if `iter` is on the last line

Determines whether `iter` is on the last line of the layout.

## copy

layoutIterCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Maybe LayoutIter) | Returns: the newly allocated `PangoLayoutIter`

Copies a `PangoLayoutIter`.

Since: 1.20

## free

layoutIterFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe LayoutIter | `iter`: a `PangoLayoutIter`, may be `Nothing`
-> m () |

Frees an iterator that's no longer in use.

## getBaseline

layoutIterGetBaseline Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Int32 | Returns: baseline of current line

Gets the Y position of the current line's baseline, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

## getCharExtents

layoutIterGetCharExtents Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Rectangle |

Gets the extents of the current character, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

Only logical extents can sensibly be obtained for characters; ink extents make sense only down to the level of clusters.

## getClusterExtents

layoutIterGetClusterExtents Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Rectangle, Rectangle) |

Gets the extents of the current cluster, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

## getIndex

layoutIterGetIndex Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Int32 | Returns: current byte index

Gets the current byte index.

Note that iterating forward by char moves in visual order, not logical order, so indexes may not be sequential. Also, the index may be equal to the length of the text in the layout, if on the `Nothing` run (see `layoutIterGetRun`).

## getLayout

layoutIterGetLayout Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Maybe Layout) | Returns: the layout associated with `iter`

Gets the layout associated with a `PangoLayoutIter`.

Since: 1.20

## getLayoutExtents

layoutIterGetLayoutExtents Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Rectangle, Rectangle) |

Obtains the extents of the `PangoLayout` being iterated over.

## getLine

layoutIterGetLine Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Maybe LayoutLine) | Returns: the current line

Gets the current line.

Use the faster `layoutIterGetLineReadonly` if you do not plan to modify the contents of the line (glyphs, glyph widths, etc.).

## getLineExtents

layoutIterGetLineExtents Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Rectangle, Rectangle) |

Obtains the extents of the current line.

Extents are in layout coordinates (origin is the top-left corner of the entire `PangoLayout`). Thus the extents returned by this function will be the same width/height but not at the same x/y as the extents returned from `layoutLineGetExtents`.

## getLineReadonly

layoutIterGetLineReadonly Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Maybe LayoutLine) | Returns: the current line, that should not be modified

Gets the current line for read-only access.

This is a faster alternative to `layoutIterGetLine`, but the user is not expected to modify the contents of the line (glyphs, glyph widths, etc.).

Since: 1.16

## getLineYrange

layoutIterGetLineYrange Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Int32, Int32) |

Divides the vertical space in the `PangoLayout` being iterated over between the lines in the layout, and returns the space belonging to the current line.

A line's range includes the line's logical extents. plus half of the spacing above and below the line, if `layoutSetSpacing` has been called to set layout spacing. The Y positions are in layout coordinates (origin at top left of the entire layout).

Note: Since 1.44, Pango uses line heights for placing lines, and there may be gaps between the ranges returned by this function.

## getRun

layoutIterGetRun Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Maybe GlyphItem) | Returns: the current run

Gets the current run.

When iterating by run, at the end of each line, there's a position with a `Nothing` run, so this function can return `Nothing`. The `Nothing` run at the end of each line ensures that all lines have at least one run, even lines consisting of only a newline.

Use the faster `layoutIterGetRunReadonly` if you do not plan to modify the contents of the run (glyphs, glyph widths, etc.).

## getRunBaseline

layoutIterGetRunBaseline Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Int32 |

Gets the Y position of the current run's baseline, in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

The run baseline can be different from the line baseline, for example due to superscript or subscript positioning.

Since: 1.50

## getRunExtents

layoutIterGetRunExtents Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Rectangle, Rectangle) |

Gets the extents of the current run in layout coordinates.

Layout coordinates have the origin at the top left of the entire layout.

## getRunReadonly

layoutIterGetRunReadonly Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m (Maybe GlyphItem) | Returns: the current run, that should not be modified

Gets the current run for read-only access.

When iterating by run, at the end of each line, there's a position with a `Nothing` run, so this function can return `Nothing`. The `Nothing` run at the end of each line ensures that all lines have at least one run, even lines consisting of only a newline.

This is a faster alternative to `layoutIterGetRun`, but the user is not expected to modify the contents of the run (glyphs, glyph widths, etc.).

Since: 1.16

## nextChar

layoutIterNextChar Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Bool | Returns: whether motion was possible

Moves `iter` forward to the next character in visual order.

If `iter` was already at the end of the layout, returns `False`.

## nextCluster

layoutIterNextCluster Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Bool | Returns: whether motion was possible

Moves `iter` forward to the next cluster in visual order.

If `iter` was already at the end of the layout, returns `False`.

## nextLine

layoutIterNextLine Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Bool | Returns: whether motion was possible

Moves `iter` forward to the start of the next line.

If `iter` is already on the last line, returns `False`.

## nextRun

layoutIterNextRun Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> LayoutIter | `iter`: a `PangoLayoutIter`
-> m Bool | Returns: whether motion was possible

Moves `iter` forward to the next run in visual order.

If `iter` was already at the end of the layout, returns `False`.