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

Contents

- Exported types
- Methods
  - applyAttrs
  - copy
  - free
  - letterSpace
  - split
- Properties
  - endXOffset
  - glyphs
  - item
  - startXOffset
  - yOffset

Description

A `PangoGlyphItem` is a pair of a `PangoItem` and the glyphs resulting from shaping the items text.

As an example of the usage of `PangoGlyphItem`, the results of shaping text with `PangoLayout` is a list of `PangoLayoutLine`, each of which contains a list of `PangoGlyphItem`.

Synopsis

- newtype GlyphItem = GlyphItem (ManagedPtr GlyphItem)
- newZeroGlyphItem :: MonadIO m => m GlyphItem
- glyphItemApplyAttrs :: (HasCallStack, MonadIO m) => GlyphItem -> Text -> AttrList -> m [GlyphItem]
- glyphItemCopy :: (HasCallStack, MonadIO m) => Maybe GlyphItem -> m (Maybe GlyphItem)
- glyphItemFree :: (HasCallStack, MonadIO m) => Maybe GlyphItem -> m ()
- glyphItemLetterSpace :: (HasCallStack, MonadIO m) => GlyphItem -> Text -> [LogAttr] -> Int32 -> m ()
- glyphItemSplit :: (HasCallStack, MonadIO m) => GlyphItem -> Text -> Int32 -> m (Maybe GlyphItem)
- getGlyphItemEndXOffset :: MonadIO m => GlyphItem -> m Int32
- setGlyphItemEndXOffset :: MonadIO m => GlyphItem -> Int32 -> m ()
- clearGlyphItemGlyphs :: MonadIO m => GlyphItem -> m ()
- getGlyphItemGlyphs :: MonadIO m => GlyphItem -> m (Maybe GlyphString)
- setGlyphItemGlyphs :: MonadIO m => GlyphItem -> Ptr GlyphString -> m ()
- clearGlyphItemItem :: MonadIO m => GlyphItem -> m ()
- getGlyphItemItem :: MonadIO m => GlyphItem -> m (Maybe Item)
- setGlyphItemItem :: MonadIO m => GlyphItem -> Ptr Item -> m ()
- getGlyphItemStartXOffset :: MonadIO m => GlyphItem -> m Int32
- setGlyphItemStartXOffset :: MonadIO m => GlyphItem -> Int32 -> m ()
- getGlyphItemYOffset :: MonadIO m => GlyphItem -> m Int32
- setGlyphItemYOffset :: MonadIO m => GlyphItem -> Int32 -> m ()

# Exported types

newtype GlyphItem Source #

Memory-managed wrapper type.

Constructors

GlyphItem (ManagedPtr GlyphItem) |

#### Instances

Instances details

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

newZeroGlyphItem :: MonadIO m => m GlyphItem Source #

Construct a `GlyphItem` struct initialized to zero.

# Methods

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

Expand

#### Methods

applyAttrs, copy, free, letterSpace, split.

#### Getters

None.

#### Setters

None.

## applyAttrs

glyphItemApplyAttrs Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> GlyphItem | `glyphItem`: a shaped item
-> Text | `text`: text that `list` applies to
-> AttrList | `list`: a `PangoAttrList`
-> m [GlyphItem] | Returns: a list of glyph items resulting from splitting `glyphItem`. Free the elements using `glyphItemFree`, the list using `g_slist_free()`.

Splits a shaped item (`PangoGlyphItem`) into multiple items based on an attribute list.

The idea is that if you have attributes that don't affect shaping, such as color or underline, to avoid affecting shaping, you filter them out (`attrListFilter`), apply the shaping process and then reapply them to the result using this function.

All attributes that start or end inside a cluster are applied to that cluster; for instance, if half of a cluster is underlined and the other-half strikethrough, then the cluster will end up with both underline and strikethrough attributes. In these cases, it may happen that `item`->extra_attrs for some of the result items can have multiple attributes of the same type.

This function takes ownership of `glyphItem`; it will be reused as one of the elements in the list.

Since: 1.2

## copy

glyphItemCopy Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe GlyphItem | `orig`: a `PangoGlyphItem`
-> m (Maybe GlyphItem) | Returns: the newly allocated `PangoGlyphItem`

Make a deep copy of an existing `PangoGlyphItem` structure.

Since: 1.20

## free

glyphItemFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe GlyphItem | `glyphItem`: a `PangoGlyphItem`
-> m () |

Frees a `PangoGlyphItem` and resources to which it points.

Since: 1.6

## letterSpace

glyphItemLetterSpace Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> GlyphItem | `glyphItem`: a `PangoGlyphItem`
-> Text | `text`: text that `glyphItem` corresponds to (glyph_item->item->offset is an offset from the start of `text`)
-> [LogAttr] | `logAttrs`: logical attributes for the item (the first logical attribute refers to the position before the first character in the item)
-> Int32 | `letterSpacing`: amount of letter spacing to add in Pango units. May be negative, though too large negative values will give ugly results.
-> m () |

Adds spacing between the graphemes of `glyphItem` to give the effect of typographic letter spacing.

Since: 1.6

## split

glyphItemSplit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> GlyphItem | `orig`: a `PangoItem`
-> Text | `text`: text to which positions in `orig` apply
-> Int32 | `splitIndex`: byte index of position to split item, relative to the start of the item
-> m (Maybe GlyphItem) | Returns: the newly allocated item representing text before `splitIndex`, which should be freed with `glyphItemFree`.

Modifies `orig` to cover only the text after `splitIndex`, and returns a new item that covers the text before `splitIndex` that used to be in `orig`.

You can think of `splitIndex` as the length of the returned item. `splitIndex` may not be 0, and it may not be greater than or equal to the length of `orig` (that is, there must be at least one byte assigned to each item, you can't create a zero-length item).

This function is similar in function to `itemSplit` (and uses it internally.)

Since: 1.2

# Properties

## endXOffset

horizontal displacement to apply after th glyph item. Positive values shift right

getGlyphItemEndXOffset :: MonadIO m => GlyphItem -> m Int32 Source #

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

    get glyphItem #endXOffset

setGlyphItemEndXOffset :: MonadIO m => GlyphItem -> Int32 -> m () Source #

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

    set glyphItem [ #endXOffset := value ]

## glyphs

corresponding `PangoGlyphString`

clearGlyphItemGlyphs :: MonadIO m => GlyphItem -> m () Source #

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

    clear #glyphs

getGlyphItemGlyphs :: MonadIO m => GlyphItem -> m (Maybe GlyphString) Source #

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

    get glyphItem #glyphs

setGlyphItemGlyphs :: MonadIO m => GlyphItem -> Ptr GlyphString -> m () Source #

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

    set glyphItem [ #glyphs := value ]

## item

corresponding `PangoItem`

clearGlyphItemItem :: MonadIO m => GlyphItem -> m () Source #

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

    clear #item

getGlyphItemItem :: MonadIO m => GlyphItem -> m (Maybe Item) Source #

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

    get glyphItem #item

setGlyphItemItem :: MonadIO m => GlyphItem -> Ptr Item -> m () Source #

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

    set glyphItem [ #item := value ]

## startXOffset

horizontal displacement to apply before the glyph item. Positive values shift right

getGlyphItemStartXOffset :: MonadIO m => GlyphItem -> m Int32 Source #

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

    get glyphItem #startXOffset

setGlyphItemStartXOffset :: MonadIO m => GlyphItem -> Int32 -> m () Source #

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

    set glyphItem [ #startXOffset := value ]

## yOffset

shift of the baseline, relative to the baseline of the containing line. Positive values shift upwards

getGlyphItemYOffset :: MonadIO m => GlyphItem -> m Int32 Source #

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

    get glyphItem #yOffset

setGlyphItemYOffset :: MonadIO m => GlyphItem -> Int32 -> m () Source #

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

    set glyphItem [ #yOffset := value ]