{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Pango.Objects.FontFamily ( -- * Exported types FontFamily(..) , FontFamilyK , toFontFamily , noFontFamily , -- * Methods -- ** fontFamilyGetName fontFamilyGetName , -- ** fontFamilyIsMonospace fontFamilyIsMonospace , -- ** fontFamilyListFaces fontFamilyListFaces , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Pango.Types import GI.Pango.Callbacks import qualified GI.GObject as GObject newtype FontFamily = FontFamily (ForeignPtr FontFamily) foreign import ccall "pango_font_family_get_type" c_pango_font_family_get_type :: IO GType type instance ParentTypes FontFamily = FontFamilyParentTypes type FontFamilyParentTypes = '[GObject.Object] instance GObject FontFamily where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_pango_font_family_get_type class GObject o => FontFamilyK o instance (GObject o, IsDescendantOf FontFamily o) => FontFamilyK o toFontFamily :: FontFamilyK o => o -> IO FontFamily toFontFamily = unsafeCastTo FontFamily noFontFamily :: Maybe FontFamily noFontFamily = Nothing type instance AttributeList FontFamily = FontFamilyAttributeList type FontFamilyAttributeList = ('[ ] :: [(Symbol, *)]) type instance SignalList FontFamily = FontFamilySignalList type FontFamilySignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method FontFamily::get_name -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontFamily", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontFamily", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "pango_font_family_get_name" pango_font_family_get_name :: Ptr FontFamily -> -- _obj : TInterface "Pango" "FontFamily" IO CString fontFamilyGetName :: (MonadIO m, FontFamilyK a) => a -> -- _obj m T.Text fontFamilyGetName _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- pango_font_family_get_name _obj' checkUnexpectedReturnNULL "pango_font_family_get_name" result result' <- cstringToText result touchManagedPtr _obj return result' -- method FontFamily::is_monospace -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontFamily", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontFamily", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TBoolean -- throws : False -- Skip return : False foreign import ccall "pango_font_family_is_monospace" pango_font_family_is_monospace :: Ptr FontFamily -> -- _obj : TInterface "Pango" "FontFamily" IO CInt fontFamilyIsMonospace :: (MonadIO m, FontFamilyK a) => a -> -- _obj m Bool fontFamilyIsMonospace _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- pango_font_family_is_monospace _obj' let result' = (/= 0) result touchManagedPtr _obj return result' -- method FontFamily::list_faces -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontFamily", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "faces", argType = TCArray False (-1) 2 (TInterface "Pango" "FontFace"), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferContainer},Arg {argName = "n_faces", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [Arg {argName = "n_faces", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontFamily", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "pango_font_family_list_faces" pango_font_family_list_faces :: Ptr FontFamily -> -- _obj : TInterface "Pango" "FontFamily" Ptr (Ptr (Ptr FontFace)) -> -- faces : TCArray False (-1) 2 (TInterface "Pango" "FontFace") Ptr Int32 -> -- n_faces : TBasicType TInt32 IO () fontFamilyListFaces :: (MonadIO m, FontFamilyK a) => a -> -- _obj m ([FontFace]) fontFamilyListFaces _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj faces <- allocMem :: IO (Ptr (Ptr (Ptr FontFace))) n_faces <- allocMem :: IO (Ptr Int32) pango_font_family_list_faces _obj' faces n_faces n_faces' <- peek n_faces faces' <- peek faces faces'' <- (unpackPtrArrayWithLength n_faces') faces' faces''' <- mapM (newObject FontFace) faces'' freeMem faces' touchManagedPtr _obj freeMem faces freeMem n_faces return faces'''