Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
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
- newtype LayoutLine = LayoutLine (ManagedPtr LayoutLine)
- newZeroLayoutLine :: MonadIO m => m LayoutLine
- noLayoutLine :: Maybe LayoutLine
- layoutLineGetExtents :: (HasCallStack, MonadIO m) => LayoutLine -> m (Rectangle, Rectangle)
- layoutLineGetPixelExtents :: (HasCallStack, MonadIO m) => LayoutLine -> m (Rectangle, Rectangle)
- layoutLineGetXRanges :: (HasCallStack, MonadIO m) => LayoutLine -> Int32 -> Int32 -> m [Int32]
- layoutLineIndexToX :: (HasCallStack, MonadIO m) => LayoutLine -> Int32 -> Bool -> m Int32
- layoutLineRef :: (HasCallStack, MonadIO m) => LayoutLine -> m LayoutLine
- layoutLineUnref :: (HasCallStack, MonadIO m) => LayoutLine -> m ()
- layoutLineXToIndex :: (HasCallStack, MonadIO m) => LayoutLine -> Int32 -> m (Bool, Int32, Int32)
- getLayoutLineIsParagraphStart :: MonadIO m => LayoutLine -> m Word32
- setLayoutLineIsParagraphStart :: MonadIO m => LayoutLine -> Word32 -> m ()
- clearLayoutLineLayout :: MonadIO m => LayoutLine -> m ()
- getLayoutLineLayout :: MonadIO m => LayoutLine -> m (Maybe Layout)
- setLayoutLineLayout :: MonadIO m => LayoutLine -> Ptr Layout -> m ()
- getLayoutLineLength :: MonadIO m => LayoutLine -> m Int32
- setLayoutLineLength :: MonadIO m => LayoutLine -> Int32 -> m ()
- getLayoutLineResolvedDir :: MonadIO m => LayoutLine -> m Word32
- setLayoutLineResolvedDir :: MonadIO m => LayoutLine -> Word32 -> m ()
- clearLayoutLineRuns :: MonadIO m => LayoutLine -> m ()
- getLayoutLineRuns :: MonadIO m => LayoutLine -> m [GlyphItem]
- setLayoutLineRuns :: MonadIO m => LayoutLine -> Ptr (GSList (Ptr GlyphItem)) -> m ()
- getLayoutLineStartIndex :: MonadIO m => LayoutLine -> m Int32
- setLayoutLineStartIndex :: MonadIO m => LayoutLine -> Int32 -> m ()
Exported types
newtype LayoutLine Source #
Memory-managed wrapper type.
Instances
BoxedObject LayoutLine Source # | |
Defined in GI.Pango.Structs.LayoutLine boxedType :: LayoutLine -> IO GType # | |
tag ~ AttrSet => Constructible LayoutLine tag Source # | |
Defined in GI.Pango.Structs.LayoutLine new :: MonadIO m => (ManagedPtr LayoutLine -> LayoutLine) -> [AttrOp LayoutLine tag] -> m LayoutLine # |
newZeroLayoutLine :: MonadIO m => m LayoutLine Source #
Construct a LayoutLine
struct initialized to zero.
noLayoutLine :: Maybe LayoutLine Source #
A convenience alias for Nothing
:: Maybe
LayoutLine
.
Methods
getExtents
:: (HasCallStack, MonadIO m) | |
=> 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 #
:: (HasCallStack, MonadIO m) | |
=> 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
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> Int32 |
|
-> Int32 |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> Int32 |
|
-> Bool |
|
-> m Int32 |
Converts an index within a line to a X position.
ref
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> m LayoutLine | Returns: the line passed in. |
Increase the reference count of a LayoutLine
by one.
Since: 1.10
unref
:: (HasCallStack, MonadIO m) | |
=> 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
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> Int32 |
|
-> m (Bool, Int32, Int32) |
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 ]