gi-pango-0.1.36.12: GI/Pango/Structs/GlyphItem.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
A #PangoGlyphItem is a pair of a #PangoItem and the glyphs
resulting from shaping the text corresponding to an item.
As an example of the usage of #PangoGlyphItem, the results
of shaping text with #PangoLayout is a list of #PangoLayoutLine,
each of which contains a list of #PangoGlyphItem.
-}
module GI.Pango.Structs.GlyphItem
(
-- * Exported types
GlyphItem(..) ,
noGlyphItem ,
-- * Methods
-- ** glyphItemApplyAttrs
glyphItemApplyAttrs ,
-- ** glyphItemCopy
glyphItemCopy ,
-- ** glyphItemFree
glyphItemFree ,
-- ** glyphItemGetLogicalWidths
glyphItemGetLogicalWidths ,
-- ** glyphItemLetterSpace
glyphItemLetterSpace ,
-- ** glyphItemSplit
glyphItemSplit ,
-- * Properties
-- ** Glyphs
glyphItemReadGlyphs ,
-- ** Item
glyphItemReadItem ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Pango.Types
import GI.Pango.Callbacks
newtype GlyphItem = GlyphItem (ForeignPtr GlyphItem)
foreign import ccall "pango_glyph_item_get_type" c_pango_glyph_item_get_type ::
IO GType
instance BoxedObject GlyphItem where
boxedType _ = c_pango_glyph_item_get_type
noGlyphItem :: Maybe GlyphItem
noGlyphItem = Nothing
glyphItemReadItem :: GlyphItem -> IO Item
glyphItemReadItem s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr Item)
val' <- (newBoxed Item) val
return val'
glyphItemReadGlyphs :: GlyphItem -> IO GlyphString
glyphItemReadGlyphs s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr GlyphString)
val' <- (newBoxed GlyphString) val
return val'
-- method GlyphItem::apply_attrs
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "list", argType = TInterface "Pango" "AttrList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "list", argType = TInterface "Pango" "AttrList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGSList (TInterface "Pango" "GlyphItem")
-- throws : False
-- Skip return : False
foreign import ccall "pango_glyph_item_apply_attrs" pango_glyph_item_apply_attrs ::
Ptr GlyphItem -> -- _obj : TInterface "Pango" "GlyphItem"
CString -> -- text : TBasicType TUTF8
Ptr AttrList -> -- list : TInterface "Pango" "AttrList"
IO (Ptr (GSList (Ptr GlyphItem)))
glyphItemApplyAttrs ::
(MonadIO m) =>
GlyphItem -> -- _obj
T.Text -> -- text
AttrList -> -- list
m [GlyphItem]
glyphItemApplyAttrs _obj text list = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
text' <- textToCString text
let list' = unsafeManagedPtrGetPtr list
result <- pango_glyph_item_apply_attrs _obj' text' list'
checkUnexpectedReturnNULL "pango_glyph_item_apply_attrs" result
result' <- unpackGSList result
result'' <- mapM (wrapBoxed GlyphItem) result'
g_slist_free result
touchManagedPtr _obj
touchManagedPtr list
freeMem text'
return result''
-- method GlyphItem::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "GlyphItem"
-- throws : False
-- Skip return : False
foreign import ccall "pango_glyph_item_copy" pango_glyph_item_copy ::
Ptr GlyphItem -> -- _obj : TInterface "Pango" "GlyphItem"
IO (Ptr GlyphItem)
glyphItemCopy ::
(MonadIO m) =>
GlyphItem -> -- _obj
m GlyphItem
glyphItemCopy _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
result <- pango_glyph_item_copy _obj'
checkUnexpectedReturnNULL "pango_glyph_item_copy" result
result' <- (wrapBoxed GlyphItem) result
touchManagedPtr _obj
return result'
-- method GlyphItem::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_glyph_item_free" pango_glyph_item_free ::
Ptr GlyphItem -> -- _obj : TInterface "Pango" "GlyphItem"
IO ()
glyphItemFree ::
(MonadIO m) =>
GlyphItem -> -- _obj
m ()
glyphItemFree _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
pango_glyph_item_free _obj'
touchManagedPtr _obj
return ()
-- method GlyphItem::get_logical_widths
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "logical_widths", argType = TCArray False (-1) (-1) (TBasicType TInt32), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "logical_widths", argType = TCArray False (-1) (-1) (TBasicType TInt32), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_glyph_item_get_logical_widths" pango_glyph_item_get_logical_widths ::
Ptr GlyphItem -> -- _obj : TInterface "Pango" "GlyphItem"
CString -> -- text : TBasicType TUTF8
Ptr Int32 -> -- logical_widths : TCArray False (-1) (-1) (TBasicType TInt32)
IO ()
glyphItemGetLogicalWidths ::
(MonadIO m) =>
GlyphItem -> -- _obj
T.Text -> -- text
Ptr Int32 -> -- logical_widths
m ()
glyphItemGetLogicalWidths _obj text logical_widths = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
text' <- textToCString text
pango_glyph_item_get_logical_widths _obj' text' logical_widths
touchManagedPtr _obj
freeMem text'
return ()
-- method GlyphItem::letter_space
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "log_attrs", argType = TCArray False (-1) (-1) (TInterface "Pango" "LogAttr"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "letter_spacing", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "log_attrs", argType = TCArray False (-1) (-1) (TInterface "Pango" "LogAttr"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "letter_spacing", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "pango_glyph_item_letter_space" pango_glyph_item_letter_space ::
Ptr GlyphItem -> -- _obj : TInterface "Pango" "GlyphItem"
CString -> -- text : TBasicType TUTF8
Ptr (Ptr LogAttr) -> -- log_attrs : TCArray False (-1) (-1) (TInterface "Pango" "LogAttr")
Int32 -> -- letter_spacing : TBasicType TInt32
IO ()
glyphItemLetterSpace ::
(MonadIO m) =>
GlyphItem -> -- _obj
T.Text -> -- text
Ptr (Ptr LogAttr) -> -- log_attrs
Int32 -> -- letter_spacing
m ()
glyphItemLetterSpace _obj text log_attrs letter_spacing = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
text' <- textToCString text
pango_glyph_item_letter_space _obj' text' log_attrs letter_spacing
touchManagedPtr _obj
freeMem text'
return ()
-- method GlyphItem::split
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "split_index", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "GlyphItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "split_index", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Pango" "GlyphItem"
-- throws : False
-- Skip return : False
foreign import ccall "pango_glyph_item_split" pango_glyph_item_split ::
Ptr GlyphItem -> -- _obj : TInterface "Pango" "GlyphItem"
CString -> -- text : TBasicType TUTF8
Int32 -> -- split_index : TBasicType TInt32
IO (Ptr GlyphItem)
glyphItemSplit ::
(MonadIO m) =>
GlyphItem -> -- _obj
T.Text -> -- text
Int32 -> -- split_index
m GlyphItem
glyphItemSplit _obj text split_index = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
text' <- textToCString text
result <- pango_glyph_item_split _obj' text' split_index
checkUnexpectedReturnNULL "pango_glyph_item_split" result
result' <- (wrapBoxed GlyphItem) result
touchManagedPtr _obj
freeMem text'
return result'