gi-pango-1.0.18: Pango bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Pango.Structs.LayoutLine

Contents

Description

The LayoutLine structure represents one of the lines resulting from laying out a paragraph via Layout. LayoutLine structures are obtained by calling layoutGetLine and are only valid until the text, attributes, or settings of the parent Layout are modified.

Routines for rendering PangoLayout objects are provided in code specific to each rendering system.

Synopsis

Exported types

newtype LayoutLine Source #

Memory-managed wrapper type.

Instances
BoxedObject LayoutLine Source # 
Instance details

Defined in GI.Pango.Structs.LayoutLine

tag ~ AttrSet => Constructible LayoutLine tag Source # 
Instance details

Defined in GI.Pango.Structs.LayoutLine

newZeroLayoutLine :: MonadIO m => m LayoutLine Source #

Construct a LayoutLine struct initialized to zero.

Methods

getExtents

layoutLineGetExtents Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a LayoutLine

-> m (Rectangle, Rectangle) 

Computes the logical and ink extents of a layout line. See fontGetGlyphExtents for details about the interpretation of the rectangles.

getPixelExtents

layoutLineGetPixelExtents Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

layoutLine: a LayoutLine

-> m (Rectangle, Rectangle) 

Computes the logical and ink extents of layoutLine in device units. This function just calls layoutLineGetExtents followed by two extentsToPixels calls, rounding inkRect and logicalRect such that the rounded rectangles fully contain the unrounded one (that is, passes them as first argument to extentsToPixels).

getXRanges

layoutLineGetXRanges Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a LayoutLine

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

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

ref

layoutLineRef Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a LayoutLine, may be Nothing

-> m LayoutLine

Returns: the line passed in.

Increase the reference count of a LayoutLine by one.

Since: 1.10

unref

layoutLineUnref Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> LayoutLine

line: a LayoutLine

-> m () 

Decrease the reference count of a LayoutLine 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 LayoutLine

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