Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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
- newtype LayoutLine = LayoutLine (ManagedPtr LayoutLine)
- newZeroLayoutLine :: MonadIO m => m LayoutLine
- layoutLineGetExtents :: (HasCallStack, MonadIO m) => LayoutLine -> m (Rectangle, Rectangle)
- layoutLineGetHeight :: (HasCallStack, MonadIO m) => LayoutLine -> m Int32
- layoutLineGetLength :: (HasCallStack, MonadIO m) => LayoutLine -> m Int32
- layoutLineGetPixelExtents :: (HasCallStack, MonadIO m) => LayoutLine -> m (Rectangle, Rectangle)
- layoutLineGetResolvedDirection :: (HasCallStack, MonadIO m) => LayoutLine -> m Direction
- layoutLineGetStartIndex :: (HasCallStack, MonadIO m) => LayoutLine -> m Int32
- layoutLineGetXRanges :: (HasCallStack, MonadIO m) => LayoutLine -> Int32 -> Int32 -> m [Int32]
- layoutLineIndexToX :: (HasCallStack, MonadIO m) => LayoutLine -> Int32 -> Bool -> m Int32
- layoutLineIsParagraphStart :: (HasCallStack, MonadIO m) => LayoutLine -> m Bool
- 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
Eq LayoutLine Source # | |
Defined in GI.Pango.Structs.LayoutLine (==) :: LayoutLine -> LayoutLine -> Bool # (/=) :: LayoutLine -> LayoutLine -> Bool # | |
GBoxed LayoutLine Source # | |
Defined in GI.Pango.Structs.LayoutLine | |
ManagedPtrNewtype LayoutLine Source # | |
Defined in GI.Pango.Structs.LayoutLine | |
TypedObject LayoutLine Source # | |
Defined in GI.Pango.Structs.LayoutLine | |
HasParentTypes LayoutLine Source # | |
Defined in GI.Pango.Structs.LayoutLine | |
tag ~ 'AttrSet => Constructible LayoutLine tag Source # | |
Defined in GI.Pango.Structs.LayoutLine new :: MonadIO m => (ManagedPtr LayoutLine -> LayoutLine) -> [AttrOp LayoutLine tag] -> m LayoutLine # | |
IsGValue (Maybe LayoutLine) Source # | Convert |
Defined in GI.Pango.Structs.LayoutLine gvalueGType_ :: IO GType # gvalueSet_ :: Ptr GValue -> Maybe LayoutLine -> IO () # gvalueGet_ :: Ptr GValue -> IO (Maybe LayoutLine) # | |
type ParentTypes LayoutLine Source # | |
Defined in GI.Pango.Structs.LayoutLine |
newZeroLayoutLine :: MonadIO m => m LayoutLine Source #
Construct a LayoutLine
struct initialized to zero.
Methods
Click to display all available methods, including inherited ones
Methods
indexToX, isParagraphStart, ref, unref, xToIndex.
Getters
getExtents, getHeight, getLength, getPixelExtents, getResolvedDirection, getStartIndex, getXRanges.
Setters
None.
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.
getHeight
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> m Int32 | Returns: the length of the line |
Returns the length of the line, in bytes.
Since: 1.50
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 [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 #
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> m Direction | Returns: the resolved direction of the line |
Returns the resolved direction of the line.
Since: 1.50
getStartIndex
layoutLineGetStartIndex Source #
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> 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
:: (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.
isParagraphStart
layoutLineIsParagraphStart Source #
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> m Bool | Returns: |
Returns whether this is the first line of the paragraph.
Since: 1.50
ref
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> m LayoutLine | Returns: the line passed in. |
Increase the reference count of a PangoLayoutLine
by one.
Since: 1.10
unref
:: (HasCallStack, MonadIO m) | |
=> LayoutLine |
|
-> 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
:: (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 ]