#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Pango.Objects.FontFace
(
FontFace(..) ,
IsFontFace ,
toFontFace ,
noFontFace ,
#if ENABLE_OVERLOADING
FontFaceDescribeMethodInfo ,
#endif
fontFaceDescribe ,
#if ENABLE_OVERLOADING
FontFaceGetFaceNameMethodInfo ,
#endif
fontFaceGetFaceName ,
#if ENABLE_OVERLOADING
FontFaceIsSynthesizedMethodInfo ,
#endif
fontFaceIsSynthesized ,
#if ENABLE_OVERLOADING
FontFaceListSizesMethodInfo ,
#endif
fontFaceListSizes ,
) 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.ManagedPtr as B.ManagedPtr
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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Pango.Structs.FontDescription as Pango.FontDescription
newtype FontFace = FontFace (ManagedPtr FontFace)
foreign import ccall "pango_font_face_get_type"
c_pango_font_face_get_type :: IO GType
instance GObject FontFace where
gobjectType _ = c_pango_font_face_get_type
class GObject o => IsFontFace o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError FontFace a) =>
IsFontFace a
#endif
instance IsFontFace FontFace
instance GObject.Object.IsObject FontFace
toFontFace :: (MonadIO m, IsFontFace o) => o -> m FontFace
toFontFace = liftIO . unsafeCastTo FontFace
noFontFace :: Maybe FontFace
noFontFace = Nothing
#if ENABLE_OVERLOADING
type family ResolveFontFaceMethod (t :: Symbol) (o :: *) :: * where
ResolveFontFaceMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFontFaceMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFontFaceMethod "describe" o = FontFaceDescribeMethodInfo
ResolveFontFaceMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFontFaceMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFontFaceMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFontFaceMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFontFaceMethod "isSynthesized" o = FontFaceIsSynthesizedMethodInfo
ResolveFontFaceMethod "listSizes" o = FontFaceListSizesMethodInfo
ResolveFontFaceMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFontFaceMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFontFaceMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFontFaceMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFontFaceMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFontFaceMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFontFaceMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFontFaceMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFontFaceMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFontFaceMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFontFaceMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFontFaceMethod "getFaceName" o = FontFaceGetFaceNameMethodInfo
ResolveFontFaceMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFontFaceMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFontFaceMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFontFaceMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFontFaceMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFontFaceMethod t FontFace, O.MethodInfo info FontFace p) => O.IsLabelProxy t (FontFace -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveFontFaceMethod t FontFace, O.MethodInfo info FontFace p) => O.IsLabel t (FontFace -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList FontFace
type instance O.AttributeList FontFace = FontFaceAttributeList
type FontFaceAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList FontFace = FontFaceSignalList
type FontFaceSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "pango_font_face_describe" pango_font_face_describe ::
Ptr FontFace ->
IO (Ptr Pango.FontDescription.FontDescription)
fontFaceDescribe ::
(B.CallStack.HasCallStack, MonadIO m, IsFontFace a) =>
a
-> m Pango.FontDescription.FontDescription
fontFaceDescribe face = liftIO $ do
face' <- unsafeManagedPtrCastPtr face
result <- pango_font_face_describe face'
checkUnexpectedReturnNULL "fontFaceDescribe" result
result' <- (wrapBoxed Pango.FontDescription.FontDescription) result
touchManagedPtr face
return result'
#if ENABLE_OVERLOADING
data FontFaceDescribeMethodInfo
instance (signature ~ (m Pango.FontDescription.FontDescription), MonadIO m, IsFontFace a) => O.MethodInfo FontFaceDescribeMethodInfo a signature where
overloadedMethod _ = fontFaceDescribe
#endif
foreign import ccall "pango_font_face_get_face_name" pango_font_face_get_face_name ::
Ptr FontFace ->
IO CString
fontFaceGetFaceName ::
(B.CallStack.HasCallStack, MonadIO m, IsFontFace a) =>
a
-> m T.Text
fontFaceGetFaceName face = liftIO $ do
face' <- unsafeManagedPtrCastPtr face
result <- pango_font_face_get_face_name face'
checkUnexpectedReturnNULL "fontFaceGetFaceName" result
result' <- cstringToText result
touchManagedPtr face
return result'
#if ENABLE_OVERLOADING
data FontFaceGetFaceNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsFontFace a) => O.MethodInfo FontFaceGetFaceNameMethodInfo a signature where
overloadedMethod _ = fontFaceGetFaceName
#endif
foreign import ccall "pango_font_face_is_synthesized" pango_font_face_is_synthesized ::
Ptr FontFace ->
IO CInt
fontFaceIsSynthesized ::
(B.CallStack.HasCallStack, MonadIO m, IsFontFace a) =>
a
-> m Bool
fontFaceIsSynthesized face = liftIO $ do
face' <- unsafeManagedPtrCastPtr face
result <- pango_font_face_is_synthesized face'
let result' = (/= 0) result
touchManagedPtr face
return result'
#if ENABLE_OVERLOADING
data FontFaceIsSynthesizedMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsFontFace a) => O.MethodInfo FontFaceIsSynthesizedMethodInfo a signature where
overloadedMethod _ = fontFaceIsSynthesized
#endif
foreign import ccall "pango_font_face_list_sizes" pango_font_face_list_sizes ::
Ptr FontFace ->
Ptr (Ptr Int32) ->
Ptr Int32 ->
IO ()
fontFaceListSizes ::
(B.CallStack.HasCallStack, MonadIO m, IsFontFace a) =>
a
-> m ((Maybe [Int32]))
fontFaceListSizes face = liftIO $ do
face' <- unsafeManagedPtrCastPtr face
sizes <- allocMem :: IO (Ptr (Ptr Int32))
nSizes <- allocMem :: IO (Ptr Int32)
pango_font_face_list_sizes face' sizes nSizes
nSizes' <- peek nSizes
sizes' <- peek sizes
maybeSizes' <- convertIfNonNull sizes' $ \sizes'' -> do
sizes''' <- (unpackStorableArrayWithLength nSizes') sizes''
freeMem sizes''
return sizes'''
touchManagedPtr face
freeMem sizes
freeMem nSizes
return maybeSizes'
#if ENABLE_OVERLOADING
data FontFaceListSizesMethodInfo
instance (signature ~ (m ((Maybe [Int32]))), MonadIO m, IsFontFace a) => O.MethodInfo FontFaceListSizesMethodInfo a signature where
overloadedMethod _ = fontFaceListSizes
#endif