gi-pango-1.0.19: Pango bindings

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

GI.Pango.Functions

Contents

- Methods
  - attrBackgroundAlphaNew
  - attrBackgroundNew
  - attrFallbackNew
  - attrFamilyNew
  - attrForegroundAlphaNew
  - attrForegroundNew
  - attrGravityHintNew
  - attrGravityNew
  - attrLetterSpacingNew
  - attrRiseNew
  - attrScaleNew
  - attrStretchNew
  - attrStrikethroughColorNew
  - attrStrikethroughNew
  - attrStyleNew
  - attrUnderlineColorNew
  - attrUnderlineNew
  - attrVariantNew
  - attrWeightNew
  - break
  - configKeyGet
  - configKeyGetSystem
  - defaultBreak
  - extentsToPixels
  - findBaseDir
  - findParagraphBoundary
  - getLibSubdirectory
  - getLogAttrs
  - getMirrorChar
  - getSysconfSubdirectory
  - isZeroWidth
  - itemize
  - itemizeWithBaseDir
  - log2visGetEmbeddingLevels
  - lookupAliases
  - markupParserFinish
  - markupParserNew
  - moduleRegister
  - parseEnum
  - parseMarkup
  - quantizeLineGeometry
  - readLine
  - reorderItems
  - scanInt
  - scanString
  - scanWord
  - shape
  - shapeFull
  - skipSpace
  - splitFileList
  - trimString
  - unicharDirection
  - unitsFromDouble
  - unitsToDouble
  - version
  - versionCheck
  - versionString

Description

Synopsis

- attrBackgroundAlphaNew :: (HasCallStack, MonadIO m) => Word16 -> m Attribute
- attrBackgroundNew :: (HasCallStack, MonadIO m) => Word16 -> Word16 -> Word16 -> m Attribute
- attrFallbackNew :: (HasCallStack, MonadIO m) => Bool -> m Attribute
- attrFamilyNew :: (HasCallStack, MonadIO m) => Text -> m Attribute
- attrForegroundAlphaNew :: (HasCallStack, MonadIO m) => Word16 -> m Attribute
- attrForegroundNew :: (HasCallStack, MonadIO m) => Word16 -> Word16 -> Word16 -> m Attribute
- attrGravityHintNew :: (HasCallStack, MonadIO m) => GravityHint -> m Attribute
- attrGravityNew :: (HasCallStack, MonadIO m) => Gravity -> m Attribute
- attrLetterSpacingNew :: (HasCallStack, MonadIO m) => Int32 -> m Attribute
- attrRiseNew :: (HasCallStack, MonadIO m) => Int32 -> m Attribute
- attrScaleNew :: (HasCallStack, MonadIO m) => Double -> m Attribute
- attrStretchNew :: (HasCallStack, MonadIO m) => Stretch -> m Attribute
- attrStrikethroughColorNew :: (HasCallStack, MonadIO m) => Word16 -> Word16 -> Word16 -> m Attribute
- attrStrikethroughNew :: (HasCallStack, MonadIO m) => Bool -> m Attribute
- attrStyleNew :: (HasCallStack, MonadIO m) => Style -> m Attribute
- attrUnderlineColorNew :: (HasCallStack, MonadIO m) => Word16 -> Word16 -> Word16 -> m Attribute
- attrUnderlineNew :: (HasCallStack, MonadIO m) => Underline -> m Attribute
- attrVariantNew :: (HasCallStack, MonadIO m) => Variant -> m Attribute
- attrWeightNew :: (HasCallStack, MonadIO m) => Weight -> m Attribute
- break :: (HasCallStack, MonadIO m) => Text -> Int32 -> Analysis -> [LogAttr] -> m ()
- configKeyGet :: (HasCallStack, MonadIO m) => Text -> m Text
- configKeyGetSystem :: (HasCallStack, MonadIO m) => Text -> m Text
- defaultBreak :: (HasCallStack, MonadIO m) => Text -> Int32 -> Maybe Analysis -> LogAttr -> Int32 -> m ()
- extentsToPixels :: (HasCallStack, MonadIO m) => Maybe Rectangle -> Maybe Rectangle -> m ()
- findBaseDir :: (HasCallStack, MonadIO m) => Text -> Int32 -> m Direction
- findParagraphBoundary :: (HasCallStack, MonadIO m) => Text -> Int32 -> m (Int32, Int32)
- getLibSubdirectory :: (HasCallStack, MonadIO m) => m Text
- getLogAttrs :: (HasCallStack, MonadIO m) => Text -> Int32 -> Int32 -> Language -> [LogAttr] -> m ()
- getMirrorChar :: (HasCallStack, MonadIO m) => Char -> Char -> m Bool
- getSysconfSubdirectory :: (HasCallStack, MonadIO m) => m Text
- isZeroWidth :: (HasCallStack, MonadIO m) => Char -> m Bool
- itemize :: (HasCallStack, MonadIO m, IsContext a) => a -> Text -> Int32 -> Int32 -> AttrList -> Maybe AttrIterator -> m [Item]
- itemizeWithBaseDir :: (HasCallStack, MonadIO m, IsContext a) => a -> Direction -> Text -> Int32 -> Int32 -> AttrList -> Maybe AttrIterator -> m [Item]
- log2visGetEmbeddingLevels :: (HasCallStack, MonadIO m) => Text -> Int32 -> Direction -> m Word8
- lookupAliases :: (HasCallStack, MonadIO m) => Text -> m [Text]
- markupParserFinish :: (HasCallStack, MonadIO m) => MarkupParseContext -> m (AttrList, Text, Char)
- markupParserNew :: (HasCallStack, MonadIO m) => Char -> m MarkupParseContext
- moduleRegister :: (HasCallStack, MonadIO m) => IncludedModule -> m ()
- parseEnum :: (HasCallStack, MonadIO m) => GType -> Maybe Text -> Bool -> m (Bool, Int32, Text)
- parseMarkup :: (HasCallStack, MonadIO m) => Text -> Int32 -> Char -> m (AttrList, Text, Char)
- quantizeLineGeometry :: (HasCallStack, MonadIO m) => Int32 -> Int32 -> m (Int32, Int32)
- readLine :: (HasCallStack, MonadIO m) => Ptr () -> m (Int32, String)
- reorderItems :: (HasCallStack, MonadIO m) => [Item] -> m [Item]
- scanInt :: (HasCallStack, MonadIO m) => Text -> m (Bool, Text, Int32)
- scanString :: (HasCallStack, MonadIO m) => Text -> m (Bool, Text, String)
- scanWord :: (HasCallStack, MonadIO m) => Text -> m (Bool, Text, String)
- shape :: (HasCallStack, MonadIO m) => Text -> Int32 -> Analysis -> GlyphString -> m ()
- shapeFull :: (HasCallStack, MonadIO m) => Text -> Int32 -> Maybe Text -> Int32 -> Analysis -> GlyphString -> m ()
- skipSpace :: (HasCallStack, MonadIO m) => Text -> m (Bool, Text)
- splitFileList :: (HasCallStack, MonadIO m) => Text -> m [Text]
- trimString :: (HasCallStack, MonadIO m) => Text -> m Text
- unicharDirection :: (HasCallStack, MonadIO m) => Char -> m Direction
- unitsFromDouble :: (HasCallStack, MonadIO m) => Double -> m Int32
- unitsToDouble :: (HasCallStack, MonadIO m) => Int32 -> m Double
- version :: (HasCallStack, MonadIO m) => m Int32
- versionCheck :: (HasCallStack, MonadIO m) => Int32 -> Int32 -> Int32 -> m (Maybe Text)
- versionString :: (HasCallStack, MonadIO m) => m Text

# Methods

## attrBackgroundAlphaNew

attrBackgroundAlphaNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Word16 | `alpha`: the alpha value, between 1 and 65536
-> m Attribute | Returns: the new allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new background alpha attribute.

Since: 1.38

## attrBackgroundNew

attrBackgroundNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Word16 | `red`: the red value (ranging from 0 to 65535)
-> Word16 | `green`: the green value
-> Word16 | `blue`: the blue value
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new background color attribute.

## attrFallbackNew

attrFallbackNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Bool | `enableFallback`: `True` if we should fall back on other fonts for characters the active font is missing.
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new font fallback attribute.

If fallback is disabled, characters will only be used from the closest matching font on the system. No fallback will be done to other fonts on the system that might contain the characters in the text.

Since: 1.4

## attrFamilyNew

attrFamilyNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `family`: the family or comma separated list of families
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new font family attribute.

## attrForegroundAlphaNew

attrForegroundAlphaNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Word16 | `alpha`: the alpha value, between 1 and 65536
-> m Attribute | Returns: the new allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new foreground alpha attribute.

Since: 1.38

## attrForegroundNew

attrForegroundNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Word16 | `red`: the red value (ranging from 0 to 65535)
-> Word16 | `green`: the green value
-> Word16 | `blue`: the blue value
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new foreground color attribute.

## attrGravityHintNew

attrGravityHintNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> GravityHint | `hint`: the gravity hint value.
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new gravity hint attribute.

Since: 1.16

## attrGravityNew

attrGravityNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Gravity | `gravity`: the gravity value; should not be `GravityAuto`.
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new gravity attribute.

Since: 1.16

## attrLetterSpacingNew

attrLetterSpacingNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Int32 | `letterSpacing`: amount of extra space to add between graphemes of the text, in Pango units.
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new letter-spacing attribute.

Since: 1.6

## attrRiseNew

attrRiseNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Int32 | `rise`: the amount that the text should be displaced vertically, in Pango units. Positive values displace the text upwards.
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new baseline displacement attribute.

## attrScaleNew

attrScaleNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Double | `scaleFactor`: factor to scale the font
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new font size scale attribute. The base font for the affected text will have its size multiplied by `scaleFactor`.

## attrStretchNew

attrStretchNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Stretch | `stretch`: the stretch
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new font stretch attribute

## attrStrikethroughColorNew

attrStrikethroughColorNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Word16 | `red`: the red value (ranging from 0 to 65535)
-> Word16 | `green`: the green value
-> Word16 | `blue`: the blue value
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new strikethrough color attribute. This attribute modifies the color of strikethrough lines. If not set, strikethrough lines will use the foreground color.

Since: 1.8

## attrStrikethroughNew

attrStrikethroughNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Bool | `strikethrough`: `True` if the text should be struck-through.
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new strike-through attribute.

## attrStyleNew

attrStyleNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Style | `style`: the slant style
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new font slant style attribute.

## attrUnderlineColorNew

attrUnderlineColorNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Word16 | `red`: the red value (ranging from 0 to 65535)
-> Word16 | `green`: the green value
-> Word16 | `blue`: the blue value
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new underline color attribute. This attribute modifies the color of underlines. If not set, underlines will use the foreground color.

Since: 1.8

## attrUnderlineNew

attrUnderlineNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Underline | `underline`: the underline style.
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new underline-style attribute.

## attrVariantNew

attrVariantNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Variant | `variant`: the variant
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new font variant attribute (normal or small caps)

## attrWeightNew

attrWeightNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Weight | `weight`: the weight
-> m Attribute | Returns: the newly allocated `Attribute`, which should be freed with `attributeDestroy`.

Create a new font weight attribute.

## break

break Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `text`: the text to process
-> Int32 | `length`: length of `text` in bytes (may be -1 if `text` is nul-terminated)
-> Analysis | `analysis`: `Analysis` structure from `itemize`
-> [LogAttr] | `attrs`: an array to store character information in
-> m () |

Determines possible line, word, and character breaks for a string of Unicode text with a single analysis. For most purposes you may want to use `getLogAttrs`.

## configKeyGet

configKeyGet Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `key`: Key to look up, in the form "SECTION/KEY".
-> m Text | Returns: `Nothing`

Deprecated: (Since version 1.38)

Do not use. Does not do anything.

## configKeyGetSystem

configKeyGetSystem Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `key`: Key to look up, in the form "SECTION/KEY".
-> m Text | Returns: `Nothing`

Deprecated: (Since version 1.38)

Do not use. Does not do anything.

## defaultBreak

defaultBreak Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `text`: text to break
-> Int32 | `length`: length of text in bytes (may be -1 if `text` is nul-terminated)
-> Maybe Analysis | `analysis`: a `Analysis` for the `text`
-> LogAttr | `attrs`: logical attributes to fill in
-> Int32 | `attrsLen`: size of the array passed as `attrs`
-> m () |

This is the default break algorithm, used if no language engine overrides it. Normally you should use `break` instead. Unlike `break`, `analysis` can be `Nothing`, but only do that if you know what you're doing. If you need an analysis to pass to `break`, you need to `itemize`. In most cases however you should simply use `getLogAttrs`.

## extentsToPixels

extentsToPixels Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe Rectangle | `inclusive`: rectangle to round to pixels inclusively, or `Nothing`.
-> Maybe Rectangle | `nearest`: rectangle to round to nearest pixels, or `Nothing`.
-> m () |

Converts extents from Pango units to device units, dividing by the `SCALE` factor and performing rounding.

The `inclusive` rectangle is converted by flooring the x/y coordinates and extending width/height, such that the final rectangle completely includes the original rectangle.

The `nearest` rectangle is converted by rounding the coordinates of the rectangle to the nearest device unit (pixel).

The rule to which argument to use is: if you want the resulting device-space rectangle to completely contain the original rectangle, pass it in as `inclusive`. If you want two touching-but-not-overlapping rectangles stay touching-but-not-overlapping after rounding to device units, pass them in as `nearest`.

Since: 1.16

## findBaseDir

findBaseDir Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `text`: the text to process
-> Int32 | `length`: length of `text` in bytes (may be -1 if `text` is nul-terminated)
-> m Direction | Returns: The direction corresponding to the first strong character. If no such character is found, then `DirectionNeutral` is returned.

Searches a string the first character that has a strong direction, according to the Unicode bidirectional algorithm.

Since: 1.4

## findParagraphBoundary

findParagraphBoundary Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `text`: UTF-8 text
-> Int32 | `length`: length of `text` in bytes, or -1 if nul-terminated
-> m (Int32, Int32) |

Locates a paragraph boundary in `text`. A boundary is caused by delimiter characters, such as a newline, carriage return, carriage return-newline pair, or Unicode paragraph separator character. The index of the run of delimiters is returned in `paragraphDelimiterIndex`. The index of the start of the paragraph (index after all delimiters) is stored in `nextParagraphStart`.

If no delimiters are found, both `paragraphDelimiterIndex` and `nextParagraphStart` are filled with the length of `text` (an index one off the end).

## getLibSubdirectory

getLibSubdirectory Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Text | Returns: the Pango lib directory. The returned string should not be freed.

Deprecated: (Since version 1.38)

Returns the name of the "pango" subdirectory of LIBDIR (which is set at compile time).

## getLogAttrs

getLogAttrs Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `text`: text to process
-> Int32 | `length`: length in bytes of `text`
-> Int32 | `level`: embedding level, or -1 if unknown
-> Language | `language`: language tag
-> [LogAttr] | `logAttrs`: array with one `LogAttr` per character in `text`, plus one extra, to be filled in
-> m () |

Computes a `LogAttr` for each character in `text`. The `logAttrs` array must have one `LogAttr` for each position in `text`; if `text` contains N characters, it has N+1 positions, including the last position at the end of the text. `text` should be an entire paragraph; logical attributes can't be computed without context (for example you need to see spaces on either side of a word to know the word is a word).

## getMirrorChar

getMirrorChar Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Char | `ch`: a Unicode character
-> Char | `mirroredCh`: location to store the mirrored character
-> m Bool | Returns: `True` if `ch` has a mirrored character and `mirroredCh` is filled in, `False` otherwise

If `ch` has the Unicode mirrored property and there is another Unicode character that typically has a glyph that is the mirror image of `ch`'s glyph, puts that character in the address pointed to by `mirroredCh`.

Use `unicharGetMirrorChar` instead; the docs for that function provide full details.

## getSysconfSubdirectory

getSysconfSubdirectory Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Text | Returns: the Pango sysconf directory. The returned string should not be freed.

Deprecated: (Since version 1.38)

Returns the name of the "pango" subdirectory of SYSCONFDIR (which is set at compile time).

## isZeroWidth

isZeroWidth Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Char | `ch`: a Unicode character
-> m Bool | Returns: `True` if `ch` is a zero-width character, `False` otherwise

Checks `ch` to see if it is a character that should not be normally rendered on the screen. This includes all Unicode characters with "ZERO WIDTH" in their name, as well as <firstterm>bidi</firstterm> formatting characters, and a few other ones. This is totally different from `unicharIszerowidth` and is at best misnamed.

Since: 1.10

## itemize

itemize Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) |
=> a | `context`: a structure holding information that affects the itemization process.
-> Text | `text`: the text to itemize.
-> Int32 | `startIndex`: first byte in `text` to process
-> Int32 | `length`: the number of bytes (not characters) to process after `startIndex`. This must be >= 0.
-> AttrList | `attrs`: the set of attributes that apply to `text`.
-> Maybe AttrIterator | `cachedIter`: Cached attribute iterator, or `Nothing`
-> m [Item] | Returns: a `List` of `Item` structures. The items should be freed using `itemFree` probably in combination with `g_list_foreach()`, and the list itself using `g_list_free()`.

Breaks a piece of text into segments with consistent directional level and shaping engine. Each byte of `text` will be contained in exactly one of the items in the returned list; the generated list of items will be in logical order (the start offsets of the items are ascending).

`cachedIter` should be an iterator over `attrs` currently positioned at a range before or containing `startIndex`; `cachedIter` will be advanced to the range covering the position just after `startIndex` + `length`. (i.e. if itemizing in a loop, just keep passing in the same `cachedIter`).

## itemizeWithBaseDir

itemizeWithBaseDir Source #

Arguments

:: (HasCallStack, MonadIO m, IsContext a) |
=> a | `context`: a structure holding information that affects the itemization process.
-> Direction | `baseDir`: base direction to use for bidirectional processing
-> Text | `text`: the text to itemize.
-> Int32 | `startIndex`: first byte in `text` to process
-> Int32 | `length`: the number of bytes (not characters) to process after `startIndex`. This must be >= 0.
-> AttrList | `attrs`: the set of attributes that apply to `text`.
-> Maybe AttrIterator | `cachedIter`: Cached attribute iterator, or `Nothing`
-> m [Item] | Returns: a `List` of `Item` structures. The items should be freed using `itemFree` probably in combination with `g_list_foreach()`, and the list itself using `g_list_free()`.

Like `itemize`, but the base direction to use when computing bidirectional levels (see pango_context_set_base_dir ()), is specified explicitly rather than gotten from the `Context`.

Since: 1.4

## log2visGetEmbeddingLevels

log2visGetEmbeddingLevels Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `text`: the text to itemize.
-> Int32 | `length`: the number of bytes (not characters) to process, or -1 if `text` is nul-terminated and the length should be calculated.
-> Direction | `pbaseDir`: input base direction, and output resolved direction.
-> m Word8 | Returns: a newly allocated array of embedding levels, one item per character (not byte), that should be freed using g_free.

This will return the bidirectional embedding levels of the input paragraph as defined by the Unicode Bidirectional Algorithm available at:

http://www.unicode.org/reports/tr9/

If the input base direction is a weak direction, the direction of the characters in the text will determine the final resolved direction.

Since: 1.4

## lookupAliases

lookupAliases Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `fontname`: an ascii string
-> m [Text] |

Deprecated: (Since version 1.32)This function is not thread-safe.

Look up all user defined aliases for the alias `fontname`. The resulting font family names will be stored in `families`, and the number of families in `nFamilies`.

## markupParserFinish

markupParserFinish Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> MarkupParseContext | `context`: A valid parse context that was returned from `markupParserNew`
-> m (AttrList, Text, Char) | (Can throw `GError`)

After feeding a pango markup parser some data with `markupParseContextParse`, use this function to get the list of pango attributes and text out of the markup. This function will not free `context`, use `markupParseContextFree` to do so.

Since: 1.31.0

## markupParserNew

markupParserNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Char | `accelMarker`: character that precedes an accelerator, or 0 for none
-> m MarkupParseContext | Returns: a `MarkupParseContext` that should be destroyed with `markupParseContextFree`.

Parses marked-up text (see <link linkend="PangoMarkupFormat">markup format</link>) to create a plain-text string and an attribute list.

If `accelMarker` is nonzero, the given character will mark the character following it as an accelerator. For example, `accelMarker` might be an ampersand or underscore. All characters marked as an accelerator will receive a `UnderlineLow` attribute, and the first character so marked will be returned in `accelChar`, when calling `finish()`. Two `accelMarker` characters following each other produce a single literal `accelMarker` character.

To feed markup to the parser, use `markupParseContextParse` on the returned `MarkupParseContext`. When done with feeding markup to the parser, use `markupParserFinish` to get the data out of it, and then use `markupParseContextFree` to free it.

This function is designed for applications that read pango markup from streams. To simply parse a string containing pango markup, the simpler `parseMarkup` API is recommended instead.

Since: 1.31.0

## moduleRegister

moduleRegister Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> IncludedModule | `module`: a `IncludedModule`
-> m () |

Deprecated: (Since version 1.38)

Do not use. Does not do anything.

## parseEnum

parseEnum Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> GType | `type`: enum type to parse, eg. `PANGO_TYPE_ELLIPSIZE_MODE`.
-> Maybe Text | `str`: string to parse. May be `Nothing`.
-> Bool | `warn`: if `True`, issue a `g_warning()` on bad input.
-> m (Bool, Int32, Text) | Returns: `True` if `str` was successfully parsed.

Deprecated: (Since version 1.38)

Parses an enum type and stores the result in `value`.

If `str` does not match the nick name of any of the possible values for the enum and is not an integer, `False` is returned, a warning is issued if `warn` is `True`, and a string representing the list of possible values is stored in `possibleValues`. The list is slash-separated, eg. "none/start/middle/end". If failed and `possibleValues` is not `Nothing`, returned string should be freed using `free`.

Since: 1.16

## parseMarkup

parseMarkup Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `markupText`: markup to parse (see <link linkend="PangoMarkupFormat">markup format</link>)
-> Int32 | `length`: length of `markupText`, or -1 if nul-terminated
-> Char | `accelMarker`: character that precedes an accelerator, or 0 for none
-> m (AttrList, Text, Char) | (Can throw `GError`)

Parses marked-up text (see <link linkend="PangoMarkupFormat">markup format</link>) to create a plain-text string and an attribute list.

If `accelMarker` is nonzero, the given character will mark the character following it as an accelerator. For example, `accelMarker` might be an ampersand or underscore. All characters marked as an accelerator will receive a `UnderlineLow` attribute, and the first character so marked will be returned in `accelChar`. Two `accelMarker` characters following each other produce a single literal `accelMarker` character.

To parse a stream of pango markup incrementally, use `markupParserNew`.

If any error happens, none of the output arguments are touched except for `error`.

## quantizeLineGeometry

quantizeLineGeometry Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Int32 | `thickness`: pointer to the thickness of a line, in Pango units
-> Int32 | `position`: corresponding position
-> m (Int32, Int32) |

Quantizes the thickness and position of a line, typically an underline or strikethrough, to whole device pixels, that is integer multiples of `SCALE`. The purpose of this function is to avoid such lines looking blurry.

Care is taken to make sure `thickness` is at least one pixel when this function returns, but returned `position` may become zero as a result of rounding.

Since: 1.12

## readLine

readLine Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ptr () | `stream`: a stdio stream
-> m (Int32, String) | Returns: 0 if the stream was already at an `EOF` character, otherwise the number of lines read (this is useful for maintaining a line number counter which doesn't combine lines with '\')

Deprecated: (Since version 1.38)

Reads an entire line from a file into a buffer. Lines may be delimited with '\n', '\r', '\n\r', or '\r\n'. The delimiter is not written into the buffer. Text after a '#' character is treated as a comment and skipped. '\' can be used to escape a # character. '\' proceeding a line delimiter combines adjacent lines. A '\' proceeding any other character is ignored and written into the output buffer unmodified.

## reorderItems

reorderItems Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> [Item] | `logicalItems`: a `List` of `Item` in logical order.
-> m [Item] | Returns: a `List` of `Item` structures in visual order. (Please open a bug if you use this function. It is not a particularly convenient interface, and the code is duplicated elsewhere in Pango for that reason.)

From a list of items in logical order and the associated directional levels, produce a list in visual order. The original list is unmodified.

## scanInt

scanInt Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `pos`: in/out string position
-> m (Bool, Text, Int32) | Returns: `False` if a parse error occurred.

Deprecated: (Since version 1.38)

Scans an integer. Leading white space is skipped.

## scanString

scanString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `pos`: in/out string position
-> m (Bool, Text, String) | Returns: `False` if a parse error occurred.

Deprecated: (Since version 1.38)

Scans a string into a `String` buffer. The string may either be a sequence of non-white-space characters, or a quoted string with '"'. Instead a quoted string, '\"' represents a literal quote. Leading white space outside of quotes is skipped.

## scanWord

scanWord Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `pos`: in/out string position
-> m (Bool, Text, String) | Returns: `False` if a parse error occurred.

Deprecated: (Since version 1.38)

Scans a word into a `String` buffer. A word consists of [A-Za-z_] followed by zero or more [A-Za-z_0-9] Leading white space is skipped.

## shape

shape Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `text`: the text to process
-> Int32 | `length`: the length (in bytes) of `text`
-> Analysis | `analysis`: `Analysis` structure from `itemize`
-> GlyphString | `glyphs`: glyph string in which to store results
-> m () |

Given a segment of text and the corresponding `Analysis` structure returned from `itemize`, convert the characters into glyphs. You may also pass in only a substring of the item from `itemize`.

It is recommended that you use `shapeFull` instead, since that API allows for shaping interaction happening across text item boundaries.

## shapeFull

shapeFull Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `itemText`: valid UTF-8 text to shape.
-> Int32 | `itemLength`: the length (in bytes) of `itemText`. -1 means nul-terminated text.
-> Maybe Text | `paragraphText`: text of the paragraph (see details). May be `Nothing`.
-> Int32 | `paragraphLength`: the length (in bytes) of `paragraphText`. -1 means nul-terminated text.
-> Analysis | `analysis`: `Analysis` structure from `itemize`.
-> GlyphString | `glyphs`: glyph string in which to store results.
-> m () |

Given a segment of text and the corresponding `Analysis` structure returned from `itemize`, convert the characters into glyphs. You may also pass in only a substring of the item from `itemize`.

This is similar to `shape`, except it also can optionally take the full paragraph text as input, which will then be used to perform certain cross-item shaping interactions. If you have access to the broader text of which `itemText` is part of, provide the broader text as `paragraphText`. If `paragraphText` is `Nothing`, item text is used instead.

Since: 1.32

## skipSpace

skipSpace Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `pos`: in/out string position
-> m (Bool, Text) | Returns: `False` if skipping the white space leaves the position at a '\0' character.

Deprecated: (Since version 1.38)

Skips 0 or more characters of white space.

## splitFileList

splitFileList Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `str`: a `SEARCHPATH_SEPARATOR` separated list of filenames
-> m [Text] | Returns: a list of strings to be freed with `strfreev`

Deprecated: (Since version 1.38)

Splits a `SEARCHPATH_SEPARATOR`-separated list of files, stripping white space and substituting ~/ with $HOME/.

## trimString

trimString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `str`: a string
-> m Text | Returns: A newly-allocated string that must be freed with `free`

Deprecated: (Since version 1.38)

Trims leading and trailing whitespace from a string.

## unicharDirection

unicharDirection Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Char | `ch`: a Unicode character
-> m Direction | Returns: the direction of the character.

Determines the inherent direction of a character; either `DirectionLtr`, `DirectionRtl`, or `DirectionNeutral`.

This function is useful to categorize characters into left-to-right letters, right-to-left letters, and everything else. If full Unicode bidirectional type of a character is needed, `bidiTypeForUnichar` can be used instead.

## unitsFromDouble

unitsFromDouble Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Double | `d`: double floating-point value
-> m Int32 | Returns: the value in Pango units.

Converts a floating-point number to Pango units: multiplies it by `SCALE` and rounds to nearest integer.

Since: 1.16

## unitsToDouble

unitsToDouble Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Int32 | `i`: value in Pango units
-> m Double | Returns: the double value.

Converts a number in Pango units to floating-point: divides it by `SCALE`.

Since: 1.16

## version

version Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Int32 | Returns: The encoded version of Pango library available at run time.

This is similar to the macro `PANGO_VERSION` except that it returns the encoded version of Pango available at run-time, as opposed to the version available at compile-time.

A version number can be encoded into an integer using `PANGO_VERSION_ENCODE()`.

Since: 1.16

## versionCheck

versionCheck Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Int32 | `requiredMajor`: the required major version.
-> Int32 | `requiredMinor`: the required minor version.
-> Int32 | `requiredMicro`: the required major version.
-> m (Maybe Text) | Returns: `Nothing` if the Pango library is compatible with the given version, or a string describing the version mismatch. The returned string is owned by Pango and should not be modified or freed.

Checks that the Pango library in use is compatible with the given version. Generally you would pass in the constants `PANGO_VERSION_MAJOR`, `PANGO_VERSION_MINOR`, `PANGO_VERSION_MICRO` as the three arguments to this function; that produces a check that the library in use at run-time is compatible with the version of Pango the application or module was compiled against.

Compatibility is defined by two things: first the version of the running library is newer than the version `requiredMajor`.required_minor.`requiredMicro`. Second the running library must be binary compatible with the version `requiredMajor`.required_minor.`requiredMicro` (same major version.)

For compile-time version checking use `PANGO_VERSION_CHECK()`.

Since: 1.16

## versionString

versionString Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Text | Returns: A string containing the version of Pango library available at run time. The returned string is owned by Pango and should not be modified or freed.

This is similar to the macro `PANGO_VERSION_STRING` except that it returns the version of Pango available at run-time, as opposed to the version available at compile-time.

Since: 1.16