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 GlyphString
structure is used to store strings
of glyphs with geometry and visual attribute information.
The storage for the glyph information is owned
by the structure which simplifies memory management.
- newtype GlyphString = GlyphString (ManagedPtr GlyphString)
- newZeroGlyphString :: MonadIO m => m GlyphString
- noGlyphString :: Maybe GlyphString
- data GlyphStringCopyMethodInfo
- glyphStringCopy :: (HasCallStack, MonadIO m) => GlyphString -> m (Maybe GlyphString)
- data GlyphStringExtentsMethodInfo
- glyphStringExtents :: (HasCallStack, MonadIO m, IsFont a) => GlyphString -> a -> m (Rectangle, Rectangle)
- data GlyphStringExtentsRangeMethodInfo
- glyphStringExtentsRange :: (HasCallStack, MonadIO m, IsFont a) => GlyphString -> Int32 -> Int32 -> a -> m (Rectangle, Rectangle)
- data GlyphStringFreeMethodInfo
- glyphStringFree :: (HasCallStack, MonadIO m) => GlyphString -> m ()
- data GlyphStringGetLogicalWidthsMethodInfo
- glyphStringGetLogicalWidths :: (HasCallStack, MonadIO m) => GlyphString -> Text -> Int32 -> Int32 -> Ptr Int32 -> m ()
- data GlyphStringGetWidthMethodInfo
- glyphStringGetWidth :: (HasCallStack, MonadIO m) => GlyphString -> m Int32
- data GlyphStringIndexToXMethodInfo
- glyphStringIndexToX :: (HasCallStack, MonadIO m) => GlyphString -> Text -> Int32 -> Analysis -> Int32 -> Bool -> m Int32
- glyphStringNew :: (HasCallStack, MonadIO m) => m GlyphString
- data GlyphStringSetSizeMethodInfo
- glyphStringSetSize :: (HasCallStack, MonadIO m) => GlyphString -> Int32 -> m ()
- data GlyphStringXToIndexMethodInfo
- glyphStringXToIndex :: (HasCallStack, MonadIO m) => GlyphString -> Text -> Int32 -> Analysis -> Int32 -> m (Int32, Int32)
- getGlyphStringLogClusters :: MonadIO m => GlyphString -> m Int32
- glyphString_logClusters :: AttrLabelProxy "logClusters"
- setGlyphStringLogClusters :: MonadIO m => GlyphString -> Int32 -> m ()
- getGlyphStringNumGlyphs :: MonadIO m => GlyphString -> m Int32
- glyphString_numGlyphs :: AttrLabelProxy "numGlyphs"
- setGlyphStringNumGlyphs :: MonadIO m => GlyphString -> Int32 -> m ()
Exported types
newtype GlyphString Source #
newZeroGlyphString :: MonadIO m => m GlyphString Source #
Construct a GlyphString
struct initialized to zero.
Methods
copy
data GlyphStringCopyMethodInfo Source #
((~) * signature (m (Maybe GlyphString)), MonadIO m) => MethodInfo * GlyphStringCopyMethodInfo GlyphString signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> GlyphString |
|
-> m (Maybe GlyphString) | Returns: the newly allocated |
Copy a glyph string and associated storage.
extents
data GlyphStringExtentsMethodInfo Source #
((~) * signature (a -> m (Rectangle, Rectangle)), MonadIO m, IsFont a) => MethodInfo * GlyphStringExtentsMethodInfo GlyphString signature Source # | |
:: (HasCallStack, MonadIO m, IsFont a) | |
=> GlyphString |
|
-> a |
|
-> m (Rectangle, Rectangle) |
Compute the logical and ink extents of a glyph string. See the documentation
for fontGetGlyphExtents
for details about the interpretation
of the rectangles.
extentsRange
data GlyphStringExtentsRangeMethodInfo Source #
((~) * signature (Int32 -> Int32 -> a -> m (Rectangle, Rectangle)), MonadIO m, IsFont a) => MethodInfo * GlyphStringExtentsRangeMethodInfo GlyphString signature Source # | |
glyphStringExtentsRange Source #
:: (HasCallStack, MonadIO m, IsFont a) | |
=> GlyphString |
|
-> Int32 |
|
-> Int32 |
|
-> a |
|
-> m (Rectangle, Rectangle) |
Computes the extents of a sub-portion of a glyph string. The extents are relative to the start of the glyph string range (the origin of their coordinate system is at the start of the range, not at the start of the entire glyph string).
free
data GlyphStringFreeMethodInfo Source #
((~) * signature (m ()), MonadIO m) => MethodInfo * GlyphStringFreeMethodInfo GlyphString signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> GlyphString |
|
-> m () |
Free a glyph string and associated storage.
getLogicalWidths
data GlyphStringGetLogicalWidthsMethodInfo Source #
((~) * signature (Text -> Int32 -> Int32 -> Ptr Int32 -> m ()), MonadIO m) => MethodInfo * GlyphStringGetLogicalWidthsMethodInfo GlyphString signature Source # | |
glyphStringGetLogicalWidths Source #
:: (HasCallStack, MonadIO m) | |
=> GlyphString |
|
-> Text |
|
-> Int32 |
|
-> Int32 |
|
-> Ptr Int32 |
|
-> m () |
Given a GlyphString
resulting from shape
and the corresponding
text, determine the screen width corresponding to each character. When
multiple characters compose a single cluster, the width of the entire
cluster is divided equally among the characters.
See also glyphItemGetLogicalWidths
.
getWidth
data GlyphStringGetWidthMethodInfo Source #
((~) * signature (m Int32), MonadIO m) => MethodInfo * GlyphStringGetWidthMethodInfo GlyphString signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> GlyphString |
|
-> m Int32 | Returns: the logical width of the glyph string. |
Computes the logical width of the glyph string as can also be computed
using glyphStringExtents
. However, since this only computes the
width, it's much faster. This is in fact only a convenience function that
computes the sum of geometry.width for each glyph in the glyphs
.
Since: 1.14
indexToX
data GlyphStringIndexToXMethodInfo Source #
((~) * signature (Text -> Int32 -> Analysis -> Int32 -> Bool -> m Int32), MonadIO m) => MethodInfo * GlyphStringIndexToXMethodInfo GlyphString signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> GlyphString |
|
-> Text |
|
-> Int32 |
|
-> Analysis |
|
-> Int32 |
|
-> Bool |
|
-> m Int32 |
Converts from character position to x position. (X position is measured from the left edge of the run). Character positions are computed by dividing up each cluster into equal portions.
new
:: (HasCallStack, MonadIO m) | |
=> m GlyphString | Returns: the newly allocated |
Create a new GlyphString
.
setSize
data GlyphStringSetSizeMethodInfo Source #
((~) * signature (Int32 -> m ()), MonadIO m) => MethodInfo * GlyphStringSetSizeMethodInfo GlyphString signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> GlyphString |
|
-> Int32 |
|
-> m () |
Resize a glyph string to the given length.
xToIndex
data GlyphStringXToIndexMethodInfo Source #
((~) * signature (Text -> Int32 -> Analysis -> Int32 -> m (Int32, Int32)), MonadIO m) => MethodInfo * GlyphStringXToIndexMethodInfo GlyphString signature Source # | |
:: (HasCallStack, MonadIO m) | |
=> GlyphString |
|
-> Text |
|
-> Int32 |
|
-> Analysis |
|
-> Int32 |
|
-> m (Int32, Int32) |
Convert from x offset to character position. Character positions are computed by dividing up each cluster into equal portions. In scripts where positioning within a cluster is not allowed (such as Thai), the returned value may not be a valid cursor position; the caller must combine the result with the logical attributes for the text to compute the valid cursor position.
Properties
logClusters
getGlyphStringLogClusters :: MonadIO m => GlyphString -> m Int32 Source #
glyphString_logClusters :: AttrLabelProxy "logClusters" Source #
setGlyphStringLogClusters :: MonadIO m => GlyphString -> Int32 -> m () Source #
numGlyphs
getGlyphStringNumGlyphs :: MonadIO m => GlyphString -> m Int32 Source #
glyphString_numGlyphs :: AttrLabelProxy "numGlyphs" Source #
setGlyphStringNumGlyphs :: MonadIO m => GlyphString -> Int32 -> m () Source #