-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Pango.Functions
    ( 

 -- * Methods
-- ** attrAllowBreaksNew #method:attrAllowBreaksNew#

    attrAllowBreaksNew                      ,


-- ** attrBackgroundAlphaNew #method:attrBackgroundAlphaNew#

    attrBackgroundAlphaNew                  ,


-- ** attrBackgroundNew #method:attrBackgroundNew#

    attrBackgroundNew                       ,


-- ** attrFallbackNew #method:attrFallbackNew#

    attrFallbackNew                         ,


-- ** attrFamilyNew #method:attrFamilyNew#

    attrFamilyNew                           ,


-- ** attrForegroundAlphaNew #method:attrForegroundAlphaNew#

    attrForegroundAlphaNew                  ,


-- ** attrForegroundNew #method:attrForegroundNew#

    attrForegroundNew                       ,


-- ** attrGravityHintNew #method:attrGravityHintNew#

    attrGravityHintNew                      ,


-- ** attrGravityNew #method:attrGravityNew#

    attrGravityNew                          ,


-- ** attrInsertHyphensNew #method:attrInsertHyphensNew#

    attrInsertHyphensNew                    ,


-- ** attrLetterSpacingNew #method:attrLetterSpacingNew#

    attrLetterSpacingNew                    ,


-- ** attrRiseNew #method:attrRiseNew#

    attrRiseNew                             ,


-- ** attrScaleNew #method:attrScaleNew#

    attrScaleNew                            ,


-- ** attrShowNew #method:attrShowNew#

    attrShowNew                             ,


-- ** attrStretchNew #method:attrStretchNew#

    attrStretchNew                          ,


-- ** attrStrikethroughColorNew #method:attrStrikethroughColorNew#

    attrStrikethroughColorNew               ,


-- ** attrStrikethroughNew #method:attrStrikethroughNew#

    attrStrikethroughNew                    ,


-- ** attrStyleNew #method:attrStyleNew#

    attrStyleNew                            ,


-- ** attrUnderlineColorNew #method:attrUnderlineColorNew#

    attrUnderlineColorNew                   ,


-- ** attrUnderlineNew #method:attrUnderlineNew#

    attrUnderlineNew                        ,


-- ** attrVariantNew #method:attrVariantNew#

    attrVariantNew                          ,


-- ** attrWeightNew #method:attrWeightNew#

    attrWeightNew                           ,


-- ** break #method:break#

    break                                   ,


-- ** defaultBreak #method:defaultBreak#

    defaultBreak                            ,


-- ** extentsToPixels #method:extentsToPixels#

    extentsToPixels                         ,


-- ** findBaseDir #method:findBaseDir#

    findBaseDir                             ,


-- ** findParagraphBoundary #method:findParagraphBoundary#

    findParagraphBoundary                   ,


-- ** getLogAttrs #method:getLogAttrs#

    getLogAttrs                             ,


-- ** getMirrorChar #method:getMirrorChar#

    getMirrorChar                           ,


-- ** isZeroWidth #method:isZeroWidth#

    isZeroWidth                             ,


-- ** itemize #method:itemize#

    itemize                                 ,


-- ** itemizeWithBaseDir #method:itemizeWithBaseDir#

    itemizeWithBaseDir                      ,


-- ** log2visGetEmbeddingLevels #method:log2visGetEmbeddingLevels#

    log2visGetEmbeddingLevels               ,


-- ** markupParserFinish #method:markupParserFinish#

    markupParserFinish                      ,


-- ** markupParserNew #method:markupParserNew#

    markupParserNew                         ,


-- ** parseEnum #method:parseEnum#

    parseEnum                               ,


-- ** parseMarkup #method:parseMarkup#

    parseMarkup                             ,


-- ** parseStretch #method:parseStretch#

    parseStretch                            ,


-- ** parseStyle #method:parseStyle#

    parseStyle                              ,


-- ** parseVariant #method:parseVariant#

    parseVariant                            ,


-- ** parseWeight #method:parseWeight#

    parseWeight                             ,


-- ** quantizeLineGeometry #method:quantizeLineGeometry#

    quantizeLineGeometry                    ,


-- ** readLine #method:readLine#

    readLine                                ,


-- ** reorderItems #method:reorderItems#

    reorderItems                            ,


-- ** scanInt #method:scanInt#

    scanInt                                 ,


-- ** scanString #method:scanString#

    scanString                              ,


-- ** scanWord #method:scanWord#

    scanWord                                ,


-- ** shape #method:shape#

    shape                                   ,


-- ** shapeFull #method:shapeFull#

    shapeFull                               ,


-- ** shapeWithFlags #method:shapeWithFlags#

    shapeWithFlags                          ,


-- ** skipSpace #method:skipSpace#

    skipSpace                               ,


-- ** splitFileList #method:splitFileList#

    splitFileList                           ,


-- ** tailorBreak #method:tailorBreak#

    tailorBreak                             ,


-- ** trimString #method:trimString#

    trimString                              ,


-- ** unicharDirection #method:unicharDirection#

    unicharDirection                        ,


-- ** unitsFromDouble #method:unitsFromDouble#

    unitsFromDouble                         ,


-- ** unitsToDouble #method:unitsToDouble#

    unitsToDouble                           ,


-- ** version #method:version#

    version                                 ,


-- ** versionCheck #method:versionCheck#

    versionCheck                            ,


-- ** versionString #method:versionString#

    versionString                           ,




    ) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 GI.GLib.Structs.MarkupParseContext as GLib.MarkupParseContext
import qualified GI.GLib.Structs.String as GLib.String
import {-# SOURCE #-} qualified GI.Pango.Enums as Pango.Enums
import {-# SOURCE #-} qualified GI.Pango.Flags as Pango.Flags
import {-# SOURCE #-} qualified GI.Pango.Objects.Context as Pango.Context
import {-# SOURCE #-} qualified GI.Pango.Structs.Analysis as Pango.Analysis
import {-# SOURCE #-} qualified GI.Pango.Structs.AttrIterator as Pango.AttrIterator
import {-# SOURCE #-} qualified GI.Pango.Structs.AttrList as Pango.AttrList
import {-# SOURCE #-} qualified GI.Pango.Structs.Attribute as Pango.Attribute
import {-# SOURCE #-} qualified GI.Pango.Structs.GlyphString as Pango.GlyphString
import {-# SOURCE #-} qualified GI.Pango.Structs.Item as Pango.Item
import {-# SOURCE #-} qualified GI.Pango.Structs.Language as Pango.Language
import {-# SOURCE #-} qualified GI.Pango.Structs.LogAttr as Pango.LogAttr
import {-# SOURCE #-} qualified GI.Pango.Structs.Rectangle as Pango.Rectangle

-- function version_string
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "pango_version_string" pango_version_string :: 
    IO CString

-- | 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/
versionString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m T.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.
versionString :: m Text
versionString  = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- IO CString
pango_version_string
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"versionString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function version_check
-- Args: [ Arg
--           { argCName = "required_major"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the required major version."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "required_minor"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the required minor version."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "required_micro"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the required major version."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "pango_version_check" pango_version_check :: 
    Int32 ->                                -- required_major : TBasicType TInt
    Int32 ->                                -- required_minor : TBasicType TInt
    Int32 ->                                -- required_micro : TBasicType TInt
    IO CString

-- | 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/
versionCheck ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@requiredMajor@/: the required major version.
    -> Int32
    -- ^ /@requiredMinor@/: the required minor version.
    -> Int32
    -- ^ /@requiredMicro@/: the required major version.
    -> m (Maybe T.Text)
    -- ^ __Returns:__ 'P.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.
versionCheck :: Int32 -> Int32 -> Int32 -> m (Maybe Text)
versionCheck Int32
requiredMajor Int32
requiredMinor Int32
requiredMicro = IO (Maybe Text) -> m (Maybe Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
result <- Int32 -> Int32 -> Int32 -> IO CString
pango_version_check Int32
requiredMajor Int32
requiredMinor Int32
requiredMicro
    Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
        Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
        Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
    Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult


-- function version
-- Args: []
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "pango_version" pango_version :: 
    IO Int32

-- | 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/
version ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Int32
    -- ^ __Returns:__ The encoded version of Pango library
    --   available at run time.
version :: m Int32
version  = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Int32
result <- IO Int32
pango_version
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function units_to_double
-- Args: [ Arg
--           { argCName = "i"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "value in Pango units"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TDouble)
-- throws : False
-- Skip return : False

foreign import ccall "pango_units_to_double" pango_units_to_double :: 
    Int32 ->                                -- i : TBasicType TInt
    IO CDouble

-- | Converts a number in Pango units to floating-point: divides
-- it by 'GI.Pango.Constants.SCALE'.
-- 
-- /Since: 1.16/
unitsToDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@i@/: value in Pango units
    -> m Double
    -- ^ __Returns:__ the double value.
unitsToDouble :: Int32 -> m Double
unitsToDouble Int32
i = IO Double -> m Double
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ do
    CDouble
result <- Int32 -> IO CDouble
pango_units_to_double Int32
i
    let result' :: Double
result' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
result
    Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return Double
result'


-- function units_from_double
-- Args: [ Arg
--           { argCName = "d"
--           , argType = TBasicType TDouble
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "double floating-point value"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "pango_units_from_double" pango_units_from_double :: 
    CDouble ->                              -- d : TBasicType TDouble
    IO Int32

-- | Converts a floating-point number to Pango units: multiplies
-- it by 'GI.Pango.Constants.SCALE' and rounds to nearest integer.
-- 
-- /Since: 1.16/
unitsFromDouble ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Double
    -- ^ /@d@/: double floating-point value
    -> m Int32
    -- ^ __Returns:__ the value in Pango units.
unitsFromDouble :: Double -> m Int32
unitsFromDouble Double
d = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    let d' :: CDouble
d' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
d
    Int32
result <- CDouble -> IO Int32
pango_units_from_double CDouble
d'
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function unichar_direction
-- Args: [ Arg
--           { argCName = "ch"
--           , argType = TBasicType TUniChar
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a Unicode character"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Direction" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_unichar_direction" pango_unichar_direction :: 
    CInt ->                                 -- ch : TBasicType TUniChar
    IO CUInt

-- | Determines the inherent direction of a character; either
-- 'GI.Pango.Enums.DirectionLtr', 'GI.Pango.Enums.DirectionRtl', or
-- 'GI.Pango.Enums.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,
-- 'GI.Pango.Functions.bidiTypeForUnichar' can be used instead.
unicharDirection ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    -- ^ /@ch@/: a Unicode character
    -> m Pango.Enums.Direction
    -- ^ __Returns:__ the direction of the character.
unicharDirection :: Char -> m Direction
unicharDirection Char
ch = IO Direction -> m Direction
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Direction -> m Direction) -> IO Direction -> m Direction
forall a b. (a -> b) -> a -> b
$ do
    let ch' :: CInt
ch' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord) Char
ch
    CUInt
result <- CInt -> IO CUInt
pango_unichar_direction CInt
ch'
    let result' :: Direction
result' = (Int -> Direction
forall a. Enum a => Int -> a
toEnum (Int -> Direction) -> (CUInt -> Int) -> CUInt -> Direction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    Direction -> IO Direction
forall (m :: * -> *) a. Monad m => a -> m a
return Direction
result'


-- function trim_string
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "pango_trim_string" pango_trim_string :: 
    CString ->                              -- str : TBasicType TUTF8
    IO CString

{-# DEPRECATED trimString ["(Since version 1.38)"] #-}
-- | Trims leading and trailing whitespace from a string.
trimString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: a string
    -> m T.Text
    -- ^ __Returns:__ A newly-allocated string that must be freed with 'GI.GLib.Functions.free'
trimString :: Text -> m Text
trimString Text
str = IO Text -> m Text
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Text -> m Text) -> IO Text -> m Text
forall a b. (a -> b) -> a -> b
$ do
    CString
str' <- Text -> IO CString
textToCString Text
str
    CString
result <- CString -> IO CString
pango_trim_string CString
str'
    Text -> CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"trimString" CString
result
    Text
result' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result'


-- function tailor_break
-- Args: [ Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text to process. Must be valid UTF-8"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length in bytes of @text"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "analysis"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Analysis" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#PangoAnalysis structure from pango_itemize() for @text"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "offset"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "Byte offset of @text from the beginning of the\n    paragraph, or -1 to ignore attributes from @analysis"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "log_attrs"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 5
--                 (TInterface Name { namespace = "Pango" , name = "LogAttr" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "array with one #PangoLogAttr\n  per character in @text, plus one extra, to be filled in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "log_attrs_len"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length of @log_attrs array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "log_attrs_len"
--              , argType = TBasicType TInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "length of @log_attrs array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_tailor_break" pango_tailor_break :: 
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    Ptr Pango.Analysis.Analysis ->          -- analysis : TInterface (Name {namespace = "Pango", name = "Analysis"})
    Int32 ->                                -- offset : TBasicType TInt
    Ptr Pango.LogAttr.LogAttr ->            -- log_attrs : TCArray False (-1) 5 (TInterface (Name {namespace = "Pango", name = "LogAttr"}))
    Int32 ->                                -- log_attrs_len : TBasicType TInt
    IO ()

-- | Apply language-specific tailoring to the breaks in
-- /@logAttrs@/, which are assumed to have been produced
-- by 'GI.Pango.Functions.defaultBreak'.
-- 
-- If /@offset@/ is not -1, it is used to apply attributes
-- from /@analysis@/ that are relevant to line breaking.
-- 
-- /Since: 1.44/
tailorBreak ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@text@/: text to process. Must be valid UTF-8
    -> Int32
    -- ^ /@length@/: length in bytes of /@text@/
    -> Pango.Analysis.Analysis
    -- ^ /@analysis@/: t'GI.Pango.Structs.Analysis.Analysis' structure from 'GI.Pango.Functions.itemize' for /@text@/
    -> Int32
    -- ^ /@offset@/: Byte offset of /@text@/ from the beginning of the
    --     paragraph, or -1 to ignore attributes from /@analysis@/
    -> [Pango.LogAttr.LogAttr]
    -- ^ /@logAttrs@/: array with one t'GI.Pango.Structs.LogAttr.LogAttr'
    --   per character in /@text@/, plus one extra, to be filled in
    -> m ()
tailorBreak :: Text -> Int32 -> Analysis -> Int32 -> [LogAttr] -> m ()
tailorBreak Text
text Int32
length_ Analysis
analysis Int32
offset [LogAttr]
logAttrs = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let logAttrsLen :: Int32
logAttrsLen = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [LogAttr] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [LogAttr]
logAttrs
    CString
text' <- Text -> IO CString
textToCString Text
text
    Ptr Analysis
analysis' <- Analysis -> IO (Ptr Analysis)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
analysis
    [Ptr LogAttr]
logAttrs' <- (LogAttr -> IO (Ptr LogAttr)) -> [LogAttr] -> IO [Ptr LogAttr]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM LogAttr -> IO (Ptr LogAttr)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [LogAttr]
logAttrs
    Ptr LogAttr
logAttrs'' <- Int -> [Ptr LogAttr] -> IO (Ptr LogAttr)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray Int
52 [Ptr LogAttr]
logAttrs'
    CString
-> Int32 -> Ptr Analysis -> Int32 -> Ptr LogAttr -> Int32 -> IO ()
pango_tailor_break CString
text' Int32
length_ Ptr Analysis
analysis' Int32
offset Ptr LogAttr
logAttrs'' Int32
logAttrsLen
    Analysis -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Analysis
analysis
    (LogAttr -> IO ()) -> [LogAttr] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ LogAttr -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [LogAttr]
logAttrs
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    Ptr LogAttr -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr LogAttr
logAttrs''
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function split_file_list
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "a %G_SEARCHPATH_SEPARATOR separated list of filenames"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TCArray True (-1) (-1) (TBasicType TUTF8))
-- throws : False
-- Skip return : False

foreign import ccall "pango_split_file_list" pango_split_file_list :: 
    CString ->                              -- str : TBasicType TUTF8
    IO (Ptr CString)

{-# DEPRECATED splitFileList ["(Since version 1.38)"] #-}
-- | Splits a 'GI.GLib.Constants.SEARCHPATH_SEPARATOR'-separated list of files, stripping
-- white space and substituting ~\/ with $HOME\/.
splitFileList ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: a 'GI.GLib.Constants.SEARCHPATH_SEPARATOR' separated list of filenames
    -> m [T.Text]
    -- ^ __Returns:__ a list of
    -- strings to be freed with 'GI.GLib.Functions.strfreev'
splitFileList :: Text -> m [Text]
splitFileList Text
str = IO [Text] -> m [Text]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Text] -> m [Text]) -> IO [Text] -> m [Text]
forall a b. (a -> b) -> a -> b
$ do
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr CString
result <- CString -> IO (Ptr CString)
pango_split_file_list CString
str'
    Text -> Ptr CString -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"splitFileList" Ptr CString
result
    [Text]
result' <- HasCallStack => Ptr CString -> IO [Text]
Ptr CString -> IO [Text]
unpackZeroTerminatedUTF8CArray Ptr CString
result
    (CString -> IO ()) -> Ptr CString -> IO ()
forall a b. (Ptr a -> IO b) -> Ptr (Ptr a) -> IO ()
mapZeroTerminatedCArray CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    [Text] -> IO [Text]
forall (m :: * -> *) a. Monad m => a -> m a
return [Text]
result'


-- function skip_space
-- Args: [ Arg
--           { argCName = "pos"
--           , argType = TBasicType TUTF8
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "in/out string position"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_skip_space" pango_skip_space :: 
    Ptr CString ->                          -- pos : TBasicType TUTF8
    IO CInt

{-# DEPRECATED skipSpace ["(Since version 1.38)"] #-}
-- | Skips 0 or more characters of white space.
skipSpace ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@pos@/: in\/out string position
    -> m ((Bool, T.Text))
    -- ^ __Returns:__ 'P.False' if skipping the white space leaves
    -- the position at a \'\\0\' character.
skipSpace :: Text -> m (Bool, Text)
skipSpace Text
pos = IO (Bool, Text) -> m (Bool, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Text) -> m (Bool, Text))
-> IO (Bool, Text) -> m (Bool, Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
pos' <- Text -> IO CString
textToCString Text
pos
    Ptr CString
pos'' <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CString
pos'' CString
pos'
    CInt
result <- Ptr CString -> IO CInt
pango_skip_space Ptr CString
pos''
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString
pos''' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
pos''
    Text
pos'''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
pos'''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
pos'''
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
pos''
    (Bool, Text) -> IO (Bool, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Text
pos'''')


-- function shape_with_flags
-- Args: [ Arg
--           { argCName = "item_text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "valid UTF-8 text to shape"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the length (in bytes) of @item_text.\n    -1 means nul-terminated text."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paragraph_text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "text of the paragraph (see details).\n    May be %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paragraph_length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the length (in bytes) of @paragraph_text.\n    -1 means nul-terminated text."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "analysis"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Analysis" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#PangoAnalysis structure from pango_itemize()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyphs"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "GlyphString" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "glyph string in which to store results"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "ShapeFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "flags influencing the shaping process"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_shape_with_flags" pango_shape_with_flags :: 
    CString ->                              -- item_text : TBasicType TUTF8
    Int32 ->                                -- item_length : TBasicType TInt
    CString ->                              -- paragraph_text : TBasicType TUTF8
    Int32 ->                                -- paragraph_length : TBasicType TInt
    Ptr Pango.Analysis.Analysis ->          -- analysis : TInterface (Name {namespace = "Pango", name = "Analysis"})
    Ptr Pango.GlyphString.GlyphString ->    -- glyphs : TInterface (Name {namespace = "Pango", name = "GlyphString"})
    CUInt ->                                -- flags : TInterface (Name {namespace = "Pango", name = "ShapeFlags"})
    IO ()

-- | Given a segment of text and the corresponding
-- t'GI.Pango.Structs.Analysis.Analysis' structure returned from 'GI.Pango.Functions.itemize',
-- convert the characters into glyphs. You may also pass
-- in only a substring of the item from 'GI.Pango.Functions.itemize'.
-- 
-- This is similar to 'GI.Pango.Functions.shapeFull', except it also takes
-- flags that can influence the shaping process.
-- 
-- /Since: 1.44/
shapeWithFlags ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@itemText@/: valid UTF-8 text to shape
    -> Int32
    -- ^ /@itemLength@/: the length (in bytes) of /@itemText@/.
    --     -1 means nul-terminated text.
    -> Maybe (T.Text)
    -- ^ /@paragraphText@/: text of the paragraph (see details).
    --     May be 'P.Nothing'.
    -> Int32
    -- ^ /@paragraphLength@/: the length (in bytes) of /@paragraphText@/.
    --     -1 means nul-terminated text.
    -> Pango.Analysis.Analysis
    -- ^ /@analysis@/: t'GI.Pango.Structs.Analysis.Analysis' structure from 'GI.Pango.Functions.itemize'
    -> Pango.GlyphString.GlyphString
    -- ^ /@glyphs@/: glyph string in which to store results
    -> [Pango.Flags.ShapeFlags]
    -- ^ /@flags@/: flags influencing the shaping process
    -> m ()
shapeWithFlags :: Text
-> Int32
-> Maybe Text
-> Int32
-> Analysis
-> GlyphString
-> [ShapeFlags]
-> m ()
shapeWithFlags Text
itemText Int32
itemLength Maybe Text
paragraphText Int32
paragraphLength Analysis
analysis GlyphString
glyphs [ShapeFlags]
flags = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
itemText' <- Text -> IO CString
textToCString Text
itemText
    CString
maybeParagraphText <- case Maybe Text
paragraphText of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jParagraphText -> do
            CString
jParagraphText' <- Text -> IO CString
textToCString Text
jParagraphText
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jParagraphText'
    Ptr Analysis
analysis' <- Analysis -> IO (Ptr Analysis)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
analysis
    Ptr GlyphString
glyphs' <- GlyphString -> IO (Ptr GlyphString)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
    let flags' :: CUInt
flags' = [ShapeFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ShapeFlags]
flags
    CString
-> Int32
-> CString
-> Int32
-> Ptr Analysis
-> Ptr GlyphString
-> CUInt
-> IO ()
pango_shape_with_flags CString
itemText' Int32
itemLength CString
maybeParagraphText Int32
paragraphLength Ptr Analysis
analysis' Ptr GlyphString
glyphs' CUInt
flags'
    Analysis -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Analysis
analysis
    GlyphString -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
itemText'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeParagraphText
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function shape_full
-- Args: [ Arg
--           { argCName = "item_text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "valid UTF-8 text to shape."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "item_length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the length (in bytes) of @item_text. -1 means nul-terminated text."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paragraph_text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "text of the paragraph (see details).  May be %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paragraph_length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the length (in bytes) of @paragraph_text. -1 means nul-terminated text."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "analysis"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Analysis" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#PangoAnalysis structure from pango_itemize()."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyphs"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "GlyphString" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "glyph string in which to store results."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_shape_full" pango_shape_full :: 
    CString ->                              -- item_text : TBasicType TUTF8
    Int32 ->                                -- item_length : TBasicType TInt
    CString ->                              -- paragraph_text : TBasicType TUTF8
    Int32 ->                                -- paragraph_length : TBasicType TInt
    Ptr Pango.Analysis.Analysis ->          -- analysis : TInterface (Name {namespace = "Pango", name = "Analysis"})
    Ptr Pango.GlyphString.GlyphString ->    -- glyphs : TInterface (Name {namespace = "Pango", name = "GlyphString"})
    IO ()

-- | Given a segment of text and the corresponding
-- t'GI.Pango.Structs.Analysis.Analysis' structure returned from 'GI.Pango.Functions.itemize',
-- convert the characters into glyphs. You may also pass
-- in only a substring of the item from 'GI.Pango.Functions.itemize'.
-- 
-- This is similar to 'GI.Pango.Functions.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 'P.Nothing', item text is used instead.
-- 
-- /Since: 1.32/
shapeFull ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@itemText@/: valid UTF-8 text to shape.
    -> Int32
    -- ^ /@itemLength@/: the length (in bytes) of /@itemText@/. -1 means nul-terminated text.
    -> Maybe (T.Text)
    -- ^ /@paragraphText@/: text of the paragraph (see details).  May be 'P.Nothing'.
    -> Int32
    -- ^ /@paragraphLength@/: the length (in bytes) of /@paragraphText@/. -1 means nul-terminated text.
    -> Pango.Analysis.Analysis
    -- ^ /@analysis@/: t'GI.Pango.Structs.Analysis.Analysis' structure from 'GI.Pango.Functions.itemize'.
    -> Pango.GlyphString.GlyphString
    -- ^ /@glyphs@/: glyph string in which to store results.
    -> m ()
shapeFull :: Text
-> Int32 -> Maybe Text -> Int32 -> Analysis -> GlyphString -> m ()
shapeFull Text
itemText Int32
itemLength Maybe Text
paragraphText Int32
paragraphLength Analysis
analysis GlyphString
glyphs = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
itemText' <- Text -> IO CString
textToCString Text
itemText
    CString
maybeParagraphText <- case Maybe Text
paragraphText of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jParagraphText -> do
            CString
jParagraphText' <- Text -> IO CString
textToCString Text
jParagraphText
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jParagraphText'
    Ptr Analysis
analysis' <- Analysis -> IO (Ptr Analysis)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
analysis
    Ptr GlyphString
glyphs' <- GlyphString -> IO (Ptr GlyphString)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
    CString
-> Int32
-> CString
-> Int32
-> Ptr Analysis
-> Ptr GlyphString
-> IO ()
pango_shape_full CString
itemText' Int32
itemLength CString
maybeParagraphText Int32
paragraphLength Ptr Analysis
analysis' Ptr GlyphString
glyphs'
    Analysis -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Analysis
analysis
    GlyphString -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
itemText'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeParagraphText
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function shape
-- Args: [ Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the text to process"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the length (in bytes) of @text"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "analysis"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Analysis" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#PangoAnalysis structure from pango_itemize()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "glyphs"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "GlyphString" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "glyph string in which to store results"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_shape" pango_shape :: 
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    Ptr Pango.Analysis.Analysis ->          -- analysis : TInterface (Name {namespace = "Pango", name = "Analysis"})
    Ptr Pango.GlyphString.GlyphString ->    -- glyphs : TInterface (Name {namespace = "Pango", name = "GlyphString"})
    IO ()

-- | Given a segment of text and the corresponding
-- t'GI.Pango.Structs.Analysis.Analysis' structure returned from 'GI.Pango.Functions.itemize',
-- convert the characters into glyphs. You may also pass
-- in only a substring of the item from 'GI.Pango.Functions.itemize'.
-- 
-- It is recommended that you use 'GI.Pango.Functions.shapeFull' instead, since
-- that API allows for shaping interaction happening across text item
-- boundaries.
shape ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@text@/: the text to process
    -> Int32
    -- ^ /@length@/: the length (in bytes) of /@text@/
    -> Pango.Analysis.Analysis
    -- ^ /@analysis@/: t'GI.Pango.Structs.Analysis.Analysis' structure from 'GI.Pango.Functions.itemize'
    -> Pango.GlyphString.GlyphString
    -- ^ /@glyphs@/: glyph string in which to store results
    -> m ()
shape :: Text -> Int32 -> Analysis -> GlyphString -> m ()
shape Text
text Int32
length_ Analysis
analysis GlyphString
glyphs = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
text' <- Text -> IO CString
textToCString Text
text
    Ptr Analysis
analysis' <- Analysis -> IO (Ptr Analysis)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
analysis
    Ptr GlyphString
glyphs' <- GlyphString -> IO (Ptr GlyphString)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GlyphString
glyphs
    CString -> Int32 -> Ptr Analysis -> Ptr GlyphString -> IO ()
pango_shape CString
text' Int32
length_ Ptr Analysis
analysis' Ptr GlyphString
glyphs'
    Analysis -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Analysis
analysis
    GlyphString -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr GlyphString
glyphs
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function scan_word
-- Args: [ Arg
--           { argCName = "pos"
--           , argType = TBasicType TUTF8
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "in/out string position"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "String" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GString into which to write the result"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_scan_word" pango_scan_word :: 
    Ptr CString ->                          -- pos : TBasicType TUTF8
    Ptr GLib.String.String ->               -- out : TInterface (Name {namespace = "GLib", name = "String"})
    IO CInt

{-# DEPRECATED scanWord ["(Since version 1.38)"] #-}
-- | Scans a word into a t'GI.GLib.Structs.String.String' buffer. A word consists
-- of [A-Za-z_] followed by zero or more [A-Za-z_0-9]
-- Leading white space is skipped.
scanWord ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@pos@/: in\/out string position
    -> GLib.String.String
    -- ^ /@out@/: a t'GI.GLib.Structs.String.String' into which to write the result
    -> m ((Bool, T.Text))
    -- ^ __Returns:__ 'P.False' if a parse error occurred.
scanWord :: Text -> String -> m (Bool, Text)
scanWord Text
pos String
out = IO (Bool, Text) -> m (Bool, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Text) -> m (Bool, Text))
-> IO (Bool, Text) -> m (Bool, Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
pos' <- Text -> IO CString
textToCString Text
pos
    Ptr CString
pos'' <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CString
pos'' CString
pos'
    Ptr String
out' <- String -> IO (Ptr String)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr String
out
    CInt
result <- Ptr CString -> Ptr String -> IO CInt
pango_scan_word Ptr CString
pos'' Ptr String
out'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString
pos''' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
pos''
    Text
pos'''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
pos'''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
pos'''
    String -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr String
out
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
pos''
    (Bool, Text) -> IO (Bool, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Text
pos'''')


-- function scan_string
-- Args: [ Arg
--           { argCName = "pos"
--           , argType = TBasicType TUTF8
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "in/out string position"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "String" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GString into which to write the result"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_scan_string" pango_scan_string :: 
    Ptr CString ->                          -- pos : TBasicType TUTF8
    Ptr GLib.String.String ->               -- out : TInterface (Name {namespace = "GLib", name = "String"})
    IO CInt

{-# DEPRECATED scanString ["(Since version 1.38)"] #-}
-- | Scans a string into a t'GI.GLib.Structs.String.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.
scanString ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@pos@/: in\/out string position
    -> GLib.String.String
    -- ^ /@out@/: a t'GI.GLib.Structs.String.String' into which to write the result
    -> m ((Bool, T.Text))
    -- ^ __Returns:__ 'P.False' if a parse error occurred.
scanString :: Text -> String -> m (Bool, Text)
scanString Text
pos String
out = IO (Bool, Text) -> m (Bool, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Text) -> m (Bool, Text))
-> IO (Bool, Text) -> m (Bool, Text)
forall a b. (a -> b) -> a -> b
$ do
    CString
pos' <- Text -> IO CString
textToCString Text
pos
    Ptr CString
pos'' <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CString
pos'' CString
pos'
    Ptr String
out' <- String -> IO (Ptr String)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr String
out
    CInt
result <- Ptr CString -> Ptr String -> IO CInt
pango_scan_string Ptr CString
pos'' Ptr String
out'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString
pos''' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
pos''
    Text
pos'''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
pos'''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
pos'''
    String -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr String
out
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
pos''
    (Bool, Text) -> IO (Bool, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Text
pos'''')


-- function scan_int
-- Args: [ Arg
--           { argCName = "pos"
--           , argType = TBasicType TUTF8
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "in/out string position"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "out"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an int into which to write the result"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_scan_int" pango_scan_int :: 
    Ptr CString ->                          -- pos : TBasicType TUTF8
    Ptr Int32 ->                            -- out : TBasicType TInt
    IO CInt

{-# DEPRECATED scanInt ["(Since version 1.38)"] #-}
-- | Scans an integer.
-- Leading white space is skipped.
scanInt ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@pos@/: in\/out string position
    -> m ((Bool, T.Text, Int32))
    -- ^ __Returns:__ 'P.False' if a parse error occurred.
scanInt :: Text -> m (Bool, Text, Int32)
scanInt Text
pos = IO (Bool, Text, Int32) -> m (Bool, Text, Int32)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Text, Int32) -> m (Bool, Text, Int32))
-> IO (Bool, Text, Int32) -> m (Bool, Text, Int32)
forall a b. (a -> b) -> a -> b
$ do
    CString
pos' <- Text -> IO CString
textToCString Text
pos
    Ptr CString
pos'' <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CString)
    Ptr CString -> CString -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr CString
pos'' CString
pos'
    Ptr Int32
out <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    CInt
result <- Ptr CString -> Ptr Int32 -> IO CInt
pango_scan_int Ptr CString
pos'' Ptr Int32
out
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CString
pos''' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
pos''
    Text
pos'''' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
pos'''
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
pos'''
    Int32
out' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
out
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
pos''
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
out
    (Bool, Text, Int32) -> IO (Bool, Text, Int32)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Text
pos'''', Int32
out')


-- function reorder_items
-- Args: [ Arg
--           { argCName = "logical_items"
--           , argType =
--               TGList (TInterface Name { namespace = "Pango" , name = "Item" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GList of #PangoItem in logical order."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList (TInterface Name { namespace = "Pango" , name = "Item" }))
-- throws : False
-- Skip return : False

foreign import ccall "pango_reorder_items" pango_reorder_items :: 
    Ptr (GList (Ptr Pango.Item.Item)) ->    -- logical_items : TGList (TInterface (Name {namespace = "Pango", name = "Item"}))
    IO (Ptr (GList (Ptr Pango.Item.Item)))

-- | From a list of items in logical order and the associated
-- directional levels, produce a list in visual order.
-- The original list is unmodified.
reorderItems ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Pango.Item.Item]
    -- ^ /@logicalItems@/: a t'GI.GLib.Structs.List.List' of t'GI.Pango.Structs.Item.Item' in logical order.
    -> m [Pango.Item.Item]
    -- ^ __Returns:__ a t'GI.GLib.Structs.List.List'
    --          of t'GI.Pango.Structs.Item.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.)
reorderItems :: [Item] -> m [Item]
reorderItems [Item]
logicalItems = IO [Item] -> m [Item]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Item] -> m [Item]) -> IO [Item] -> m [Item]
forall a b. (a -> b) -> a -> b
$ do
    [Ptr Item]
logicalItems' <- (Item -> IO (Ptr Item)) -> [Item] -> IO [Ptr Item]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM Item -> IO (Ptr Item)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [Item]
logicalItems
    Ptr (GList (Ptr Item))
logicalItems'' <- [Ptr Item] -> IO (Ptr (GList (Ptr Item)))
forall a. [Ptr a] -> IO (Ptr (GList (Ptr a)))
packGList [Ptr Item]
logicalItems'
    Ptr (GList (Ptr Item))
result <- Ptr (GList (Ptr Item)) -> IO (Ptr (GList (Ptr Item)))
pango_reorder_items Ptr (GList (Ptr Item))
logicalItems''
    [Ptr Item]
result' <- Ptr (GList (Ptr Item)) -> IO [Ptr Item]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr Item))
result
    [Item]
result'' <- (Ptr Item -> IO Item) -> [Ptr Item] -> IO [Item]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr Item -> Item) -> Ptr Item -> IO Item
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Item -> Item
Pango.Item.Item) [Ptr Item]
result'
    Ptr (GList (Ptr Item)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr Item))
result
    (Item -> IO ()) -> [Item] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ Item -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [Item]
logicalItems
    Ptr (GList (Ptr Item)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr Item))
logicalItems''
    [Item] -> IO [Item]
forall (m :: * -> *) a. Monad m => a -> m a
return [Item]
result''


-- function read_line
-- Args: [ Arg
--           { argCName = "stream"
--           , argType = TBasicType TPtr
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a stdio stream" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "str"
--           , argType =
--               TInterface Name { namespace = "GLib" , name = "String" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "#GString buffer into which to write the result"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "pango_read_line" pango_read_line :: 
    Ptr () ->                               -- stream : TBasicType TPtr
    Ptr GLib.String.String ->               -- str : TInterface (Name {namespace = "GLib", name = "String"})
    IO Int32

{-# DEPRECATED readLine ["(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.
readLine ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    -- ^ /@stream@/: a stdio stream
    -> GLib.String.String
    -- ^ /@str@/: t'GI.GLib.Structs.String.String' buffer into which to write the result
    -> m Int32
    -- ^ __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 \'\\\')
readLine :: Ptr () -> String -> m Int32
readLine Ptr ()
stream String
str = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
    Ptr String
str' <- String -> IO (Ptr String)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr String
str
    Int32
result <- Ptr () -> Ptr String -> IO Int32
pango_read_line Ptr ()
stream Ptr String
str'
    String -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr String
str
    Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result


-- function quantize_line_geometry
-- Args: [ Arg
--           { argCName = "thickness"
--           , argType = TBasicType TInt
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "pointer to the thickness of a line, in Pango units"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "position"
--           , argType = TBasicType TInt
--           , direction = DirectionInout
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "corresponding position"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_quantize_line_geometry" pango_quantize_line_geometry :: 
    Ptr Int32 ->                            -- thickness : TBasicType TInt
    Ptr Int32 ->                            -- position : TBasicType TInt
    IO ()

-- | Quantizes the thickness and position of a line, typically an
-- underline or strikethrough, to whole device pixels, that is integer
-- multiples of 'GI.Pango.Constants.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/
quantizeLineGeometry ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@thickness@/: pointer to the thickness of a line, in Pango units
    -> Int32
    -- ^ /@position@/: corresponding position
    -> m ((Int32, Int32))
quantizeLineGeometry :: Int32 -> Int32 -> m (Int32, Int32)
quantizeLineGeometry Int32
thickness Int32
position = IO (Int32, Int32) -> m (Int32, Int32)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Int32) -> m (Int32, Int32))
-> IO (Int32, Int32) -> m (Int32, Int32)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Int32
thickness' <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Int32
thickness' Int32
thickness
    Ptr Int32
position' <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Int32
position' Int32
position
    Ptr Int32 -> Ptr Int32 -> IO ()
pango_quantize_line_geometry Ptr Int32
thickness' Ptr Int32
position'
    Int32
thickness'' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
thickness'
    Int32
position'' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
position'
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
thickness'
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
position'
    (Int32, Int32) -> IO (Int32, Int32)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
thickness'', Int32
position'')


-- function parse_weight
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string to parse." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "weight"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Weight" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoWeight to store the result\n  in."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "warn"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "if %TRUE, issue a g_warning() on bad input."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_parse_weight" pango_parse_weight :: 
    CString ->                              -- str : TBasicType TUTF8
    Ptr CUInt ->                            -- weight : TInterface (Name {namespace = "Pango", name = "Weight"})
    CInt ->                                 -- warn : TBasicType TBoolean
    IO CInt

-- | Parses a font weight. The allowed values are \"heavy\",
-- \"ultrabold\", \"bold\", \"normal\", \"light\", \"ultraleight\"
-- and integers. Case variations are ignored.
parseWeight ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: a string to parse.
    -> Bool
    -- ^ /@warn@/: if 'P.True', issue a @/g_warning()/@ on bad input.
    -> m ((Bool, Pango.Enums.Weight))
    -- ^ __Returns:__ 'P.True' if /@str@/ was successfully parsed.
parseWeight :: Text -> Bool -> m (Bool, Weight)
parseWeight Text
str Bool
warn = IO (Bool, Weight) -> m (Bool, Weight)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Weight) -> m (Bool, Weight))
-> IO (Bool, Weight) -> m (Bool, Weight)
forall a b. (a -> b) -> a -> b
$ do
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr CUInt
weight <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    let warn' :: CInt
warn' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
warn
    CInt
result <- CString -> Ptr CUInt -> CInt -> IO CInt
pango_parse_weight CString
str' Ptr CUInt
weight CInt
warn'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CUInt
weight' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
weight
    let weight'' :: Weight
weight'' = (Int -> Weight
forall a. Enum a => Int -> a
toEnum (Int -> Weight) -> (CUInt -> Int) -> CUInt -> Weight
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
weight'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
weight
    (Bool, Weight) -> IO (Bool, Weight)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Weight
weight'')


-- function parse_variant
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string to parse." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "variant"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Variant" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoVariant to store the\n  result in."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "warn"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "if %TRUE, issue a g_warning() on bad input."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_parse_variant" pango_parse_variant :: 
    CString ->                              -- str : TBasicType TUTF8
    Ptr CUInt ->                            -- variant : TInterface (Name {namespace = "Pango", name = "Variant"})
    CInt ->                                 -- warn : TBasicType TBoolean
    IO CInt

-- | Parses a font variant. The allowed values are \"normal\"
-- and \"smallcaps\" or \"small_caps\", case variations being
-- ignored.
parseVariant ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: a string to parse.
    -> Bool
    -- ^ /@warn@/: if 'P.True', issue a @/g_warning()/@ on bad input.
    -> m ((Bool, Pango.Enums.Variant))
    -- ^ __Returns:__ 'P.True' if /@str@/ was successfully parsed.
parseVariant :: Text -> Bool -> m (Bool, Variant)
parseVariant Text
str Bool
warn = IO (Bool, Variant) -> m (Bool, Variant)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Variant) -> m (Bool, Variant))
-> IO (Bool, Variant) -> m (Bool, Variant)
forall a b. (a -> b) -> a -> b
$ do
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr CUInt
variant <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    let warn' :: CInt
warn' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
warn
    CInt
result <- CString -> Ptr CUInt -> CInt -> IO CInt
pango_parse_variant CString
str' Ptr CUInt
variant CInt
warn'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CUInt
variant' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
variant
    let variant'' :: Variant
variant'' = (Int -> Variant
forall a. Enum a => Int -> a
toEnum (Int -> Variant) -> (CUInt -> Int) -> CUInt -> Variant
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
variant'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
variant
    (Bool, Variant) -> IO (Bool, Variant)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Variant
variant'')


-- function parse_style
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string to parse." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "style"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Style" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoStyle to store the result\n  in."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "warn"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "if %TRUE, issue a g_warning() on bad input."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_parse_style" pango_parse_style :: 
    CString ->                              -- str : TBasicType TUTF8
    Ptr CUInt ->                            -- style : TInterface (Name {namespace = "Pango", name = "Style"})
    CInt ->                                 -- warn : TBasicType TBoolean
    IO CInt

-- | Parses a font style. The allowed values are \"normal\",
-- \"italic\" and \"oblique\", case variations being
-- ignored.
parseStyle ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: a string to parse.
    -> Bool
    -- ^ /@warn@/: if 'P.True', issue a @/g_warning()/@ on bad input.
    -> m ((Bool, Pango.Enums.Style))
    -- ^ __Returns:__ 'P.True' if /@str@/ was successfully parsed.
parseStyle :: Text -> Bool -> m (Bool, Style)
parseStyle Text
str Bool
warn = IO (Bool, Style) -> m (Bool, Style)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Style) -> m (Bool, Style))
-> IO (Bool, Style) -> m (Bool, Style)
forall a b. (a -> b) -> a -> b
$ do
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr CUInt
style <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    let warn' :: CInt
warn' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
warn
    CInt
result <- CString -> Ptr CUInt -> CInt -> IO CInt
pango_parse_style CString
str' Ptr CUInt
style CInt
warn'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CUInt
style' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
style
    let style'' :: Style
style'' = (Int -> Style
forall a. Enum a => Int -> a
toEnum (Int -> Style) -> (CUInt -> Int) -> CUInt -> Style
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
style'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
style
    (Bool, Style) -> IO (Bool, Style)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Style
style'')


-- function parse_stretch
-- Args: [ Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a string to parse." , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "stretch"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Stretch" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoStretch to store the\n  result in."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "warn"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "if %TRUE, issue a g_warning() on bad input."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_parse_stretch" pango_parse_stretch :: 
    CString ->                              -- str : TBasicType TUTF8
    Ptr CUInt ->                            -- stretch : TInterface (Name {namespace = "Pango", name = "Stretch"})
    CInt ->                                 -- warn : TBasicType TBoolean
    IO CInt

-- | 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.
parseStretch ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@str@/: a string to parse.
    -> Bool
    -- ^ /@warn@/: if 'P.True', issue a @/g_warning()/@ on bad input.
    -> m ((Bool, Pango.Enums.Stretch))
    -- ^ __Returns:__ 'P.True' if /@str@/ was successfully parsed.
parseStretch :: Text -> Bool -> m (Bool, Stretch)
parseStretch Text
str Bool
warn = IO (Bool, Stretch) -> m (Bool, Stretch)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Stretch) -> m (Bool, Stretch))
-> IO (Bool, Stretch) -> m (Bool, Stretch)
forall a b. (a -> b) -> a -> b
$ do
    CString
str' <- Text -> IO CString
textToCString Text
str
    Ptr CUInt
stretch <- IO (Ptr CUInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CUInt)
    let warn' :: CInt
warn' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
warn
    CInt
result <- CString -> Ptr CUInt -> CInt -> IO CInt
pango_parse_stretch CString
str' Ptr CUInt
stretch CInt
warn'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    CUInt
stretch' <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
stretch
    let stretch'' :: Stretch
stretch'' = (Int -> Stretch
forall a. Enum a => Int -> a
toEnum (Int -> Stretch) -> (CUInt -> Int) -> CUInt -> Stretch
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
stretch'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
str'
    Ptr CUInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CUInt
stretch
    (Bool, Stretch) -> IO (Bool, Stretch)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Stretch
stretch'')


-- function parse_markup
-- Args: [ Arg
--           { argCName = "markup_text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "markup to parse (see <link linkend=\"PangoMarkupFormat\">markup format</link>)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of @markup_text, or -1 if nul-terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "accel_marker"
--           , argType = TBasicType TUniChar
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "character that precedes an accelerator, or 0 for none"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attr_list"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "AttrList" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "address of return location for a #PangoAttrList, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "address of return location for text with tags stripped, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "accel_char"
--           , argType = TBasicType TUniChar
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "address of return location for accelerator char, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "pango_parse_markup" pango_parse_markup :: 
    CString ->                              -- markup_text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    CInt ->                                 -- accel_marker : TBasicType TUniChar
    Ptr (Ptr Pango.AttrList.AttrList) ->    -- attr_list : TInterface (Name {namespace = "Pango", name = "AttrList"})
    Ptr CString ->                          -- text : TBasicType TUTF8
    Ptr CInt ->                             -- accel_char : TBasicType TUniChar
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | 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 'GI.Pango.Enums.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 'GI.Pango.Functions.markupParserNew'.
-- 
-- If any error happens, none of the output arguments are touched except
-- for /@error@/.
parseMarkup ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.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 ((Pango.AttrList.AttrList, T.Text, Char))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
parseMarkup :: Text -> Int32 -> Char -> m (AttrList, Text, Char)
parseMarkup Text
markupText Int32
length_ Char
accelMarker = IO (AttrList, Text, Char) -> m (AttrList, Text, Char)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (AttrList, Text, Char) -> m (AttrList, Text, Char))
-> IO (AttrList, Text, Char) -> m (AttrList, Text, Char)
forall a b. (a -> b) -> a -> b
$ do
    CString
markupText' <- Text -> IO CString
textToCString Text
markupText
    let accelMarker' :: CInt
accelMarker' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord) Char
accelMarker
    Ptr (Ptr AttrList)
attrList <- IO (Ptr (Ptr AttrList))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Pango.AttrList.AttrList))
    Ptr CString
text <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CInt
accelChar <- IO (Ptr CInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CInt)
    IO (AttrList, Text, Char) -> IO () -> IO (AttrList, Text, Char)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ CString
-> Int32
-> CInt
-> Ptr (Ptr AttrList)
-> Ptr CString
-> Ptr CInt
-> Ptr (Ptr GError)
-> IO CInt
pango_parse_markup CString
markupText' Int32
length_ CInt
accelMarker' Ptr (Ptr AttrList)
attrList Ptr CString
text Ptr CInt
accelChar
        Ptr AttrList
attrList' <- Ptr (Ptr AttrList) -> IO (Ptr AttrList)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr AttrList)
attrList
        AttrList
attrList'' <- ((ManagedPtr AttrList -> AttrList) -> Ptr AttrList -> IO AttrList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr AttrList -> AttrList
Pango.AttrList.AttrList) Ptr AttrList
attrList'
        CString
text' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
text
        Text
text'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
text'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
        CInt
accelChar' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
accelChar
        let accelChar'' :: Char
accelChar'' = (Int -> Char
chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
accelChar'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
markupText'
        Ptr (Ptr AttrList) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr AttrList)
attrList
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
text
        Ptr CInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CInt
accelChar
        (AttrList, Text, Char) -> IO (AttrList, Text, Char)
forall (m :: * -> *) a. Monad m => a -> m a
return (AttrList
attrList'', Text
text'', Char
accelChar'')
     ) (do
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
markupText'
        Ptr (Ptr AttrList) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr AttrList)
attrList
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
text
        Ptr CInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CInt
accelChar
     )


-- function parse_enum
-- Args: [ Arg
--           { argCName = "type"
--           , argType = TBasicType TGType
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "enum type to parse, eg. %PANGO_TYPE_ELLIPSIZE_MODE."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "str"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "string to parse.  May be %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "integer to store the result in, or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "warn"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "if %TRUE, issue a g_warning() on bad input."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "possible_values"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "place to store list of possible values on failure, or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_parse_enum" pango_parse_enum :: 
    CGType ->                               -- type : TBasicType TGType
    CString ->                              -- str : TBasicType TUTF8
    Ptr Int32 ->                            -- value : TBasicType TInt
    CInt ->                                 -- warn : TBasicType TBoolean
    Ptr CString ->                          -- possible_values : TBasicType TUTF8
    IO CInt

{-# DEPRECATED parseEnum ["(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, 'P.False' is returned, a warning is issued
-- if /@warn@/ is 'P.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 'P.Nothing',
-- returned string should be freed using 'GI.GLib.Functions.free'.
-- 
-- /Since: 1.16/
parseEnum ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GType
    -- ^ /@type@/: enum type to parse, eg. @/PANGO_TYPE_ELLIPSIZE_MODE/@.
    -> Maybe (T.Text)
    -- ^ /@str@/: string to parse.  May be 'P.Nothing'.
    -> Bool
    -- ^ /@warn@/: if 'P.True', issue a @/g_warning()/@ on bad input.
    -> m ((Bool, Int32, T.Text))
    -- ^ __Returns:__ 'P.True' if /@str@/ was successfully parsed.
parseEnum :: GType -> Maybe Text -> Bool -> m (Bool, Int32, Text)
parseEnum GType
type_ Maybe Text
str Bool
warn = IO (Bool, Int32, Text) -> m (Bool, Int32, Text)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Int32, Text) -> m (Bool, Int32, Text))
-> IO (Bool, Int32, Text) -> m (Bool, Int32, Text)
forall a b. (a -> b) -> a -> b
$ do
    let type_' :: CGType
type_' = GType -> CGType
gtypeToCGType GType
type_
    CString
maybeStr <- case Maybe Text
str of
        Maybe Text
Nothing -> CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
forall a. Ptr a
nullPtr
        Just Text
jStr -> do
            CString
jStr' <- Text -> IO CString
textToCString Text
jStr
            CString -> IO CString
forall (m :: * -> *) a. Monad m => a -> m a
return CString
jStr'
    Ptr Int32
value <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    let warn' :: CInt
warn' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
warn
    Ptr CString
possibleValues <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    CInt
result <- CGType -> CString -> Ptr Int32 -> CInt -> Ptr CString -> IO CInt
pango_parse_enum CGType
type_' CString
maybeStr Ptr Int32
value CInt
warn' Ptr CString
possibleValues
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Int32
value' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
value
    CString
possibleValues' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
possibleValues
    Text
possibleValues'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
possibleValues'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
possibleValues'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
maybeStr
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
value
    Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
possibleValues
    (Bool, Int32, Text) -> IO (Bool, Int32, Text)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Int32
value', Text
possibleValues'')


-- function markup_parser_new
-- Args: [ Arg
--           { argCName = "accel_marker"
--           , argType = TBasicType TUniChar
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "character that precedes an accelerator, or 0 for none"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "GLib" , name = "MarkupParseContext" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_markup_parser_new" pango_markup_parser_new :: 
    CInt ->                                 -- accel_marker : TBasicType TUniChar
    IO (Ptr GLib.MarkupParseContext.MarkupParseContext)

-- | 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 'GI.Pango.Enums.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 'GI.GLib.Structs.MarkupParseContext.markupParseContextParse'
-- on the returned t'GI.GLib.Structs.MarkupParseContext.MarkupParseContext'. When done with feeding markup
-- to the parser, use 'GI.Pango.Functions.markupParserFinish' to get the data out
-- of it, and then use 'GI.GLib.Structs.MarkupParseContext.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 'GI.Pango.Functions.parseMarkup' API is recommended instead.
-- 
-- /Since: 1.31.0/
markupParserNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    -- ^ /@accelMarker@/: character that precedes an accelerator, or 0 for none
    -> m GLib.MarkupParseContext.MarkupParseContext
    -- ^ __Returns:__ a t'GI.GLib.Structs.MarkupParseContext.MarkupParseContext' that should be
    -- destroyed with 'GI.GLib.Structs.MarkupParseContext.markupParseContextFree'.
markupParserNew :: Char -> m MarkupParseContext
markupParserNew Char
accelMarker = IO MarkupParseContext -> m MarkupParseContext
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO MarkupParseContext -> m MarkupParseContext)
-> IO MarkupParseContext -> m MarkupParseContext
forall a b. (a -> b) -> a -> b
$ do
    let accelMarker' :: CInt
accelMarker' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord) Char
accelMarker
    Ptr MarkupParseContext
result <- CInt -> IO (Ptr MarkupParseContext)
pango_markup_parser_new CInt
accelMarker'
    Text -> Ptr MarkupParseContext -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"markupParserNew" Ptr MarkupParseContext
result
    MarkupParseContext
result' <- ((ManagedPtr MarkupParseContext -> MarkupParseContext)
-> Ptr MarkupParseContext -> IO MarkupParseContext
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr MarkupParseContext -> MarkupParseContext
GLib.MarkupParseContext.MarkupParseContext) Ptr MarkupParseContext
result
    MarkupParseContext -> IO MarkupParseContext
forall (m :: * -> *) a. Monad m => a -> m a
return MarkupParseContext
result'


-- function markup_parser_finish
-- Args: [ Arg
--           { argCName = "context"
--           , argType =
--               TInterface
--                 Name { namespace = "GLib" , name = "MarkupParseContext" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "A valid parse context that was returned from pango_markup_parser_new()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attr_list"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "AttrList" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "address of return location for a #PangoAttrList, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "address of return location for text with tags stripped, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "accel_char"
--           , argType = TBasicType TUniChar
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "address of return location for accelerator char, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "pango_markup_parser_finish" pango_markup_parser_finish :: 
    Ptr GLib.MarkupParseContext.MarkupParseContext -> -- context : TInterface (Name {namespace = "GLib", name = "MarkupParseContext"})
    Ptr (Ptr Pango.AttrList.AttrList) ->    -- attr_list : TInterface (Name {namespace = "Pango", name = "AttrList"})
    Ptr CString ->                          -- text : TBasicType TUTF8
    Ptr CInt ->                             -- accel_char : TBasicType TUniChar
    Ptr (Ptr GError) ->                     -- error
    IO CInt

-- | After feeding a pango markup parser some data with 'GI.GLib.Structs.MarkupParseContext.markupParseContextParse',
-- use this function to get the list of pango attributes and text out of the
-- markup. This function will not free /@context@/, use 'GI.GLib.Structs.MarkupParseContext.markupParseContextFree'
-- to do so.
-- 
-- /Since: 1.31.0/
markupParserFinish ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.MarkupParseContext.MarkupParseContext
    -- ^ /@context@/: A valid parse context that was returned from 'GI.Pango.Functions.markupParserNew'
    -> m ((Pango.AttrList.AttrList, T.Text, Char))
    -- ^ /(Can throw 'Data.GI.Base.GError.GError')/
markupParserFinish :: MarkupParseContext -> m (AttrList, Text, Char)
markupParserFinish MarkupParseContext
context = IO (AttrList, Text, Char) -> m (AttrList, Text, Char)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (AttrList, Text, Char) -> m (AttrList, Text, Char))
-> IO (AttrList, Text, Char) -> m (AttrList, Text, Char)
forall a b. (a -> b) -> a -> b
$ do
    Ptr MarkupParseContext
context' <- MarkupParseContext -> IO (Ptr MarkupParseContext)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr MarkupParseContext
context
    Ptr (Ptr AttrList)
attrList <- IO (Ptr (Ptr AttrList))
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr (Ptr Pango.AttrList.AttrList))
    Ptr CString
text <- IO (Ptr CString)
forall a. Storable a => IO (Ptr a)
callocMem :: IO (Ptr CString)
    Ptr CInt
accelChar <- IO (Ptr CInt)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CInt)
    IO (AttrList, Text, Char) -> IO () -> IO (AttrList, Text, Char)
forall a b. IO a -> IO b -> IO a
onException (do
        CInt
_ <- (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a. (Ptr (Ptr GError) -> IO a) -> IO a
propagateGError ((Ptr (Ptr GError) -> IO CInt) -> IO CInt)
-> (Ptr (Ptr GError) -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ Ptr MarkupParseContext
-> Ptr (Ptr AttrList)
-> Ptr CString
-> Ptr CInt
-> Ptr (Ptr GError)
-> IO CInt
pango_markup_parser_finish Ptr MarkupParseContext
context' Ptr (Ptr AttrList)
attrList Ptr CString
text Ptr CInt
accelChar
        Ptr AttrList
attrList' <- Ptr (Ptr AttrList) -> IO (Ptr AttrList)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr AttrList)
attrList
        AttrList
attrList'' <- ((ManagedPtr AttrList -> AttrList) -> Ptr AttrList -> IO AttrList
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr AttrList -> AttrList
Pango.AttrList.AttrList) Ptr AttrList
attrList'
        CString
text' <- Ptr CString -> IO CString
forall a. Storable a => Ptr a -> IO a
peek Ptr CString
text
        Text
text'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
text'
        CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
        CInt
accelChar' <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CInt
accelChar
        let accelChar'' :: Char
accelChar'' = (Int -> Char
chr (Int -> Char) -> (CInt -> Int) -> CInt -> Char
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
accelChar'
        MarkupParseContext -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr MarkupParseContext
context
        Ptr (Ptr AttrList) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr AttrList)
attrList
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
text
        Ptr CInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CInt
accelChar
        (AttrList, Text, Char) -> IO (AttrList, Text, Char)
forall (m :: * -> *) a. Monad m => a -> m a
return (AttrList
attrList'', Text
text'', Char
accelChar'')
     ) (do
        Ptr (Ptr AttrList) -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr (Ptr AttrList)
attrList
        Ptr CString -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CString
text
        Ptr CInt -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CInt
accelChar
     )


-- function log2vis_get_embedding_levels
-- Args: [ Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the text to itemize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the number of bytes (not characters) to process, or -1\n            if @text is nul-terminated and the length should be calculated."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pbase_dir"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Direction" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "input base direction, and output resolved direction."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "pango_log2vis_get_embedding_levels" pango_log2vis_get_embedding_levels :: 
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    CUInt ->                                -- pbase_dir : TInterface (Name {namespace = "Pango", name = "Direction"})
    IO Word8

-- | 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/
log2visGetEmbeddingLevels ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.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.
    -> Pango.Enums.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.
log2visGetEmbeddingLevels :: Text -> Int32 -> Direction -> m Word8
log2visGetEmbeddingLevels Text
text Int32
length_ Direction
pbaseDir = IO Word8 -> m Word8
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word8 -> m Word8) -> IO Word8 -> m Word8
forall a b. (a -> b) -> a -> b
$ do
    CString
text' <- Text -> IO CString
textToCString Text
text
    let pbaseDir' :: CUInt
pbaseDir' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Direction -> Int) -> Direction -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Direction -> Int
forall a. Enum a => a -> Int
fromEnum) Direction
pbaseDir
    Word8
result <- CString -> Int32 -> CUInt -> IO Word8
pango_log2vis_get_embedding_levels CString
text' Int32
length_ CUInt
pbaseDir'
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    Word8 -> IO Word8
forall (m :: * -> *) a. Monad m => a -> m a
return Word8
result


-- function itemize_with_base_dir
-- Args: [ Arg
--           { argCName = "context"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Context" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a structure holding information that affects\n            the itemization process."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "base_dir"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Direction" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "base direction to use for bidirectional processing"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the text to itemize."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_index"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first byte in @text to process"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the number of bytes (not characters) to process\n            after @start_index. This must be >= 0."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attrs"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "AttrList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the set of attributes that apply to @text."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cached_iter"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "AttrIterator" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cached attribute iterator, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList (TInterface Name { namespace = "Pango" , name = "Item" }))
-- throws : False
-- Skip return : False

foreign import ccall "pango_itemize_with_base_dir" pango_itemize_with_base_dir :: 
    Ptr Pango.Context.Context ->            -- context : TInterface (Name {namespace = "Pango", name = "Context"})
    CUInt ->                                -- base_dir : TInterface (Name {namespace = "Pango", name = "Direction"})
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- start_index : TBasicType TInt
    Int32 ->                                -- length : TBasicType TInt
    Ptr Pango.AttrList.AttrList ->          -- attrs : TInterface (Name {namespace = "Pango", name = "AttrList"})
    Ptr Pango.AttrIterator.AttrIterator ->  -- cached_iter : TInterface (Name {namespace = "Pango", name = "AttrIterator"})
    IO (Ptr (GList (Ptr Pango.Item.Item)))

-- | Like 'GI.Pango.Functions.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 t'GI.Pango.Objects.Context.Context'.
-- 
-- /Since: 1.4/
itemizeWithBaseDir ::
    (B.CallStack.HasCallStack, MonadIO m, Pango.Context.IsContext a) =>
    a
    -- ^ /@context@/: a structure holding information that affects
    --             the itemization process.
    -> Pango.Enums.Direction
    -- ^ /@baseDir@/: base direction to use for bidirectional processing
    -> T.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.
    -> Pango.AttrList.AttrList
    -- ^ /@attrs@/: the set of attributes that apply to /@text@/.
    -> Maybe (Pango.AttrIterator.AttrIterator)
    -- ^ /@cachedIter@/: Cached attribute iterator, or 'P.Nothing'
    -> m [Pango.Item.Item]
    -- ^ __Returns:__ a t'GI.GLib.Structs.List.List' of
    --               t'GI.Pango.Structs.Item.Item' structures.  The items should be freed using
    --               'GI.Pango.Structs.Item.itemFree' probably in combination with
    --               @/g_list_foreach()/@, and the list itself using @/g_list_free()/@.
itemizeWithBaseDir :: a
-> Direction
-> Text
-> Int32
-> Int32
-> AttrList
-> Maybe AttrIterator
-> m [Item]
itemizeWithBaseDir a
context Direction
baseDir Text
text Int32
startIndex Int32
length_ AttrList
attrs Maybe AttrIterator
cachedIter = IO [Item] -> m [Item]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Item] -> m [Item]) -> IO [Item] -> m [Item]
forall a b. (a -> b) -> a -> b
$ do
    Ptr Context
context' <- a -> IO (Ptr Context)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
    let baseDir' :: CUInt
baseDir' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Direction -> Int) -> Direction -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Direction -> Int
forall a. Enum a => a -> Int
fromEnum) Direction
baseDir
    CString
text' <- Text -> IO CString
textToCString Text
text
    Ptr AttrList
attrs' <- AttrList -> IO (Ptr AttrList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AttrList
attrs
    Ptr AttrIterator
maybeCachedIter <- case Maybe AttrIterator
cachedIter of
        Maybe AttrIterator
Nothing -> Ptr AttrIterator -> IO (Ptr AttrIterator)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr AttrIterator
forall a. Ptr a
nullPtr
        Just AttrIterator
jCachedIter -> do
            Ptr AttrIterator
jCachedIter' <- AttrIterator -> IO (Ptr AttrIterator)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AttrIterator
jCachedIter
            Ptr AttrIterator -> IO (Ptr AttrIterator)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr AttrIterator
jCachedIter'
    Ptr (GList (Ptr Item))
result <- Ptr Context
-> CUInt
-> CString
-> Int32
-> Int32
-> Ptr AttrList
-> Ptr AttrIterator
-> IO (Ptr (GList (Ptr Item)))
pango_itemize_with_base_dir Ptr Context
context' CUInt
baseDir' CString
text' Int32
startIndex Int32
length_ Ptr AttrList
attrs' Ptr AttrIterator
maybeCachedIter
    [Ptr Item]
result' <- Ptr (GList (Ptr Item)) -> IO [Ptr Item]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr Item))
result
    [Item]
result'' <- (Ptr Item -> IO Item) -> [Ptr Item] -> IO [Item]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr Item -> Item) -> Ptr Item -> IO Item
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Item -> Item
Pango.Item.Item) [Ptr Item]
result'
    Ptr (GList (Ptr Item)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr Item))
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
    AttrList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AttrList
attrs
    Maybe AttrIterator -> (AttrIterator -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe AttrIterator
cachedIter AttrIterator -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    [Item] -> IO [Item]
forall (m :: * -> *) a. Monad m => a -> m a
return [Item]
result''


-- function itemize
-- Args: [ Arg
--           { argCName = "context"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Context" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a structure holding information that affects\n\t       the itemization process."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the text to itemize. Must be valid UTF-8"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "start_index"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "first byte in @text to process"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the number of bytes (not characters) to process\n            after @start_index.\n            This must be >= 0."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attrs"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "AttrList" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the set of attributes that apply to @text."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "cached_iter"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "AttrIterator" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "Cached attribute iterator, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TGList (TInterface Name { namespace = "Pango" , name = "Item" }))
-- throws : False
-- Skip return : False

foreign import ccall "pango_itemize" pango_itemize :: 
    Ptr Pango.Context.Context ->            -- context : TInterface (Name {namespace = "Pango", name = "Context"})
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- start_index : TBasicType TInt
    Int32 ->                                -- length : TBasicType TInt
    Ptr Pango.AttrList.AttrList ->          -- attrs : TInterface (Name {namespace = "Pango", name = "AttrList"})
    Ptr Pango.AttrIterator.AttrIterator ->  -- cached_iter : TInterface (Name {namespace = "Pango", name = "AttrIterator"})
    IO (Ptr (GList (Ptr Pango.Item.Item)))

-- | 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@/).
itemize ::
    (B.CallStack.HasCallStack, MonadIO m, Pango.Context.IsContext a) =>
    a
    -- ^ /@context@/: a structure holding information that affects
    -- 	       the itemization process.
    -> T.Text
    -- ^ /@text@/: the text to itemize. Must be valid UTF-8
    -> Int32
    -- ^ /@startIndex@/: first byte in /@text@/ to process
    -> Int32
    -- ^ /@length@/: the number of bytes (not characters) to process
    --             after /@startIndex@/.
    --             This must be >= 0.
    -> Pango.AttrList.AttrList
    -- ^ /@attrs@/: the set of attributes that apply to /@text@/.
    -> Maybe (Pango.AttrIterator.AttrIterator)
    -- ^ /@cachedIter@/: Cached attribute iterator, or 'P.Nothing'
    -> m [Pango.Item.Item]
    -- ^ __Returns:__ a t'GI.GLib.Structs.List.List' of t'GI.Pango.Structs.Item.Item'
    --               structures. The items should be freed using 'GI.Pango.Structs.Item.itemFree'
    --               probably in combination with @/g_list_foreach()/@, and the list itself
    --               using @/g_list_free()/@.
itemize :: a
-> Text
-> Int32
-> Int32
-> AttrList
-> Maybe AttrIterator
-> m [Item]
itemize a
context Text
text Int32
startIndex Int32
length_ AttrList
attrs Maybe AttrIterator
cachedIter = IO [Item] -> m [Item]
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Item] -> m [Item]) -> IO [Item] -> m [Item]
forall a b. (a -> b) -> a -> b
$ do
    Ptr Context
context' <- a -> IO (Ptr Context)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
    CString
text' <- Text -> IO CString
textToCString Text
text
    Ptr AttrList
attrs' <- AttrList -> IO (Ptr AttrList)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AttrList
attrs
    Ptr AttrIterator
maybeCachedIter <- case Maybe AttrIterator
cachedIter of
        Maybe AttrIterator
Nothing -> Ptr AttrIterator -> IO (Ptr AttrIterator)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr AttrIterator
forall a. Ptr a
nullPtr
        Just AttrIterator
jCachedIter -> do
            Ptr AttrIterator
jCachedIter' <- AttrIterator -> IO (Ptr AttrIterator)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr AttrIterator
jCachedIter
            Ptr AttrIterator -> IO (Ptr AttrIterator)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr AttrIterator
jCachedIter'
    Ptr (GList (Ptr Item))
result <- Ptr Context
-> CString
-> Int32
-> Int32
-> Ptr AttrList
-> Ptr AttrIterator
-> IO (Ptr (GList (Ptr Item)))
pango_itemize Ptr Context
context' CString
text' Int32
startIndex Int32
length_ Ptr AttrList
attrs' Ptr AttrIterator
maybeCachedIter
    [Ptr Item]
result' <- Ptr (GList (Ptr Item)) -> IO [Ptr Item]
forall a. Ptr (GList (Ptr a)) -> IO [Ptr a]
unpackGList Ptr (GList (Ptr Item))
result
    [Item]
result'' <- (Ptr Item -> IO Item) -> [Ptr Item] -> IO [Item]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM ((ManagedPtr Item -> Item) -> Ptr Item -> IO Item
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Item -> Item
Pango.Item.Item) [Ptr Item]
result'
    Ptr (GList (Ptr Item)) -> IO ()
forall a. Ptr (GList a) -> IO ()
g_list_free Ptr (GList (Ptr Item))
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
context
    AttrList -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr AttrList
attrs
    Maybe AttrIterator -> (AttrIterator -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe AttrIterator
cachedIter AttrIterator -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    [Item] -> IO [Item]
forall (m :: * -> *) a. Monad m => a -> m a
return [Item]
result''


-- function is_zero_width
-- Args: [ Arg
--           { argCName = "ch"
--           , argType = TBasicType TUniChar
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a Unicode character"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_is_zero_width" pango_is_zero_width :: 
    CInt ->                                 -- ch : TBasicType TUniChar
    IO CInt

-- | 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 'GI.GLib.Functions.unicharIszerowidth'
-- and is at best misnamed.
-- 
-- /Since: 1.10/
isZeroWidth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    -- ^ /@ch@/: a Unicode character
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@ch@/ is a zero-width character, 'P.False' otherwise
isZeroWidth :: Char -> m Bool
isZeroWidth Char
ch = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    let ch' :: CInt
ch' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord) Char
ch
    CInt
result <- CInt -> IO CInt
pango_is_zero_width CInt
ch'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function get_mirror_char
-- Args: [ Arg
--           { argCName = "ch"
--           , argType = TBasicType TUniChar
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a Unicode character"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "mirrored_ch"
--           , argType = TBasicType TUniChar
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "location to store the mirrored character"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "pango_get_mirror_char" pango_get_mirror_char :: 
    CInt ->                                 -- ch : TBasicType TUniChar
    CInt ->                                 -- mirrored_ch : TBasicType TUniChar
    IO CInt

-- | 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 'GI.GLib.Functions.unicharGetMirrorChar' instead; the docs for that function
-- provide full details.
getMirrorChar ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Char
    -- ^ /@ch@/: a Unicode character
    -> Char
    -- ^ /@mirroredCh@/: location to store the mirrored character
    -> m Bool
    -- ^ __Returns:__ 'P.True' if /@ch@/ has a mirrored character and /@mirroredCh@/ is
    -- filled in, 'P.False' otherwise
getMirrorChar :: Char -> Char -> m Bool
getMirrorChar Char
ch Char
mirroredCh = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    let ch' :: CInt
ch' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord) Char
ch
    let mirroredCh' :: CInt
mirroredCh' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
ord) Char
mirroredCh
    CInt
result <- CInt -> CInt -> IO CInt
pango_get_mirror_char CInt
ch' CInt
mirroredCh'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'


-- function get_log_attrs
-- Args: [ Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text to process. Must be valid UTF-8"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length in bytes of @text"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "level"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "embedding level, or -1 if unknown"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "language"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Language" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "language tag" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "log_attrs"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 5
--                 (TInterface Name { namespace = "Pango" , name = "LogAttr" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "array with one #PangoLogAttr\n  per character in @text, plus one extra, to be filled in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attrs_len"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "length of @log_attrs array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "attrs_len"
--              , argType = TBasicType TInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "length of @log_attrs array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_get_log_attrs" pango_get_log_attrs :: 
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    Int32 ->                                -- level : TBasicType TInt
    Ptr Pango.Language.Language ->          -- language : TInterface (Name {namespace = "Pango", name = "Language"})
    Ptr Pango.LogAttr.LogAttr ->            -- log_attrs : TCArray False (-1) 5 (TInterface (Name {namespace = "Pango", name = "LogAttr"}))
    Int32 ->                                -- attrs_len : TBasicType TInt
    IO ()

-- | Computes a t'GI.Pango.Structs.LogAttr.LogAttr' for each character in /@text@/. The /@logAttrs@/
-- array must have one t'GI.Pango.Structs.LogAttr.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).
getLogAttrs ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@text@/: text to process. Must be valid UTF-8
    -> Int32
    -- ^ /@length@/: length in bytes of /@text@/
    -> Int32
    -- ^ /@level@/: embedding level, or -1 if unknown
    -> Pango.Language.Language
    -- ^ /@language@/: language tag
    -> [Pango.LogAttr.LogAttr]
    -- ^ /@logAttrs@/: array with one t'GI.Pango.Structs.LogAttr.LogAttr'
    --   per character in /@text@/, plus one extra, to be filled in
    -> m ()
getLogAttrs :: Text -> Int32 -> Int32 -> Language -> [LogAttr] -> m ()
getLogAttrs Text
text Int32
length_ Int32
level Language
language [LogAttr]
logAttrs = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let attrsLen :: Int32
attrsLen = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [LogAttr] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [LogAttr]
logAttrs
    CString
text' <- Text -> IO CString
textToCString Text
text
    Ptr Language
language' <- Language -> IO (Ptr Language)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Language
language
    [Ptr LogAttr]
logAttrs' <- (LogAttr -> IO (Ptr LogAttr)) -> [LogAttr] -> IO [Ptr LogAttr]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM LogAttr -> IO (Ptr LogAttr)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [LogAttr]
logAttrs
    Ptr LogAttr
logAttrs'' <- Int -> [Ptr LogAttr] -> IO (Ptr LogAttr)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray Int
52 [Ptr LogAttr]
logAttrs'
    CString
-> Int32 -> Int32 -> Ptr Language -> Ptr LogAttr -> Int32 -> IO ()
pango_get_log_attrs CString
text' Int32
length_ Int32
level Ptr Language
language' Ptr LogAttr
logAttrs'' Int32
attrsLen
    Language -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Language
language
    (LogAttr -> IO ()) -> [LogAttr] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ LogAttr -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [LogAttr]
logAttrs
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    Ptr LogAttr -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr LogAttr
logAttrs''
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function find_paragraph_boundary
-- Args: [ Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "UTF-8 text" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "length of @text in bytes, or -1 if nul-terminated"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "paragraph_delimiter_index"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for index of\n  delimiter"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "next_paragraph_start"
--           , argType = TBasicType TInt
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for start of next\n  paragraph"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_find_paragraph_boundary" pango_find_paragraph_boundary :: 
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    Ptr Int32 ->                            -- paragraph_delimiter_index : TBasicType TInt
    Ptr Int32 ->                            -- next_paragraph_start : TBasicType TInt
    IO ()

-- | 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).
findParagraphBoundary ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@text@/: UTF-8 text
    -> Int32
    -- ^ /@length@/: length of /@text@/ in bytes, or -1 if nul-terminated
    -> m ((Int32, Int32))
findParagraphBoundary :: Text -> Int32 -> m (Int32, Int32)
findParagraphBoundary Text
text Int32
length_ = IO (Int32, Int32) -> m (Int32, Int32)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Int32) -> m (Int32, Int32))
-> IO (Int32, Int32) -> m (Int32, Int32)
forall a b. (a -> b) -> a -> b
$ do
    CString
text' <- Text -> IO CString
textToCString Text
text
    Ptr Int32
paragraphDelimiterIndex <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    Ptr Int32
nextParagraphStart <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
    CString -> Int32 -> Ptr Int32 -> Ptr Int32 -> IO ()
pango_find_paragraph_boundary CString
text' Int32
length_ Ptr Int32
paragraphDelimiterIndex Ptr Int32
nextParagraphStart
    Int32
paragraphDelimiterIndex' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
paragraphDelimiterIndex
    Int32
nextParagraphStart' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
nextParagraphStart
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
paragraphDelimiterIndex
    Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
nextParagraphStart
    (Int32, Int32) -> IO (Int32, Int32)
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
paragraphDelimiterIndex', Int32
nextParagraphStart')


-- function find_base_dir
-- Args: [ Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the text to process. Must be valid UTF-8"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "length of @text in bytes (may be -1 if @text is nul-terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Direction" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_find_base_dir" pango_find_base_dir :: 
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    IO CUInt

-- | Searches a string the first character that has a strong
-- direction, according to the Unicode bidirectional algorithm.
-- 
-- /Since: 1.4/
findBaseDir ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@text@/: the text to process. Must be valid UTF-8
    -> Int32
    -- ^ /@length@/: length of /@text@/ in bytes (may be -1 if /@text@/ is nul-terminated)
    -> m Pango.Enums.Direction
    -- ^ __Returns:__ The direction corresponding to the first strong character.
    -- If no such character is found, then 'GI.Pango.Enums.DirectionNeutral' is returned.
findBaseDir :: Text -> Int32 -> m Direction
findBaseDir Text
text Int32
length_ = IO Direction -> m Direction
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Direction -> m Direction) -> IO Direction -> m Direction
forall a b. (a -> b) -> a -> b
$ do
    CString
text' <- Text -> IO CString
textToCString Text
text
    CUInt
result <- CString -> Int32 -> IO CUInt
pango_find_base_dir CString
text' Int32
length_
    let result' :: Direction
result' = (Int -> Direction
forall a. Enum a => Int -> a
toEnum (Int -> Direction) -> (CUInt -> Int) -> CUInt -> Direction
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    Direction -> IO Direction
forall (m :: * -> *) a. Monad m => a -> m a
return Direction
result'


-- function extents_to_pixels
-- Args: [ Arg
--           { argCName = "inclusive"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Rectangle" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "rectangle to round to pixels inclusively, or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "nearest"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Rectangle" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "rectangle to round to nearest pixels, or %NULL."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_extents_to_pixels" pango_extents_to_pixels :: 
    Ptr Pango.Rectangle.Rectangle ->        -- inclusive : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    Ptr Pango.Rectangle.Rectangle ->        -- nearest : TInterface (Name {namespace = "Pango", name = "Rectangle"})
    IO ()

-- | Converts extents from Pango units to device units, dividing by the
-- 'GI.Pango.Constants.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/
extentsToPixels ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Maybe (Pango.Rectangle.Rectangle)
    -- ^ /@inclusive@/: rectangle to round to pixels inclusively, or 'P.Nothing'.
    -> Maybe (Pango.Rectangle.Rectangle)
    -- ^ /@nearest@/: rectangle to round to nearest pixels, or 'P.Nothing'.
    -> m ()
extentsToPixels :: Maybe Rectangle -> Maybe Rectangle -> m ()
extentsToPixels Maybe Rectangle
inclusive Maybe Rectangle
nearest = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Rectangle
maybeInclusive <- case Maybe Rectangle
inclusive of
        Maybe Rectangle
Nothing -> Ptr Rectangle -> IO (Ptr Rectangle)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Rectangle
forall a. Ptr a
nullPtr
        Just Rectangle
jInclusive -> do
            Ptr Rectangle
jInclusive' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
jInclusive
            Ptr Rectangle -> IO (Ptr Rectangle)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Rectangle
jInclusive'
    Ptr Rectangle
maybeNearest <- case Maybe Rectangle
nearest of
        Maybe Rectangle
Nothing -> Ptr Rectangle -> IO (Ptr Rectangle)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Rectangle
forall a. Ptr a
nullPtr
        Just Rectangle
jNearest -> do
            Ptr Rectangle
jNearest' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
jNearest
            Ptr Rectangle -> IO (Ptr Rectangle)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Rectangle
jNearest'
    Ptr Rectangle -> Ptr Rectangle -> IO ()
pango_extents_to_pixels Ptr Rectangle
maybeInclusive Ptr Rectangle
maybeNearest
    Maybe Rectangle -> (Rectangle -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Rectangle
inclusive Rectangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe Rectangle -> (Rectangle -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Rectangle
nearest Rectangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function default_break
-- Args: [ Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "text to break. Must be valid UTF-8"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "length of text in bytes (may be -1 if @text is nul-terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "analysis"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Analysis" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PangoAnalysis for the @text"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attrs"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "LogAttr" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "logical attributes to fill in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attrs_len"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "size of the array passed as @attrs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_default_break" pango_default_break :: 
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    Ptr Pango.Analysis.Analysis ->          -- analysis : TInterface (Name {namespace = "Pango", name = "Analysis"})
    Ptr Pango.LogAttr.LogAttr ->            -- attrs : TInterface (Name {namespace = "Pango", name = "LogAttr"})
    Int32 ->                                -- attrs_len : TBasicType TInt
    IO ()

-- | This is the default break algorithm. It applies Unicode
-- rules without language-specific tailoring, therefore
-- the /@analyis@/ argument is unused and can be 'P.Nothing'.
-- 
-- See 'GI.Pango.Functions.tailorBreak' for language-specific breaks.
defaultBreak ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@text@/: text to break. Must be valid UTF-8
    -> Int32
    -- ^ /@length@/: length of text in bytes (may be -1 if /@text@/ is nul-terminated)
    -> Maybe (Pango.Analysis.Analysis)
    -- ^ /@analysis@/: a t'GI.Pango.Structs.Analysis.Analysis' for the /@text@/
    -> Pango.LogAttr.LogAttr
    -- ^ /@attrs@/: logical attributes to fill in
    -> Int32
    -- ^ /@attrsLen@/: size of the array passed as /@attrs@/
    -> m ()
defaultBreak :: Text -> Int32 -> Maybe Analysis -> LogAttr -> Int32 -> m ()
defaultBreak Text
text Int32
length_ Maybe Analysis
analysis LogAttr
attrs Int32
attrsLen = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    CString
text' <- Text -> IO CString
textToCString Text
text
    Ptr Analysis
maybeAnalysis <- case Maybe Analysis
analysis of
        Maybe Analysis
Nothing -> Ptr Analysis -> IO (Ptr Analysis)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Analysis
forall a. Ptr a
nullPtr
        Just Analysis
jAnalysis -> do
            Ptr Analysis
jAnalysis' <- Analysis -> IO (Ptr Analysis)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
jAnalysis
            Ptr Analysis -> IO (Ptr Analysis)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Analysis
jAnalysis'
    Ptr LogAttr
attrs' <- LogAttr -> IO (Ptr LogAttr)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr LogAttr
attrs
    CString -> Int32 -> Ptr Analysis -> Ptr LogAttr -> Int32 -> IO ()
pango_default_break CString
text' Int32
length_ Ptr Analysis
maybeAnalysis Ptr LogAttr
attrs' Int32
attrsLen
    Maybe Analysis -> (Analysis -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Analysis
analysis Analysis -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    LogAttr -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr LogAttr
attrs
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function break
-- Args: [ Arg
--           { argCName = "text"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the text to process. Must be valid UTF-8"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "length"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "length of @text in bytes (may be -1 if @text is nul-terminated)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "analysis"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Analysis" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#PangoAnalysis structure from pango_itemize()"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attrs"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 4
--                 (TInterface Name { namespace = "Pango" , name = "LogAttr" })
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "an array to store character\n            information in"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "attrs_len"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "size of the array passed as @attrs"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "attrs_len"
--              , argType = TBasicType TInt
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "size of the array passed as @attrs"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "pango_break" pango_break :: 
    CString ->                              -- text : TBasicType TUTF8
    Int32 ->                                -- length : TBasicType TInt
    Ptr Pango.Analysis.Analysis ->          -- analysis : TInterface (Name {namespace = "Pango", name = "Analysis"})
    Ptr Pango.LogAttr.LogAttr ->            -- attrs : TCArray False (-1) 4 (TInterface (Name {namespace = "Pango", name = "LogAttr"}))
    Int32 ->                                -- attrs_len : TBasicType TInt
    IO ()

{-# DEPRECATED break ["(Since version 1.44)","Use 'GI.Pango.Functions.defaultBreak' and 'GI.Pango.Functions.tailorBreak'"] #-}
-- | 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 'GI.Pango.Functions.getLogAttrs'.
break ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@text@/: the text to process. Must be valid UTF-8
    -> Int32
    -- ^ /@length@/: length of /@text@/ in bytes (may be -1 if /@text@/ is nul-terminated)
    -> Pango.Analysis.Analysis
    -- ^ /@analysis@/: t'GI.Pango.Structs.Analysis.Analysis' structure from 'GI.Pango.Functions.itemize'
    -> [Pango.LogAttr.LogAttr]
    -- ^ /@attrs@/: an array to store character
    --             information in
    -> m ()
break :: Text -> Int32 -> Analysis -> [LogAttr] -> m ()
break Text
text Int32
length_ Analysis
analysis [LogAttr]
attrs = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    let attrsLen :: Int32
attrsLen = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [LogAttr] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [LogAttr]
attrs
    CString
text' <- Text -> IO CString
textToCString Text
text
    Ptr Analysis
analysis' <- Analysis -> IO (Ptr Analysis)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Analysis
analysis
    [Ptr LogAttr]
attrs' <- (LogAttr -> IO (Ptr LogAttr)) -> [LogAttr] -> IO [Ptr LogAttr]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM LogAttr -> IO (Ptr LogAttr)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [LogAttr]
attrs
    Ptr LogAttr
attrs'' <- Int -> [Ptr LogAttr] -> IO (Ptr LogAttr)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray Int
52 [Ptr LogAttr]
attrs'
    CString -> Int32 -> Ptr Analysis -> Ptr LogAttr -> Int32 -> IO ()
pango_break CString
text' Int32
length_ Ptr Analysis
analysis' Ptr LogAttr
attrs'' Int32
attrsLen
    Analysis -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Analysis
analysis
    (LogAttr -> IO ()) -> [LogAttr] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ LogAttr -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [LogAttr]
attrs
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
text'
    Ptr LogAttr -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr LogAttr
attrs''
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()


-- function attr_weight_new
-- Args: [ Arg
--           { argCName = "weight"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Weight" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the weight" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_weight_new" pango_attr_weight_new :: 
    CUInt ->                                -- weight : TInterface (Name {namespace = "Pango", name = "Weight"})
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new font weight attribute.
attrWeightNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Pango.Enums.Weight
    -- ^ /@weight@/: the weight
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrWeightNew :: Weight -> m Attribute
attrWeightNew Weight
weight = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let weight' :: CUInt
weight' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Weight -> Int) -> Weight -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Weight -> Int
forall a. Enum a => a -> Int
fromEnum) Weight
weight
    Ptr Attribute
result <- CUInt -> IO (Ptr Attribute)
pango_attr_weight_new CUInt
weight'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrWeightNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_variant_new
-- Args: [ Arg
--           { argCName = "variant"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Variant" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the variant" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_variant_new" pango_attr_variant_new :: 
    CUInt ->                                -- variant : TInterface (Name {namespace = "Pango", name = "Variant"})
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new font variant attribute (normal or small caps)
attrVariantNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Pango.Enums.Variant
    -- ^ /@variant@/: the variant
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrVariantNew :: Variant -> m Attribute
attrVariantNew Variant
variant = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let variant' :: CUInt
variant' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Variant -> Int) -> Variant -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Variant -> Int
forall a. Enum a => a -> Int
fromEnum) Variant
variant
    Ptr Attribute
result <- CUInt -> IO (Ptr Attribute)
pango_attr_variant_new CUInt
variant'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrVariantNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_underline_new
-- Args: [ Arg
--           { argCName = "underline"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Underline" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the underline style."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_underline_new" pango_attr_underline_new :: 
    CUInt ->                                -- underline : TInterface (Name {namespace = "Pango", name = "Underline"})
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new underline-style attribute.
attrUnderlineNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Pango.Enums.Underline
    -- ^ /@underline@/: the underline style.
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrUnderlineNew :: Underline -> m Attribute
attrUnderlineNew Underline
underline = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let underline' :: CUInt
underline' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Underline -> Int) -> Underline -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Underline -> Int
forall a. Enum a => a -> Int
fromEnum) Underline
underline
    Ptr Attribute
result <- CUInt -> IO (Ptr Attribute)
pango_attr_underline_new CUInt
underline'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrUnderlineNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_underline_color_new
-- Args: [ Arg
--           { argCName = "red"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the red value (ranging from 0 to 65535)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "green"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the green value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "blue"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the blue value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_underline_color_new" pango_attr_underline_color_new :: 
    Word16 ->                               -- red : TBasicType TUInt16
    Word16 ->                               -- green : TBasicType TUInt16
    Word16 ->                               -- blue : TBasicType TUInt16
    IO (Ptr Pango.Attribute.Attribute)

-- | 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/
attrUnderlineColorNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    -- ^ /@red@/: the red value (ranging from 0 to 65535)
    -> Word16
    -- ^ /@green@/: the green value
    -> Word16
    -- ^ /@blue@/: the blue value
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrUnderlineColorNew :: Word16 -> Word16 -> Word16 -> m Attribute
attrUnderlineColorNew Word16
red Word16
green Word16
blue = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attribute
result <- Word16 -> Word16 -> Word16 -> IO (Ptr Attribute)
pango_attr_underline_color_new Word16
red Word16
green Word16
blue
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrUnderlineColorNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_style_new
-- Args: [ Arg
--           { argCName = "style"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Style" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the slant style" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_style_new" pango_attr_style_new :: 
    CUInt ->                                -- style : TInterface (Name {namespace = "Pango", name = "Style"})
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new font slant style attribute.
attrStyleNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Pango.Enums.Style
    -- ^ /@style@/: the slant style
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrStyleNew :: Style -> m Attribute
attrStyleNew Style
style = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let style' :: CUInt
style' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Style -> Int) -> Style -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Style -> Int
forall a. Enum a => a -> Int
fromEnum) Style
style
    Ptr Attribute
result <- CUInt -> IO (Ptr Attribute)
pango_attr_style_new CUInt
style'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrStyleNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_strikethrough_new
-- Args: [ Arg
--           { argCName = "strikethrough"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%TRUE if the text should be struck-through."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_strikethrough_new" pango_attr_strikethrough_new :: 
    CInt ->                                 -- strikethrough : TBasicType TBoolean
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new strike-through attribute.
attrStrikethroughNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@strikethrough@/: 'P.True' if the text should be struck-through.
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrStrikethroughNew :: Bool -> m Attribute
attrStrikethroughNew Bool
strikethrough = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let strikethrough' :: CInt
strikethrough' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
strikethrough
    Ptr Attribute
result <- CInt -> IO (Ptr Attribute)
pango_attr_strikethrough_new CInt
strikethrough'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrStrikethroughNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_strikethrough_color_new
-- Args: [ Arg
--           { argCName = "red"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the red value (ranging from 0 to 65535)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "green"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the green value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "blue"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the blue value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_strikethrough_color_new" pango_attr_strikethrough_color_new :: 
    Word16 ->                               -- red : TBasicType TUInt16
    Word16 ->                               -- green : TBasicType TUInt16
    Word16 ->                               -- blue : TBasicType TUInt16
    IO (Ptr Pango.Attribute.Attribute)

-- | 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/
attrStrikethroughColorNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    -- ^ /@red@/: the red value (ranging from 0 to 65535)
    -> Word16
    -- ^ /@green@/: the green value
    -> Word16
    -- ^ /@blue@/: the blue value
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrStrikethroughColorNew :: Word16 -> Word16 -> Word16 -> m Attribute
attrStrikethroughColorNew Word16
red Word16
green Word16
blue = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attribute
result <- Word16 -> Word16 -> Word16 -> IO (Ptr Attribute)
pango_attr_strikethrough_color_new Word16
red Word16
green Word16
blue
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrStrikethroughColorNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_stretch_new
-- Args: [ Arg
--           { argCName = "stretch"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Stretch" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the stretch" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_stretch_new" pango_attr_stretch_new :: 
    CUInt ->                                -- stretch : TInterface (Name {namespace = "Pango", name = "Stretch"})
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new font stretch attribute
attrStretchNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Pango.Enums.Stretch
    -- ^ /@stretch@/: the stretch
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrStretchNew :: Stretch -> m Attribute
attrStretchNew Stretch
stretch = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let stretch' :: CUInt
stretch' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Stretch -> Int) -> Stretch -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Stretch -> Int
forall a. Enum a => a -> Int
fromEnum) Stretch
stretch
    Ptr Attribute
result <- CUInt -> IO (Ptr Attribute)
pango_attr_stretch_new CUInt
stretch'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrStretchNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_show_new
-- Args: [ Arg
--           { argCName = "flags"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "ShowFlags" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "#PangoShowFlags to apply"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_show_new" pango_attr_show_new :: 
    CUInt ->                                -- flags : TInterface (Name {namespace = "Pango", name = "ShowFlags"})
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new attribute that influences how invisible
-- characters are rendered.
-- 
-- /Since: 1.44/
attrShowNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    [Pango.Flags.ShowFlags]
    -- ^ /@flags@/: t'GI.Pango.Flags.ShowFlags' to apply
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrShowNew :: [ShowFlags] -> m Attribute
attrShowNew [ShowFlags]
flags = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let flags' :: CUInt
flags' = [ShowFlags] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ShowFlags]
flags
    Ptr Attribute
result <- CUInt -> IO (Ptr Attribute)
pango_attr_show_new CUInt
flags'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrShowNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_scale_new
-- Args: [ Arg
--           { argCName = "scale_factor"
--           , argType = TBasicType TDouble
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "factor to scale the font"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_scale_new" pango_attr_scale_new :: 
    CDouble ->                              -- scale_factor : TBasicType TDouble
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new font size scale attribute. The base font for the
-- affected text will have its size multiplied by /@scaleFactor@/.
attrScaleNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Double
    -- ^ /@scaleFactor@/: factor to scale the font
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrScaleNew :: Double -> m Attribute
attrScaleNew Double
scaleFactor = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let scaleFactor' :: CDouble
scaleFactor' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
scaleFactor
    Ptr Attribute
result <- CDouble -> IO (Ptr Attribute)
pango_attr_scale_new CDouble
scaleFactor'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrScaleNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_rise_new
-- Args: [ Arg
--           { argCName = "rise"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the amount that the text should be displaced vertically,\n       in Pango units. Positive values displace the text upwards."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_rise_new" pango_attr_rise_new :: 
    Int32 ->                                -- rise : TBasicType TInt
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new baseline displacement attribute.
attrRiseNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@rise@/: the amount that the text should be displaced vertically,
    --        in Pango units. Positive values displace the text upwards.
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrRiseNew :: Int32 -> m Attribute
attrRiseNew Int32
rise = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attribute
result <- Int32 -> IO (Ptr Attribute)
pango_attr_rise_new Int32
rise
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrRiseNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_letter_spacing_new
-- Args: [ Arg
--           { argCName = "letter_spacing"
--           , argType = TBasicType TInt
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "amount of extra space to add between graphemes\n  of the text, in Pango units."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_letter_spacing_new" pango_attr_letter_spacing_new :: 
    Int32 ->                                -- letter_spacing : TBasicType TInt
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new letter-spacing attribute.
-- 
-- /Since: 1.6/
attrLetterSpacingNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Int32
    -- ^ /@letterSpacing@/: amount of extra space to add between graphemes
    --   of the text, in Pango units.
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrLetterSpacingNew :: Int32 -> m Attribute
attrLetterSpacingNew Int32
letterSpacing = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attribute
result <- Int32 -> IO (Ptr Attribute)
pango_attr_letter_spacing_new Int32
letterSpacing
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrLetterSpacingNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_insert_hyphens_new
-- Args: [ Arg
--           { argCName = "insert_hyphens"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%TRUE if hyphens should be inserted"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_insert_hyphens_new" pango_attr_insert_hyphens_new :: 
    CInt ->                                 -- insert_hyphens : TBasicType TBoolean
    IO (Ptr Pango.Attribute.Attribute)

-- | 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/
attrInsertHyphensNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@insertHyphens@/: 'P.True' if hyphens should be inserted
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'
attrInsertHyphensNew :: Bool -> m Attribute
attrInsertHyphensNew Bool
insertHyphens = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let insertHyphens' :: CInt
insertHyphens' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
insertHyphens
    Ptr Attribute
result <- CInt -> IO (Ptr Attribute)
pango_attr_insert_hyphens_new CInt
insertHyphens'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrInsertHyphensNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_gravity_new
-- Args: [ Arg
--           { argCName = "gravity"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "Gravity" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the gravity value; should not be %PANGO_GRAVITY_AUTO."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_gravity_new" pango_attr_gravity_new :: 
    CUInt ->                                -- gravity : TInterface (Name {namespace = "Pango", name = "Gravity"})
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new gravity attribute.
-- 
-- /Since: 1.16/
attrGravityNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Pango.Enums.Gravity
    -- ^ /@gravity@/: the gravity value; should not be 'GI.Pango.Enums.GravityAuto'.
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrGravityNew :: Gravity -> m Attribute
attrGravityNew Gravity
gravity = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let gravity' :: CUInt
gravity' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (Gravity -> Int) -> Gravity -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Gravity -> Int
forall a. Enum a => a -> Int
fromEnum) Gravity
gravity
    Ptr Attribute
result <- CUInt -> IO (Ptr Attribute)
pango_attr_gravity_new CUInt
gravity'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrGravityNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_gravity_hint_new
-- Args: [ Arg
--           { argCName = "hint"
--           , argType =
--               TInterface Name { namespace = "Pango" , name = "GravityHint" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the gravity hint value."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_gravity_hint_new" pango_attr_gravity_hint_new :: 
    CUInt ->                                -- hint : TInterface (Name {namespace = "Pango", name = "GravityHint"})
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new gravity hint attribute.
-- 
-- /Since: 1.16/
attrGravityHintNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Pango.Enums.GravityHint
    -- ^ /@hint@/: the gravity hint value.
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrGravityHintNew :: GravityHint -> m Attribute
attrGravityHintNew GravityHint
hint = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let hint' :: CUInt
hint' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (GravityHint -> Int) -> GravityHint -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. GravityHint -> Int
forall a. Enum a => a -> Int
fromEnum) GravityHint
hint
    Ptr Attribute
result <- CUInt -> IO (Ptr Attribute)
pango_attr_gravity_hint_new CUInt
hint'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrGravityHintNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_foreground_new
-- Args: [ Arg
--           { argCName = "red"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the red value (ranging from 0 to 65535)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "green"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the green value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "blue"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the blue value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_foreground_new" pango_attr_foreground_new :: 
    Word16 ->                               -- red : TBasicType TUInt16
    Word16 ->                               -- green : TBasicType TUInt16
    Word16 ->                               -- blue : TBasicType TUInt16
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new foreground color attribute.
attrForegroundNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    -- ^ /@red@/: the red value (ranging from 0 to 65535)
    -> Word16
    -- ^ /@green@/: the green value
    -> Word16
    -- ^ /@blue@/: the blue value
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrForegroundNew :: Word16 -> Word16 -> Word16 -> m Attribute
attrForegroundNew Word16
red Word16
green Word16
blue = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attribute
result <- Word16 -> Word16 -> Word16 -> IO (Ptr Attribute)
pango_attr_foreground_new Word16
red Word16
green Word16
blue
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrForegroundNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_foreground_alpha_new
-- Args: [ Arg
--           { argCName = "alpha"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the alpha value, between 1 and 65536"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_foreground_alpha_new" pango_attr_foreground_alpha_new :: 
    Word16 ->                               -- alpha : TBasicType TUInt16
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new foreground alpha attribute.
-- 
-- /Since: 1.38/
attrForegroundAlphaNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    -- ^ /@alpha@/: the alpha value, between 1 and 65536
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the new allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrForegroundAlphaNew :: Word16 -> m Attribute
attrForegroundAlphaNew Word16
alpha = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attribute
result <- Word16 -> IO (Ptr Attribute)
pango_attr_foreground_alpha_new Word16
alpha
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrForegroundAlphaNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_family_new
-- Args: [ Arg
--           { argCName = "family"
--           , argType = TBasicType TUTF8
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the family or comma separated list of families"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_family_new" pango_attr_family_new :: 
    CString ->                              -- family : TBasicType TUTF8
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new font family attribute.
attrFamilyNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    -- ^ /@family@/: the family or comma separated list of families
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrFamilyNew :: Text -> m Attribute
attrFamilyNew Text
family = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    CString
family' <- Text -> IO CString
textToCString Text
family
    Ptr Attribute
result <- CString -> IO (Ptr Attribute)
pango_attr_family_new CString
family'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrFamilyNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
family'
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_fallback_new
-- Args: [ Arg
--           { argCName = "enable_fallback"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "%TRUE if we should fall back on other fonts\n                  for characters the active font is missing."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_fallback_new" pango_attr_fallback_new :: 
    CInt ->                                 -- enable_fallback : TBasicType TBoolean
    IO (Ptr Pango.Attribute.Attribute)

-- | 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/
attrFallbackNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@enableFallback@/: 'P.True' if we should fall back on other fonts
    --                   for characters the active font is missing.
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrFallbackNew :: Bool -> m Attribute
attrFallbackNew Bool
enableFallback = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let enableFallback' :: CInt
enableFallback' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
enableFallback
    Ptr Attribute
result <- CInt -> IO (Ptr Attribute)
pango_attr_fallback_new CInt
enableFallback'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrFallbackNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_background_new
-- Args: [ Arg
--           { argCName = "red"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the red value (ranging from 0 to 65535)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "green"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the green value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "blue"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the blue value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_background_new" pango_attr_background_new :: 
    Word16 ->                               -- red : TBasicType TUInt16
    Word16 ->                               -- green : TBasicType TUInt16
    Word16 ->                               -- blue : TBasicType TUInt16
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new background color attribute.
attrBackgroundNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    -- ^ /@red@/: the red value (ranging from 0 to 65535)
    -> Word16
    -- ^ /@green@/: the green value
    -> Word16
    -- ^ /@blue@/: the blue value
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrBackgroundNew :: Word16 -> Word16 -> Word16 -> m Attribute
attrBackgroundNew Word16
red Word16
green Word16
blue = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attribute
result <- Word16 -> Word16 -> Word16 -> IO (Ptr Attribute)
pango_attr_background_new Word16
red Word16
green Word16
blue
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrBackgroundNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_background_alpha_new
-- Args: [ Arg
--           { argCName = "alpha"
--           , argType = TBasicType TUInt16
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the alpha value, between 1 and 65536"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_background_alpha_new" pango_attr_background_alpha_new :: 
    Word16 ->                               -- alpha : TBasicType TUInt16
    IO (Ptr Pango.Attribute.Attribute)

-- | Create a new background alpha attribute.
-- 
-- /Since: 1.38/
attrBackgroundAlphaNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    -- ^ /@alpha@/: the alpha value, between 1 and 65536
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the new allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'.
attrBackgroundAlphaNew :: Word16 -> m Attribute
attrBackgroundAlphaNew Word16
alpha = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    Ptr Attribute
result <- Word16 -> IO (Ptr Attribute)
pango_attr_background_alpha_new Word16
alpha
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrBackgroundAlphaNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'


-- function attr_allow_breaks_new
-- Args: [ Arg
--           { argCName = "allow_breaks"
--           , argType = TBasicType TBoolean
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "%TRUE if we line breaks are allowed"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Attribute" })
-- throws : False
-- Skip return : False

foreign import ccall "pango_attr_allow_breaks_new" pango_attr_allow_breaks_new :: 
    CInt ->                                 -- allow_breaks : TBasicType TBoolean
    IO (Ptr Pango.Attribute.Attribute)

-- | 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/
attrAllowBreaksNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Bool
    -- ^ /@allowBreaks@/: 'P.True' if we line breaks are allowed
    -> m Pango.Attribute.Attribute
    -- ^ __Returns:__ the newly allocated t'GI.Pango.Structs.Attribute.Attribute',
    --               which should be freed with 'GI.Pango.Structs.Attribute.attributeDestroy'
attrAllowBreaksNew :: Bool -> m Attribute
attrAllowBreaksNew Bool
allowBreaks = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
    let allowBreaks' :: CInt
allowBreaks' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
fromEnum) Bool
allowBreaks
    Ptr Attribute
result <- CInt -> IO (Ptr Attribute)
pango_attr_allow_breaks_new CInt
allowBreaks'
    Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrAllowBreaksNew" Ptr Attribute
result
    Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
    Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'