{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Structs.GlyphString
(
GlyphString(..) ,
newZeroGlyphString ,
#if defined(ENABLE_OVERLOADING)
ResolveGlyphStringMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
GlyphStringCopyMethodInfo ,
#endif
glyphStringCopy ,
#if defined(ENABLE_OVERLOADING)
GlyphStringExtentsMethodInfo ,
#endif
glyphStringExtents ,
#if defined(ENABLE_OVERLOADING)
GlyphStringExtentsRangeMethodInfo ,
#endif
glyphStringExtentsRange ,
#if defined(ENABLE_OVERLOADING)
GlyphStringFreeMethodInfo ,
#endif
glyphStringFree ,
#if defined(ENABLE_OVERLOADING)
GlyphStringGetLogicalWidthsMethodInfo ,
#endif
glyphStringGetLogicalWidths ,
#if defined(ENABLE_OVERLOADING)
GlyphStringGetWidthMethodInfo ,
#endif
glyphStringGetWidth ,
#if defined(ENABLE_OVERLOADING)
GlyphStringIndexToXMethodInfo ,
#endif
glyphStringIndexToX ,
#if defined(ENABLE_OVERLOADING)
GlyphStringIndexToXFullMethodInfo ,
#endif
glyphStringIndexToXFull ,
glyphStringNew ,
#if defined(ENABLE_OVERLOADING)
GlyphStringSetSizeMethodInfo ,
#endif
glyphStringSetSize ,
#if defined(ENABLE_OVERLOADING)
GlyphStringXToIndexMethodInfo ,
#endif
glyphStringXToIndex ,
getGlyphStringLogClusters ,
#if defined(ENABLE_OVERLOADING)
glyphString_logClusters ,
#endif
setGlyphStringLogClusters ,
getGlyphStringNumGlyphs ,
#if defined(ENABLE_OVERLOADING)
glyphString_numGlyphs ,
#endif
setGlyphStringNumGlyphs ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import {-# SOURCE #-} qualified GI.Pango.Objects.Font as Pango.Font
import {-# SOURCE #-} qualified GI.Pango.Structs.Analysis as Pango.Analysis
import {-# SOURCE #-} qualified GI.Pango.Structs.LogAttr as Pango.LogAttr
import {-# SOURCE #-} qualified GI.Pango.Structs.Rectangle as Pango.Rectangle
newtype GlyphString = GlyphString (SP.ManagedPtr GlyphString)
deriving (GlyphString -> GlyphString -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GlyphString -> GlyphString -> Bool
$c/= :: GlyphString -> GlyphString -> Bool
== :: GlyphString -> GlyphString -> Bool
$c== :: GlyphString -> GlyphString -> Bool
Eq)
instance SP.ManagedPtrNewtype GlyphString where
toManagedPtr :: GlyphString -> ManagedPtr GlyphString
toManagedPtr (GlyphString ManagedPtr GlyphString
p) = ManagedPtr GlyphString
p
foreign import ccall "pango_glyph_string_get_type" c_pango_glyph_string_get_type ::
IO GType
type instance O.ParentTypes GlyphString = '[]
instance O.HasParentTypes GlyphString
instance B.Types.TypedObject GlyphString where
glibType :: IO GType
glibType = IO GType
c_pango_glyph_string_get_type
instance B.Types.GBoxed GlyphString
instance B.GValue.IsGValue (Maybe GlyphString) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_pango_glyph_string_get_type
gvalueSet_ :: Ptr GValue -> Maybe GlyphString -> IO ()
gvalueSet_ Ptr GValue
gv Maybe GlyphString
P.Nothing = forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (forall a. Ptr a
FP.nullPtr :: FP.Ptr GlyphString)
gvalueSet_ Ptr GValue
gv (P.Just GlyphString
obj) = forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr GlyphString
obj (forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe GlyphString)
gvalueGet_ Ptr GValue
gv = do
Ptr GlyphString
ptr <- forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr GlyphString)
if Ptr GlyphString
ptr forall a. Eq a => a -> a -> Bool
/= forall a. Ptr a
FP.nullPtr
then forall a. a -> Maybe a
P.Just forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr GlyphString -> GlyphString
GlyphString Ptr GlyphString
ptr
else forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Maybe a
P.Nothing
newZeroGlyphString :: MonadIO m => m GlyphString
newZeroGlyphString :: forall (m :: * -> *). MonadIO m => m GlyphString
newZeroGlyphString = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
16 forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr GlyphString -> GlyphString
GlyphString
instance tag ~ 'AttrSet => Constructible GlyphString tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr GlyphString -> GlyphString)
-> [AttrOp GlyphString tag] -> m GlyphString
new ManagedPtr GlyphString -> GlyphString
_ [AttrOp GlyphString tag]
attrs = do
GlyphString
o <- forall (m :: * -> *). MonadIO m => m GlyphString
newZeroGlyphString
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set GlyphString
o [AttrOp GlyphString tag]
attrs
forall (m :: * -> *) a. Monad m => a -> m a
return GlyphString
o
getGlyphStringNumGlyphs :: MonadIO m => GlyphString -> m Int32
getGlyphStringNumGlyphs :: forall (m :: * -> *). MonadIO m => GlyphString -> m Int32
getGlyphStringNumGlyphs GlyphString
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr GlyphString
s forall a b. (a -> b) -> a -> b
$ \Ptr GlyphString
ptr -> do
Int32
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr GlyphString
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setGlyphStringNumGlyphs :: MonadIO m => GlyphString -> Int32 -> m ()
setGlyphStringNumGlyphs :: forall (m :: * -> *). MonadIO m => GlyphString -> Int32 -> m ()
setGlyphStringNumGlyphs GlyphString
s Int32
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr GlyphString
s forall a b. (a -> b) -> a -> b
$ \Ptr GlyphString
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr GlyphString
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data GlyphStringNumGlyphsFieldInfo
instance AttrInfo GlyphStringNumGlyphsFieldInfo where
type AttrBaseTypeConstraint GlyphStringNumGlyphsFieldInfo = (~) GlyphString
type AttrAllowedOps GlyphStringNumGlyphsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint GlyphStringNumGlyphsFieldInfo = (~) Int32
type AttrTransferTypeConstraint GlyphStringNumGlyphsFieldInfo = (~)Int32
type AttrTransferType GlyphStringNumGlyphsFieldInfo = Int32
type AttrGetType GlyphStringNumGlyphsFieldInfo = Int32
type AttrLabel GlyphStringNumGlyphsFieldInfo = "num_glyphs"
type AttrOrigin GlyphStringNumGlyphsFieldInfo = GlyphString
attrGet = getGlyphStringNumGlyphs
attrSet = setGlyphStringNumGlyphs
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.numGlyphs"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#g:attr:numGlyphs"
})
glyphString_numGlyphs :: AttrLabelProxy "numGlyphs"
glyphString_numGlyphs = AttrLabelProxy
#endif
getGlyphStringLogClusters :: MonadIO m => GlyphString -> m Int32
getGlyphStringLogClusters :: forall (m :: * -> *). MonadIO m => GlyphString -> m Int32
getGlyphStringLogClusters GlyphString
s = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr GlyphString
s forall a b. (a -> b) -> a -> b
$ \Ptr GlyphString
ptr -> do
Int32
val <- forall a. Storable a => Ptr a -> IO a
peek (Ptr GlyphString
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setGlyphStringLogClusters :: MonadIO m => GlyphString -> Int32 -> m ()
setGlyphStringLogClusters :: forall (m :: * -> *). MonadIO m => GlyphString -> Int32 -> m ()
setGlyphStringLogClusters GlyphString
s Int32
val = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr GlyphString
s forall a b. (a -> b) -> a -> b
$ \Ptr GlyphString
ptr -> do
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr GlyphString
ptr forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data GlyphStringLogClustersFieldInfo
instance AttrInfo GlyphStringLogClustersFieldInfo where
type AttrBaseTypeConstraint GlyphStringLogClustersFieldInfo = (~) GlyphString
type AttrAllowedOps GlyphStringLogClustersFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint GlyphStringLogClustersFieldInfo = (~) Int32
type AttrTransferTypeConstraint GlyphStringLogClustersFieldInfo = (~)Int32
type AttrTransferType GlyphStringLogClustersFieldInfo = Int32
type AttrGetType GlyphStringLogClustersFieldInfo = Int32
type AttrLabel GlyphStringLogClustersFieldInfo = "log_clusters"
type AttrOrigin GlyphStringLogClustersFieldInfo = GlyphString
attrGet = getGlyphStringLogClusters
attrSet = setGlyphStringLogClusters
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.logClusters"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#g:attr:logClusters"
})
glyphString_logClusters :: AttrLabelProxy "logClusters"
glyphString_logClusters = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList GlyphString
type instance O.AttributeList GlyphString = GlyphStringAttributeList
type GlyphStringAttributeList = ('[ '("numGlyphs", GlyphStringNumGlyphsFieldInfo), '("logClusters", GlyphStringLogClustersFieldInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "pango_glyph_string_new" pango_glyph_string_new ::
IO (Ptr GlyphString)
glyphStringNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m GlyphString
glyphStringNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m GlyphString
glyphStringNew = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
result <- IO (Ptr GlyphString)
pango_glyph_string_new
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"glyphStringNew" Ptr GlyphString
result
GlyphString
result' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr GlyphString -> GlyphString
GlyphString) Ptr GlyphString
result
forall (m :: * -> *) a. Monad m => a -> m a
return GlyphString
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "pango_glyph_string_copy" pango_glyph_string_copy ::
Ptr GlyphString ->
IO (Ptr GlyphString)
glyphStringCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
GlyphString
-> m (Maybe GlyphString)
glyphStringCopy :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GlyphString -> m (Maybe GlyphString)
glyphStringCopy GlyphString
string = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
string' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
string
Ptr GlyphString
result <- Ptr GlyphString -> IO (Ptr GlyphString)
pango_glyph_string_copy Ptr GlyphString
string'
Maybe GlyphString
maybeResult <- forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr GlyphString
result forall a b. (a -> b) -> a -> b
$ \Ptr GlyphString
result' -> do
GlyphString
result'' <- (forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr GlyphString -> GlyphString
GlyphString) Ptr GlyphString
result'
forall (m :: * -> *) a. Monad m => a -> m a
return GlyphString
result''
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
string
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe GlyphString
maybeResult
#if defined(ENABLE_OVERLOADING)
data GlyphStringCopyMethodInfo
instance (signature ~ (m (Maybe GlyphString)), MonadIO m) => O.OverloadedMethod GlyphStringCopyMethodInfo GlyphString signature where
overloadedMethod = glyphStringCopy
instance O.OverloadedMethodInfo GlyphStringCopyMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringCopy",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringCopy"
})
#endif
foreign import ccall "pango_glyph_string_extents" pango_glyph_string_extents ::
Ptr GlyphString ->
Ptr Pango.Font.Font ->
Ptr Pango.Rectangle.Rectangle ->
Ptr Pango.Rectangle.Rectangle ->
IO ()
glyphStringExtents ::
(B.CallStack.HasCallStack, MonadIO m, Pango.Font.IsFont a) =>
GlyphString
-> a
-> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
glyphStringExtents :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
GlyphString -> a -> m (Rectangle, Rectangle)
glyphStringExtents GlyphString
glyphs a
font = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
glyphs' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
Ptr Font
font' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
Ptr Rectangle
inkRect <- forall a. Int -> IO (Ptr a)
SP.callocBytes Int
16 :: IO (Ptr Pango.Rectangle.Rectangle)
Ptr Rectangle
logicalRect <- forall a. Int -> IO (Ptr a)
SP.callocBytes Int
16 :: IO (Ptr Pango.Rectangle.Rectangle)
Ptr GlyphString
-> Ptr Font -> Ptr Rectangle -> Ptr Rectangle -> IO ()
pango_glyph_string_extents Ptr GlyphString
glyphs' Ptr Font
font' Ptr Rectangle
inkRect Ptr Rectangle
logicalRect
Rectangle
inkRect' <- (forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr Rectangle -> Rectangle
Pango.Rectangle.Rectangle) Ptr Rectangle
inkRect
Rectangle
logicalRect' <- (forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr Rectangle -> Rectangle
Pango.Rectangle.Rectangle) Ptr Rectangle
logicalRect
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
font
forall (m :: * -> *) a. Monad m => a -> m a
return (Rectangle
inkRect', Rectangle
logicalRect')
#if defined(ENABLE_OVERLOADING)
data GlyphStringExtentsMethodInfo
instance (signature ~ (a -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m, Pango.Font.IsFont a) => O.OverloadedMethod GlyphStringExtentsMethodInfo GlyphString signature where
overloadedMethod = glyphStringExtents
instance O.OverloadedMethodInfo GlyphStringExtentsMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringExtents",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringExtents"
})
#endif
foreign import ccall "pango_glyph_string_extents_range" pango_glyph_string_extents_range ::
Ptr GlyphString ->
Int32 ->
Int32 ->
Ptr Pango.Font.Font ->
Ptr Pango.Rectangle.Rectangle ->
Ptr Pango.Rectangle.Rectangle ->
IO ()
glyphStringExtentsRange ::
(B.CallStack.HasCallStack, MonadIO m, Pango.Font.IsFont a) =>
GlyphString
-> Int32
-> Int32
-> a
-> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
glyphStringExtentsRange :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
GlyphString -> Int32 -> Int32 -> a -> m (Rectangle, Rectangle)
glyphStringExtentsRange GlyphString
glyphs Int32
start Int32
end a
font = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
glyphs' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
Ptr Font
font' <- forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
Ptr Rectangle
inkRect <- forall a. Int -> IO (Ptr a)
SP.callocBytes Int
16 :: IO (Ptr Pango.Rectangle.Rectangle)
Ptr Rectangle
logicalRect <- forall a. Int -> IO (Ptr a)
SP.callocBytes Int
16 :: IO (Ptr Pango.Rectangle.Rectangle)
Ptr GlyphString
-> Int32
-> Int32
-> Ptr Font
-> Ptr Rectangle
-> Ptr Rectangle
-> IO ()
pango_glyph_string_extents_range Ptr GlyphString
glyphs' Int32
start Int32
end Ptr Font
font' Ptr Rectangle
inkRect Ptr Rectangle
logicalRect
Rectangle
inkRect' <- (forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr Rectangle -> Rectangle
Pango.Rectangle.Rectangle) Ptr Rectangle
inkRect
Rectangle
logicalRect' <- (forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr Rectangle -> Rectangle
Pango.Rectangle.Rectangle) Ptr Rectangle
logicalRect
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
font
forall (m :: * -> *) a. Monad m => a -> m a
return (Rectangle
inkRect', Rectangle
logicalRect')
#if defined(ENABLE_OVERLOADING)
data GlyphStringExtentsRangeMethodInfo
instance (signature ~ (Int32 -> Int32 -> a -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m, Pango.Font.IsFont a) => O.OverloadedMethod GlyphStringExtentsRangeMethodInfo GlyphString signature where
overloadedMethod = glyphStringExtentsRange
instance O.OverloadedMethodInfo GlyphStringExtentsRangeMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringExtentsRange",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringExtentsRange"
})
#endif
foreign import ccall "pango_glyph_string_free" pango_glyph_string_free ::
Ptr GlyphString ->
IO ()
glyphStringFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
GlyphString
-> m ()
glyphStringFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GlyphString -> m ()
glyphStringFree GlyphString
string = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
string' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
string
Ptr GlyphString -> IO ()
pango_glyph_string_free Ptr GlyphString
string'
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
string
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data GlyphStringFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod GlyphStringFreeMethodInfo GlyphString signature where
overloadedMethod = glyphStringFree
instance O.OverloadedMethodInfo GlyphStringFreeMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringFree",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringFree"
})
#endif
foreign import ccall "pango_glyph_string_get_logical_widths" pango_glyph_string_get_logical_widths ::
Ptr GlyphString ->
CString ->
Int32 ->
Int32 ->
Ptr Int32 ->
IO ()
glyphStringGetLogicalWidths ::
(B.CallStack.HasCallStack, MonadIO m) =>
GlyphString
-> T.Text
-> Int32
-> Int32
-> [Int32]
-> m ()
glyphStringGetLogicalWidths :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GlyphString -> Text -> Int32 -> Int32 -> [Int32] -> m ()
glyphStringGetLogicalWidths GlyphString
glyphs Text
text Int32
length_ Int32
embeddingLevel [Int32]
logicalWidths = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
glyphs' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
CString
text' <- Text -> IO CString
textToCString Text
text
Ptr Int32
logicalWidths' <- forall a. Storable a => [a] -> IO (Ptr a)
packStorableArray [Int32]
logicalWidths
Ptr GlyphString -> CString -> Int32 -> Int32 -> Ptr Int32 -> IO ()
pango_glyph_string_get_logical_widths Ptr GlyphString
glyphs' CString
text' Int32
length_ Int32
embeddingLevel Ptr Int32
logicalWidths'
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
forall a. Ptr a -> IO ()
freeMem CString
text'
forall a. Ptr a -> IO ()
freeMem Ptr Int32
logicalWidths'
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data GlyphStringGetLogicalWidthsMethodInfo
instance (signature ~ (T.Text -> Int32 -> Int32 -> [Int32] -> m ()), MonadIO m) => O.OverloadedMethod GlyphStringGetLogicalWidthsMethodInfo GlyphString signature where
overloadedMethod = glyphStringGetLogicalWidths
instance O.OverloadedMethodInfo GlyphStringGetLogicalWidthsMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringGetLogicalWidths",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringGetLogicalWidths"
})
#endif
foreign import ccall "pango_glyph_string_get_width" pango_glyph_string_get_width ::
Ptr GlyphString ->
IO Int32
glyphStringGetWidth ::
(B.CallStack.HasCallStack, MonadIO m) =>
GlyphString
-> m Int32
glyphStringGetWidth :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GlyphString -> m Int32
glyphStringGetWidth GlyphString
glyphs = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
glyphs' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
Int32
result <- Ptr GlyphString -> IO Int32
pango_glyph_string_get_width Ptr GlyphString
glyphs'
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data GlyphStringGetWidthMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.OverloadedMethod GlyphStringGetWidthMethodInfo GlyphString signature where
overloadedMethod = glyphStringGetWidth
instance O.OverloadedMethodInfo GlyphStringGetWidthMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringGetWidth",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringGetWidth"
})
#endif
foreign import ccall "pango_glyph_string_index_to_x" pango_glyph_string_index_to_x ::
Ptr GlyphString ->
CString ->
Int32 ->
Ptr Pango.Analysis.Analysis ->
Int32 ->
CInt ->
Ptr Int32 ->
IO ()
glyphStringIndexToX ::
(B.CallStack.HasCallStack, MonadIO m) =>
GlyphString
-> T.Text
-> Int32
-> Pango.Analysis.Analysis
-> Int32
-> Bool
-> m (Int32)
glyphStringIndexToX :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GlyphString
-> Text -> Int32 -> Analysis -> Int32 -> Bool -> m Int32
glyphStringIndexToX GlyphString
glyphs Text
text Int32
length_ Analysis
analysis Int32
index_ Bool
trailing = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
glyphs' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
CString
text' <- Text -> IO CString
textToCString Text
text
Ptr Analysis
analysis' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
analysis
let trailing' :: CInt
trailing' = (forall a b. (Integral a, Num b) => a -> b
P.fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> Int
P.fromEnum) Bool
trailing
Ptr Int32
xPos <- forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr GlyphString
-> CString
-> Int32
-> Ptr Analysis
-> Int32
-> CInt
-> Ptr Int32
-> IO ()
pango_glyph_string_index_to_x Ptr GlyphString
glyphs' CString
text' Int32
length_ Ptr Analysis
analysis' Int32
index_ CInt
trailing' Ptr Int32
xPos
Int32
xPos' <- forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
xPos
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Analysis
analysis
forall a. Ptr a -> IO ()
freeMem CString
text'
forall a. Ptr a -> IO ()
freeMem Ptr Int32
xPos
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
xPos'
#if defined(ENABLE_OVERLOADING)
data GlyphStringIndexToXMethodInfo
instance (signature ~ (T.Text -> Int32 -> Pango.Analysis.Analysis -> Int32 -> Bool -> m (Int32)), MonadIO m) => O.OverloadedMethod GlyphStringIndexToXMethodInfo GlyphString signature where
overloadedMethod = glyphStringIndexToX
instance O.OverloadedMethodInfo GlyphStringIndexToXMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringIndexToX",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringIndexToX"
})
#endif
foreign import ccall "pango_glyph_string_index_to_x_full" pango_glyph_string_index_to_x_full ::
Ptr GlyphString ->
CString ->
Int32 ->
Ptr Pango.Analysis.Analysis ->
Ptr Pango.LogAttr.LogAttr ->
Int32 ->
CInt ->
Ptr Int32 ->
IO ()
glyphStringIndexToXFull ::
(B.CallStack.HasCallStack, MonadIO m) =>
GlyphString
-> T.Text
-> Int32
-> Pango.Analysis.Analysis
-> Maybe (Pango.LogAttr.LogAttr)
-> Int32
-> Bool
-> m (Int32)
glyphStringIndexToXFull :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GlyphString
-> Text
-> Int32
-> Analysis
-> Maybe LogAttr
-> Int32
-> Bool
-> m Int32
glyphStringIndexToXFull GlyphString
glyphs Text
text Int32
length_ Analysis
analysis Maybe LogAttr
attrs Int32
index_ Bool
trailing = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
glyphs' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
CString
text' <- Text -> IO CString
textToCString Text
text
Ptr Analysis
analysis' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
analysis
Ptr LogAttr
maybeAttrs <- case Maybe LogAttr
attrs of
Maybe LogAttr
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return forall a. Ptr a
nullPtr
Just LogAttr
jAttrs -> do
Ptr LogAttr
jAttrs' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr LogAttr
jAttrs
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr LogAttr
jAttrs'
let trailing' :: CInt
trailing' = (forall a b. (Integral a, Num b) => a -> b
P.fromIntegral forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Enum a => a -> Int
P.fromEnum) Bool
trailing
Ptr Int32
xPos <- forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr GlyphString
-> CString
-> Int32
-> Ptr Analysis
-> Ptr LogAttr
-> Int32
-> CInt
-> Ptr Int32
-> IO ()
pango_glyph_string_index_to_x_full Ptr GlyphString
glyphs' CString
text' Int32
length_ Ptr Analysis
analysis' Ptr LogAttr
maybeAttrs Int32
index_ CInt
trailing' Ptr Int32
xPos
Int32
xPos' <- forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
xPos
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Analysis
analysis
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe LogAttr
attrs forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
forall a. Ptr a -> IO ()
freeMem CString
text'
forall a. Ptr a -> IO ()
freeMem Ptr Int32
xPos
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
xPos'
#if defined(ENABLE_OVERLOADING)
data GlyphStringIndexToXFullMethodInfo
instance (signature ~ (T.Text -> Int32 -> Pango.Analysis.Analysis -> Maybe (Pango.LogAttr.LogAttr) -> Int32 -> Bool -> m (Int32)), MonadIO m) => O.OverloadedMethod GlyphStringIndexToXFullMethodInfo GlyphString signature where
overloadedMethod = glyphStringIndexToXFull
instance O.OverloadedMethodInfo GlyphStringIndexToXFullMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringIndexToXFull",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringIndexToXFull"
})
#endif
foreign import ccall "pango_glyph_string_set_size" pango_glyph_string_set_size ::
Ptr GlyphString ->
Int32 ->
IO ()
glyphStringSetSize ::
(B.CallStack.HasCallStack, MonadIO m) =>
GlyphString
-> Int32
-> m ()
glyphStringSetSize :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GlyphString -> Int32 -> m ()
glyphStringSetSize GlyphString
string Int32
newLen = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
string' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
string
Ptr GlyphString -> Int32 -> IO ()
pango_glyph_string_set_size Ptr GlyphString
string' Int32
newLen
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
string
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data GlyphStringSetSizeMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m) => O.OverloadedMethod GlyphStringSetSizeMethodInfo GlyphString signature where
overloadedMethod = glyphStringSetSize
instance O.OverloadedMethodInfo GlyphStringSetSizeMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringSetSize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringSetSize"
})
#endif
foreign import ccall "pango_glyph_string_x_to_index" pango_glyph_string_x_to_index ::
Ptr GlyphString ->
CString ->
Int32 ->
Ptr Pango.Analysis.Analysis ->
Int32 ->
Ptr Int32 ->
Ptr Int32 ->
IO ()
glyphStringXToIndex ::
(B.CallStack.HasCallStack, MonadIO m) =>
GlyphString
-> T.Text
-> Int32
-> Pango.Analysis.Analysis
-> Int32
-> m ((Int32, Int32))
glyphStringXToIndex :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GlyphString
-> Text -> Int32 -> Analysis -> Int32 -> m (Int32, Int32)
glyphStringXToIndex GlyphString
glyphs Text
text Int32
length_ Analysis
analysis Int32
xPos = forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ do
Ptr GlyphString
glyphs' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
CString
text' <- Text -> IO CString
textToCString Text
text
Ptr Analysis
analysis' <- forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
analysis
Ptr Int32
index_ <- forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr Int32
trailing <- forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr GlyphString
-> CString
-> Int32
-> Ptr Analysis
-> Int32
-> Ptr Int32
-> Ptr Int32
-> IO ()
pango_glyph_string_x_to_index Ptr GlyphString
glyphs' CString
text' Int32
length_ Ptr Analysis
analysis' Int32
xPos Ptr Int32
index_ Ptr Int32
trailing
Int32
index_' <- forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
index_
Int32
trailing' <- forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
trailing
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Analysis
analysis
forall a. Ptr a -> IO ()
freeMem CString
text'
forall a. Ptr a -> IO ()
freeMem Ptr Int32
index_
forall a. Ptr a -> IO ()
freeMem Ptr Int32
trailing
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
index_', Int32
trailing')
#if defined(ENABLE_OVERLOADING)
data GlyphStringXToIndexMethodInfo
instance (signature ~ (T.Text -> Int32 -> Pango.Analysis.Analysis -> Int32 -> m ((Int32, Int32))), MonadIO m) => O.OverloadedMethod GlyphStringXToIndexMethodInfo GlyphString signature where
overloadedMethod = glyphStringXToIndex
instance O.OverloadedMethodInfo GlyphStringXToIndexMethodInfo GlyphString where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.GlyphString.glyphStringXToIndex",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.27/docs/GI-Pango-Structs-GlyphString.html#v:glyphStringXToIndex"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveGlyphStringMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveGlyphStringMethod "copy" o = GlyphStringCopyMethodInfo
ResolveGlyphStringMethod "extents" o = GlyphStringExtentsMethodInfo
ResolveGlyphStringMethod "extentsRange" o = GlyphStringExtentsRangeMethodInfo
ResolveGlyphStringMethod "free" o = GlyphStringFreeMethodInfo
ResolveGlyphStringMethod "indexToX" o = GlyphStringIndexToXMethodInfo
ResolveGlyphStringMethod "indexToXFull" o = GlyphStringIndexToXFullMethodInfo
ResolveGlyphStringMethod "xToIndex" o = GlyphStringXToIndexMethodInfo
ResolveGlyphStringMethod "getLogicalWidths" o = GlyphStringGetLogicalWidthsMethodInfo
ResolveGlyphStringMethod "getWidth" o = GlyphStringGetWidthMethodInfo
ResolveGlyphStringMethod "setSize" o = GlyphStringSetSizeMethodInfo
ResolveGlyphStringMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveGlyphStringMethod t GlyphString, O.OverloadedMethod info GlyphString p) => OL.IsLabel t (GlyphString -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveGlyphStringMethod t GlyphString, O.OverloadedMethod info GlyphString p, R.HasField t GlyphString p) => R.HasField t GlyphString p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveGlyphStringMethod t GlyphString, O.OverloadedMethodInfo info GlyphString) => OL.IsLabel t (O.MethodProxy info GlyphString) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif