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 |
- Methods
- attrAllowBreaksNew
- attrBackgroundAlphaNew
- attrBackgroundNew
- attrBaselineShiftNew
- attrBreak
- attrFallbackNew
- attrFamilyNew
- attrFontScaleNew
- attrForegroundAlphaNew
- attrForegroundNew
- attrGravityHintNew
- attrGravityNew
- attrInsertHyphensNew
- attrLetterSpacingNew
- attrLineHeightNew
- attrLineHeightNewAbsolute
- attrOverlineColorNew
- attrOverlineNew
- attrRiseNew
- attrScaleNew
- attrSentenceNew
- attrShowNew
- attrStretchNew
- attrStrikethroughColorNew
- attrStrikethroughNew
- attrStyleNew
- attrTextTransformNew
- attrUnderlineColorNew
- attrUnderlineNew
- attrVariantNew
- attrWeightNew
- attrWordNew
- break
- defaultBreak
- extentsToPixels
- findBaseDir
- findParagraphBoundary
- getLogAttrs
- getMirrorChar
- isZeroWidth
- itemize
- itemizeWithBaseDir
- log2visGetEmbeddingLevels
- markupParserFinish
- markupParserNew
- parseEnum
- parseMarkup
- parseStretch
- parseStyle
- parseVariant
- parseWeight
- quantizeLineGeometry
- readLine
- reorderItems
- scanInt
- scanString
- scanWord
- shape
- shapeFull
- shapeItem
- shapeWithFlags
- skipSpace
- splitFileList
- tailorBreak
- trimString
- unicharDirection
- unitsFromDouble
- unitsToDouble
- version
- versionCheck
- versionString
Synopsis
- attrAllowBreaksNew :: (HasCallStack, MonadIO m) => Bool -> m Attribute
- attrBackgroundAlphaNew :: (HasCallStack, MonadIO m) => Word16 -> m Attribute
- attrBackgroundNew :: (HasCallStack, MonadIO m) => Word16 -> Word16 -> Word16 -> m Attribute
- attrBaselineShiftNew :: (HasCallStack, MonadIO m) => Int32 -> m Attribute
- attrBreak :: (HasCallStack, MonadIO m) => Text -> Int32 -> AttrList -> Int32 -> [LogAttr] -> m ()
- attrFallbackNew :: (HasCallStack, MonadIO m) => Bool -> m Attribute
- attrFamilyNew :: (HasCallStack, MonadIO m) => Text -> m Attribute
- attrFontScaleNew :: (HasCallStack, MonadIO m) => FontScale -> 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
- attrInsertHyphensNew :: (HasCallStack, MonadIO m) => Bool -> m Attribute
- attrLetterSpacingNew :: (HasCallStack, MonadIO m) => Int32 -> m Attribute
- attrLineHeightNew :: (HasCallStack, MonadIO m) => Double -> m Attribute
- attrLineHeightNewAbsolute :: (HasCallStack, MonadIO m) => Int32 -> m Attribute
- attrOverlineColorNew :: (HasCallStack, MonadIO m) => Word16 -> Word16 -> Word16 -> m Attribute
- attrOverlineNew :: (HasCallStack, MonadIO m) => Overline -> m Attribute
- attrRiseNew :: (HasCallStack, MonadIO m) => Int32 -> m Attribute
- attrScaleNew :: (HasCallStack, MonadIO m) => Double -> m Attribute
- attrSentenceNew :: (HasCallStack, MonadIO m) => m Attribute
- attrShowNew :: (HasCallStack, MonadIO m) => [ShowFlags] -> 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
- attrTextTransformNew :: (HasCallStack, MonadIO m) => TextTransform -> 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
- attrWordNew :: (HasCallStack, MonadIO m) => m Attribute
- break :: (HasCallStack, MonadIO m) => Text -> Int32 -> Analysis -> [LogAttr] -> m ()
- 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)
- getLogAttrs :: (HasCallStack, MonadIO m) => Text -> Int32 -> Int32 -> Language -> [LogAttr] -> m ()
- getMirrorChar :: (HasCallStack, MonadIO m) => Char -> Char -> m Bool
- 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
- markupParserFinish :: (HasCallStack, MonadIO m) => MarkupParseContext -> m (AttrList, Text, Char)
- markupParserNew :: (HasCallStack, MonadIO m) => Char -> m MarkupParseContext
- parseEnum :: (HasCallStack, MonadIO m) => GType -> Maybe Text -> Bool -> m (Bool, Int32, Text)
- parseMarkup :: (HasCallStack, MonadIO m) => Text -> Int32 -> Char -> m (AttrList, Text, Char)
- parseStretch :: (HasCallStack, MonadIO m) => Text -> Bool -> m (Bool, Stretch)
- parseStyle :: (HasCallStack, MonadIO m) => Text -> Bool -> m (Bool, Style)
- parseVariant :: (HasCallStack, MonadIO m) => Text -> Bool -> m (Bool, Variant)
- parseWeight :: (HasCallStack, MonadIO m) => Text -> Bool -> m (Bool, Weight)
- quantizeLineGeometry :: (HasCallStack, MonadIO m) => Int32 -> Int32 -> m (Int32, Int32)
- readLine :: (HasCallStack, MonadIO m) => Ptr () -> String -> m Int32
- reorderItems :: (HasCallStack, MonadIO m) => [Item] -> m [Item]
- scanInt :: (HasCallStack, MonadIO m) => Text -> m (Bool, Text, Int32)
- scanString :: (HasCallStack, MonadIO m) => Text -> String -> m (Bool, Text)
- scanWord :: (HasCallStack, MonadIO m) => Text -> String -> m (Bool, Text)
- shape :: (HasCallStack, MonadIO m) => Text -> Int32 -> Analysis -> GlyphString -> m ()
- shapeFull :: (HasCallStack, MonadIO m) => Text -> Int32 -> Maybe Text -> Int32 -> Analysis -> GlyphString -> m ()
- shapeItem :: (HasCallStack, MonadIO m) => Item -> Maybe Text -> Int32 -> Maybe LogAttr -> GlyphString -> [ShapeFlags] -> m ()
- shapeWithFlags :: (HasCallStack, MonadIO m) => Text -> Int32 -> Maybe Text -> Int32 -> Analysis -> GlyphString -> [ShapeFlags] -> m ()
- skipSpace :: (HasCallStack, MonadIO m) => Text -> m (Bool, Text)
- splitFileList :: (HasCallStack, MonadIO m) => Text -> m [Text]
- tailorBreak :: (HasCallStack, MonadIO m) => Text -> Int32 -> Analysis -> Int32 -> [LogAttr] -> m ()
- 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
attrAllowBreaksNew
:: (HasCallStack, MonadIO m) | |
=> Bool |
|
-> m Attribute | Returns: the newly allocated
|
Create a new allow-breaks attribute.
If breaks are disabled, the range will be kept in a single run, as far as possible.
Since: 1.44
attrBackgroundAlphaNew
attrBackgroundAlphaNew Source #
:: (HasCallStack, MonadIO m) | |
=> Word16 |
|
-> m Attribute | Returns: the newly allocated
|
Create a new background alpha attribute.
Since: 1.38
attrBackgroundNew
:: (HasCallStack, MonadIO m) | |
=> Word16 |
|
-> Word16 |
|
-> Word16 |
|
-> m Attribute | Returns: the newly allocated
|
Create a new background color attribute.
attrBaselineShiftNew
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> m Attribute | Returns: the newly allocated
|
Create a new baseline displacement attribute.
The effect of this attribute is to shift the baseline of a run, relative to the run of preceding run.
<picture> <source srcset="baseline-shift-dark.png" media="(prefers-color-scheme: dark)"> <img alt="Baseline Shift" src="baseline-shift-light.png"> </picture>
Since: 1.50
attrBreak
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> AttrList |
|
-> Int32 |
|
-> [LogAttr] |
|
-> m () |
Apply customization from attributes to the breaks in attrs
.
The line breaks are assumed to have been produced
by defaultBreak
and tailorBreak
.
Since: 1.50
attrFallbackNew
:: (HasCallStack, MonadIO m) | |
=> Bool |
|
-> m Attribute | Returns: the newly allocated
|
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
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Attribute | Returns: the newly allocated
|
Create a new font family attribute.
attrFontScaleNew
:: (HasCallStack, MonadIO m) | |
=> FontScale |
|
-> m Attribute | Returns: the newly allocated
|
Create a new font scale attribute.
The effect of this attribute is to change the font size of a run, relative to the size of preceding run.
Since: 1.50
attrForegroundAlphaNew
attrForegroundAlphaNew Source #
:: (HasCallStack, MonadIO m) | |
=> Word16 |
|
-> m Attribute | Returns: the newly allocated
|
Create a new foreground alpha attribute.
Since: 1.38
attrForegroundNew
:: (HasCallStack, MonadIO m) | |
=> Word16 |
|
-> Word16 |
|
-> Word16 |
|
-> m Attribute | Returns: the newly allocated
|
Create a new foreground color attribute.
attrGravityHintNew
:: (HasCallStack, MonadIO m) | |
=> GravityHint |
|
-> m Attribute | Returns: the newly allocated
|
Create a new gravity hint attribute.
Since: 1.16
attrGravityNew
:: (HasCallStack, MonadIO m) | |
=> Gravity |
|
-> m Attribute | Returns: the newly allocated
|
Create a new gravity attribute.
Since: 1.16
attrInsertHyphensNew
:: (HasCallStack, MonadIO m) | |
=> Bool |
|
-> m Attribute | Returns: the newly allocated
|
Create a new insert-hyphens attribute.
Pango will insert hyphens when breaking lines in the middle of a word. This attribute can be used to suppress the hyphen.
Since: 1.44
attrLetterSpacingNew
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> m Attribute | Returns: the newly allocated
|
Create a new letter-spacing attribute.
Since: 1.6
attrLineHeightNew
:: (HasCallStack, MonadIO m) | |
=> Double |
|
-> m Attribute |
Modify the height of logical line extents by a factor.
This affects the values returned by
layoutLineGetExtents
,
layoutLineGetPixelExtents
and
layoutIterGetLineExtents
.
Since: 1.50
attrLineHeightNewAbsolute
attrLineHeightNewAbsolute Source #
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> m Attribute |
Override the height of logical line extents to be height
.
This affects the values returned by
layoutLineGetExtents
,
layoutLineGetPixelExtents
and
layoutIterGetLineExtents
.
Since: 1.50
attrOverlineColorNew
:: (HasCallStack, MonadIO m) | |
=> Word16 |
|
-> Word16 |
|
-> Word16 |
|
-> m Attribute | Returns: the newly allocated
|
Create a new overline color attribute.
This attribute modifies the color of overlines. If not set, overlines will use the foreground color.
Since: 1.46
attrOverlineNew
:: (HasCallStack, MonadIO m) | |
=> Overline |
|
-> m Attribute | Returns: the newly allocated
|
Create a new overline-style attribute.
Since: 1.46
attrRiseNew
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> m Attribute | Returns: the newly allocated
|
Create a new baseline displacement attribute.
attrScaleNew
:: (HasCallStack, MonadIO m) | |
=> Double |
|
-> m Attribute | Returns: the newly allocated
|
Create a new font size scale attribute.
The base font for the affected text will have
its size multiplied by scaleFactor
.
attrSentenceNew
:: (HasCallStack, MonadIO m) | |
=> m Attribute | Returns: the newly allocated
|
Marks the range of the attribute as a single sentence.
Note that this may require adjustments to word and sentence classification around the range.
Since: 1.50
attrShowNew
:: (HasCallStack, MonadIO m) | |
=> [ShowFlags] |
|
-> m Attribute | Returns: the newly allocated
|
Create a new attribute that influences how invisible characters are rendered.
Since: 1.44
attrStretchNew
:: (HasCallStack, MonadIO m) | |
=> Stretch |
|
-> m Attribute | Returns: the newly allocated
|
Create a new font stretch attribute.
attrStrikethroughColorNew
attrStrikethroughColorNew Source #
:: (HasCallStack, MonadIO m) | |
=> Word16 |
|
-> Word16 |
|
-> Word16 |
|
-> m Attribute | Returns: the newly allocated
|
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
:: (HasCallStack, MonadIO m) | |
=> Bool |
|
-> m Attribute | Returns: the newly allocated
|
Create a new strike-through attribute.
attrStyleNew
:: (HasCallStack, MonadIO m) | |
=> Style |
|
-> m Attribute | Returns: the newly allocated
|
Create a new font slant style attribute.
attrTextTransformNew
:: (HasCallStack, MonadIO m) | |
=> TextTransform |
|
-> m Attribute | Returns: the newly allocated
|
Create a new attribute that influences how characters are transformed during shaping.
Since: 1.50
attrUnderlineColorNew
attrUnderlineColorNew Source #
:: (HasCallStack, MonadIO m) | |
=> Word16 |
|
-> Word16 |
|
-> Word16 |
|
-> m Attribute | Returns: the newly allocated
|
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
:: (HasCallStack, MonadIO m) | |
=> Underline |
|
-> m Attribute | Returns: the newly allocated
|
Create a new underline-style attribute.
attrVariantNew
:: (HasCallStack, MonadIO m) | |
=> Variant |
|
-> m Attribute | Returns: the newly allocated |
Create a new font variant attribute (normal or small caps).
attrWeightNew
:: (HasCallStack, MonadIO m) | |
=> Weight |
|
-> m Attribute | Returns: the newly allocated
|
Create a new font weight attribute.
attrWordNew
:: (HasCallStack, MonadIO m) | |
=> m Attribute | Returns: the newly allocated
|
Marks the range of the attribute as a single word.
Note that this may require adjustments to word and sentence classification around the range.
Since: 1.50
break
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Analysis |
|
-> [LogAttr] |
|
-> m () |
Deprecated: (Since version 1.44)Use defaultBreak
, tailorBreak
and attrBreak
.
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
.
defaultBreak
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Maybe Analysis |
|
-> LogAttr |
|
-> Int32 |
|
-> m () |
This is the default break algorithm.
It applies rules from the Unicode Line Breaking Algorithm
without language-specific tailoring, therefore the analyis
argument is unused
and can be Nothing
.
See tailorBreak
for language-specific breaks.
See attrBreak
for attribute-based customization.
extentsToPixels
:: (HasCallStack, MonadIO m) | |
=> Maybe Rectangle |
|
-> Maybe Rectangle |
|
-> m () |
Converts extents from Pango units to device units.
The conversion is done by 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
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> m Direction | Returns: The direction corresponding to the first strong character.
If no such character is found, then |
Searches a string the first character that has a strong direction, according to the Unicode bidirectional algorithm.
Since: 1.4
findParagraphBoundary
findParagraphBoundary Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> 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 paragrap (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).
getLogAttrs
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Int32 |
|
-> Language |
|
-> [LogAttr] |
|
-> m () |
Computes a PangoLogAttr
for each character in text
.
The attrs
array must have one PangoLogAttr
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
:: (HasCallStack, MonadIO m) | |
=> Char |
|
-> Char |
|
-> m Bool | Returns: |
Deprecated: (Since version 1.30)Use unicharGetMirrorChar
instead; the docs for that function provide full details.
Returns the mirrored character of a Unicode character.
Mirror characters are determined by the Unicode mirrored property.
isZeroWidth
:: (HasCallStack, MonadIO m) | |
=> Char |
|
-> m Bool | Returns: |
Checks if a character that should not be normally rendered.
This includes all Unicode characters with "ZERO WIDTH" in their name, as well as *bidi* formatting characters, and a few other ones.
This is totally different from unicharIszerowidth
and is at best misnamed.
Since: 1.10
itemize
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Text |
|
-> Int32 |
|
-> Int32 |
|
-> AttrList |
|
-> Maybe AttrIterator |
|
-> m [Item] | Returns: a |
Breaks a piece of text into segments with consistent directional level and font.
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
:: (HasCallStack, MonadIO m, IsContext a) | |
=> a |
|
-> Direction |
|
-> Text |
|
-> Int32 |
|
-> Int32 |
|
-> AttrList |
|
-> Maybe AttrIterator |
|
-> m [Item] | Returns: a |
Like pango_itemize()
, but with an explicitly specified base direction.
The base direction is used when computing bidirectional levels.
[funcitemize
] gets the base direction from the PangoContext
(see contextSetBaseDir
).
Since: 1.4
log2visGetEmbeddingLevels
log2visGetEmbeddingLevels Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Direction |
|
-> m Word8 | Returns: a newly allocated array of embedding levels, one item per
character (not byte), that should be freed using |
Return the bidirectional embedding levels of the input paragraph.
The bidirectional embedding levels are defined by the <http://www.unicode.org/reports/tr9/ Unicode Bidirectional Algorithm>.
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
markupParserFinish
:: (HasCallStack, MonadIO m) | |
=> MarkupParseContext |
|
-> m (AttrList, Text, Char) | (Can throw |
Finishes parsing markup.
After feeding a Pango markup parser some data with markupParseContextParse
,
use this function to get the list of attributes and text out of the
markup. This function will not free context
, use markupParseContextFree
to do so.
Since: 1.31.0
markupParserNew
:: (HasCallStack, MonadIO m) | |
=> Char |
|
-> m MarkupParseContext | Returns: a |
Incrementally parses marked-up text to create a plain-text string and an attribute list.
See the Pango Markup docs for details about the supported markup.
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 [funcmarkupParserFinish
]. Two accelMarker
characters
following each other produce a single literal accelMarker
character.
To feed markup to the parser, use markupParseContextParse
on the returned [structgLib
.MarkupParseContext]. When done with feeding markup
to the parser, use [funcmarkupParserFinish
] 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 parseMarkup
API is recommended instead.
Since: 1.31.0
parseEnum
:: (HasCallStack, MonadIO m) | |
=> GType |
|
-> Maybe Text |
|
-> Bool |
|
-> m (Bool, Int32, Text) | Returns: |
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
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Char |
|
-> m (AttrList, Text, Char) | (Can throw |
Parses marked-up text to create a plain-text string and an attribute list.
See the Pango Markup docs for details about the supported markup.
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 [funcmarkupParserNew
].
If any error happens, none of the output arguments are touched except
for error
.
parseStretch
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Bool |
|
-> m (Bool, Stretch) | Returns: |
Parses a font stretch.
The allowed values are "ultra_condensed", "extra_condensed", "condensed", "semi_condensed", "normal", "semi_expanded", "expanded", "extra_expanded" and "ultra_expanded". Case variations are ignored and the '_' characters may be omitted.
parseStyle
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Bool |
|
-> m (Bool, Style) | Returns: |
Parses a font style.
The allowed values are "normal", "italic" and "oblique", case variations being ignored.
parseVariant
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Bool |
|
-> m (Bool, Variant) | Returns: |
Parses a font variant.
The allowed values are "normal", "small-caps", "all-small-caps", "petite-caps", "all-petite-caps", "unicase" and "title-caps", case variations being ignored.
parseWeight
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Bool |
|
-> m (Bool, Weight) | Returns: |
Parses a font weight.
The allowed values are "heavy", "ultrabold", "bold", "normal", "light", "ultraleight" and integers. Case variations are ignored.
quantizeLineGeometry
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> Int32 |
|
-> m (Int32, Int32) |
Quantizes the thickness and position of a line to whole device pixels.
This is typically used for underline or strikethrough. 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
:: (HasCallStack, MonadIO m) | |
=> Ptr () |
|
-> String |
|
-> m Int32 | Returns: 0 if the stream was already at an |
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
:: (HasCallStack, MonadIO m) | |
=> [Item] |
|
-> m [Item] | Returns: a |
Reorder items from logical order to visual order.
The visual order is determined from the associated directional levels of the items. The original list is unmodified.
(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.)
scanInt
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Bool, Text, Int32) | Returns: |
Deprecated: (Since version 1.38)
Scans an integer.
Leading white space is skipped.
scanString
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> String |
|
-> m (Bool, Text) | Returns: |
Deprecated: (Since version 1.38)
Scans a string into a GString
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
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> String |
|
-> m (Bool, Text) | Returns: |
Deprecated: (Since version 1.38)
Scans a word into a GString
buffer.
A word consists of [A-Za-z_] followed by zero or more [A-Za-z_0-9]. Leading white space is skipped.
shape
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Analysis |
|
-> GlyphString |
|
-> m () |
Convert the characters in text
into glyphs.
Given a segment of text and the corresponding PangoAnalysis
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.
Note that the extra attributes in the analyis
that is returned from
itemize
have indices that are relative to the entire paragraph,
so you need to subtract the item offset from their indices before
calling shape
.
shapeFull
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Maybe Text |
|
-> Int32 |
|
-> Analysis |
|
-> GlyphString |
|
-> m () |
Convert the characters in text
into glyphs.
Given a segment of text and the corresponding PangoAnalysis
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.
Note that the extra attributes in the analyis
that is returned from
itemize
have indices that are relative to the entire paragraph,
so you do not pass the full paragraph text as paragraphText
, you need
to subtract the item offset from their indices before calling
shapeFull
.
Since: 1.32
shapeItem
:: (HasCallStack, MonadIO m) | |
=> Item |
|
-> Maybe Text |
|
-> Int32 |
|
-> Maybe LogAttr |
|
-> GlyphString |
|
-> [ShapeFlags] |
|
-> m () |
Convert the characters in item
into glyphs.
This is similar to shapeWithFlags
, except it takes a
PangoItem
instead of separate itemText
and analysis
arguments.
It also takes logAttrs
, which may be used in implementing text
transforms.
Note that the extra attributes in the analyis
that is returned from
itemize
have indices that are relative to the entire paragraph,
so you do not pass the full paragraph text as paragraphText
, you need
to subtract the item offset from their indices before calling
shapeWithFlags
.
Since: 1.50
shapeWithFlags
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Maybe Text |
|
-> Int32 |
|
-> Analysis |
|
-> GlyphString |
|
-> [ShapeFlags] |
|
-> m () |
Convert the characters in text
into glyphs.
Given a segment of text and the corresponding PangoAnalysis
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 shapeFull
, except it also takes flags
that can influence the shaping process.
Note that the extra attributes in the analyis
that is returned from
itemize
have indices that are relative to the entire paragraph,
so you do not pass the full paragraph text as paragraphText
, you need
to subtract the item offset from their indices before calling
shapeWithFlags
.
Since: 1.44
skipSpace
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m (Bool, Text) | Returns: |
Deprecated: (Since version 1.38)
Skips 0 or more characters of white space.
splitFileList
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m [Text] | Returns: a list of
strings to be freed with |
Deprecated: (Since version 1.38)
Splits a SEARCHPATH_SEPARATOR
-separated list of files, stripping
white space and substituting ~/ with $HOME/.
tailorBreak
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> Int32 |
|
-> Analysis |
|
-> Int32 |
|
-> [LogAttr] |
|
-> m () |
Apply language-specific tailoring to the breaks in attrs
.
The line breaks are assumed to have been produced by defaultBreak
.
If offset
is not -1, it is used to apply attributes from analysis
that are
relevant to line breaking.
Note that it is better to pass -1 for offset
and use attrBreak
to apply attributes to the whole paragraph.
Since: 1.44
trimString
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Text | Returns: A newly-allocated string that must be freed with |
Deprecated: (Since version 1.38)
Trims leading and trailing whitespace from a string.
unicharDirection
:: (HasCallStack, MonadIO m) | |
=> Char |
|
-> m Direction | Returns: the direction of the character. |
Determines the inherent direction of a character.
The inherent direction is either PANGO_DIRECTION_LTR
, PANGO_DIRECTION_RTL
,
or PANGO_DIRECTION_NEUTRAL
.
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, [funcpango
.BidiType.for_unichar]
can be used instead.
unitsFromDouble
:: (HasCallStack, MonadIO m) | |
=> Double |
|
-> m Int32 | Returns: the value in Pango units. |
Converts a floating-point number to Pango units.
The conversion is done by multiplying d
by SCALE
and
rounding the result to nearest integer.
Since: 1.16
unitsToDouble
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> m Double | Returns: the double value. |
Converts a number in Pango units to floating-point.
The conversion is done by dividing i
by SCALE
.
Since: 1.16
version
:: (HasCallStack, MonadIO m) | |
=> m Int32 | Returns: The encoded version of Pango library available at run time. |
Returns the encoded version of Pango available at run-time.
This is similar to the macro PANGO_VERSION
except that the macro
returns the encoded version available at compile-time. A version
number can be encoded into an integer using PANGO_VERSION_ENCODE()
.
Since: 1.16
versionCheck
:: (HasCallStack, MonadIO m) | |
=> Int32 |
|
-> Int32 |
|
-> Int32 |
|
-> m (Maybe Text) | Returns: |
Checks that the Pango library in use is compatible with the given version.
Generally you would pass in the constants VERSION_MAJOR
,
VERSION_MINOR
, 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
:: (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. |
Returns the version of Pango available at run-time.
This is similar to the macro VERSION_STRING
except that the
macro returns the version available at compile-time.
Since: 1.16