gi-pango-1.0.25: Pango bindings
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellSafe-Inferred
LanguageHaskell2010

GI.Pango.Structs.LayoutLine

Description

A PangoLayoutLine represents one of the lines resulting from laying out a paragraph via PangoLayout.

PangoLayoutLine structures are obtained by calling layoutGetLine and are only valid until the text, attributes, or settings of the parent PangoLayout are modified.

Synopsis

Exported types

newtype LayoutLine Source #

Memory-managed wrapper type.

newZeroLayoutLine :: MonadIO m => m LayoutLine Source #

Construct a LayoutLine struct initialized to zero.

Methods

Click to display all available methods, including inherited ones

Expand

Methods

indexToX, isParagraphStart, ref, unref, xToIndex.

Getters

getExtents, getHeight, getLength, getPixelExtents, getResolvedDirection, getStartIndex, getXRanges.

Setters

None.

getExtents

layoutLineGetExtents Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> m (Rectangle, Rectangle) 

Computes the logical and ink extents of a layout line.

See fontGetGlyphExtents for details about the interpretation of the rectangles.

getHeight

layoutLineGetHeight Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> m Int32 

Computes the height of the line, as the maximum of the heights of fonts used in this line.

Note that the actual baseline-to-baseline distance between lines of text is influenced by other factors, such as layoutSetSpacing and layoutSetLineSpacing.

Since: 1.44

getLength

layoutLineGetLength Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> m Int32

Returns: the length of the line

Returns the length of the line, in bytes.

Since: 1.50

getPixelExtents

layoutLineGetPixelExtents Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

layoutLine: a PangoLayoutLine

-> m (Rectangle, Rectangle) 

Computes the logical and ink extents of layoutLine in device units.

This function just calls layoutLineGetExtents followed by two [funcextentsToPixels] calls, rounding inkRect and logicalRect such that the rounded rectangles fully contain the unrounded one (that is, passes them as first argument to [funcextentsToPixels]).

getResolvedDirection

layoutLineGetResolvedDirection Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> m Direction

Returns: the resolved direction of the line

Returns the resolved direction of the line.

Since: 1.50

getStartIndex

layoutLineGetStartIndex Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> m Int32

Returns: the start index of the line

Returns the start index of the line, as byte index into the text of the layout.

Since: 1.50

getXRanges

layoutLineGetXRanges Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> Int32

startIndex: Start byte index of the logical range. If this value is less than the start index for the line, then the first range will extend all the way to the leading edge of the layout. Otherwise, it will start at the leading edge of the first character.

-> Int32

endIndex: Ending byte index of the logical range. If this value is greater than the end index for the line, then the last range will extend all the way to the trailing edge of the layout. Otherwise, it will end at the trailing edge of the last character.

-> m [Int32] 

Gets a list of visual ranges corresponding to a given logical range.

This list is not necessarily minimal - there may be consecutive ranges which are adjacent. The ranges will be sorted from left to right. The ranges are with respect to the left edge of the entire layout, not with respect to the line.

indexToX

layoutLineIndexToX Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> Int32

index_: byte offset of a grapheme within the layout

-> Bool

trailing: an integer indicating the edge of the grapheme to retrieve the position of. If > 0, the trailing edge of the grapheme, if 0, the leading of the grapheme

-> m Int32 

Converts an index within a line to a X position.

isParagraphStart

layoutLineIsParagraphStart Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> m Bool

Returns: True if this is the first line

Returns whether this is the first line of the paragraph.

Since: 1.50

ref

layoutLineRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> m LayoutLine

Returns: the line passed in.

Increase the reference count of a PangoLayoutLine by one.

Since: 1.10

unref

layoutLineUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> m () 

Decrease the reference count of a PangoLayoutLine by one.

If the result is zero, the line and all associated memory will be freed.

xToIndex

layoutLineXToIndex Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a PangoLayoutLine

-> Int32

xPos: the X offset (in Pango units) from the left edge of the line.

-> m (Bool, Int32, Int32)

Returns: False if xPos was outside the line, True if inside

Converts from x offset to the byte index of the corresponding character within the text of the layout.

If xPos is outside the line, index_ and trailing will point to the very first or very last position in the line. This determination is based on the resolved direction of the paragraph; for example, if the resolved direction is right-to-left, then an X position to the right of the line (after it) results in 0 being stored in index_ and trailing. An X position to the left of the line results in index_ pointing to the (logical) last grapheme in the line and trailing being set to the number of characters in that grapheme. The reverse is true for a left-to-right line.

Properties

isParagraphStart

TRUE if this is the first line of the paragraph

getLayoutLineIsParagraphStart :: MonadIO m => LayoutLine -> m Word32 Source #

Get the value of the “is_paragraph_start” field. When overloading is enabled, this is equivalent to

get layoutLine #isParagraphStart

setLayoutLineIsParagraphStart :: MonadIO m => LayoutLine -> Word32 -> m () Source #

Set the value of the “is_paragraph_start” field. When overloading is enabled, this is equivalent to

set layoutLine [ #isParagraphStart := value ]

layout

the layout this line belongs to, might be Nothing

clearLayoutLineLayout :: MonadIO m => LayoutLine -> m () Source #

Set the value of the “layout” field to Nothing. When overloading is enabled, this is equivalent to

clear #layout

getLayoutLineLayout :: MonadIO m => LayoutLine -> m (Maybe Layout) Source #

Get the value of the “layout” field. When overloading is enabled, this is equivalent to

get layoutLine #layout

setLayoutLineLayout :: MonadIO m => LayoutLine -> Ptr Layout -> m () Source #

Set the value of the “layout” field. When overloading is enabled, this is equivalent to

set layoutLine [ #layout := value ]

length

length of line in bytes

getLayoutLineLength :: MonadIO m => LayoutLine -> m Int32 Source #

Get the value of the “length” field. When overloading is enabled, this is equivalent to

get layoutLine #length

setLayoutLineLength :: MonadIO m => LayoutLine -> Int32 -> m () Source #

Set the value of the “length” field. When overloading is enabled, this is equivalent to

set layoutLine [ #length := value ]

resolvedDir

Resolved PangoDirection of line

getLayoutLineResolvedDir :: MonadIO m => LayoutLine -> m Word32 Source #

Get the value of the “resolved_dir” field. When overloading is enabled, this is equivalent to

get layoutLine #resolvedDir

setLayoutLineResolvedDir :: MonadIO m => LayoutLine -> Word32 -> m () Source #

Set the value of the “resolved_dir” field. When overloading is enabled, this is equivalent to

set layoutLine [ #resolvedDir := value ]

runs

list of runs in the line, from left to right

clearLayoutLineRuns :: MonadIO m => LayoutLine -> m () Source #

Set the value of the “runs” field to Nothing. When overloading is enabled, this is equivalent to

clear #runs

getLayoutLineRuns :: MonadIO m => LayoutLine -> m [GlyphItem] Source #

Get the value of the “runs” field. When overloading is enabled, this is equivalent to

get layoutLine #runs

setLayoutLineRuns :: MonadIO m => LayoutLine -> Ptr (GSList (Ptr GlyphItem)) -> m () Source #

Set the value of the “runs” field. When overloading is enabled, this is equivalent to

set layoutLine [ #runs := value ]

startIndex

start of line as byte index into layout->text

getLayoutLineStartIndex :: MonadIO m => LayoutLine -> m Int32 Source #

Get the value of the “start_index” field. When overloading is enabled, this is equivalent to

get layoutLine #startIndex

setLayoutLineStartIndex :: MonadIO m => LayoutLine -> Int32 -> m () Source #

Set the value of the “start_index” field. When overloading is enabled, this is equivalent to

set layoutLine [ #startIndex := value ]