{-# LANGUAGE TypeApplications #-}
#if !defined(__HADDOCK_VERSION__)
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Objects.Font
(
Font(..) ,
IsFont ,
toFont ,
#if defined(ENABLE_OVERLOADING)
ResolveFontMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
FontDescribeMethodInfo ,
#endif
fontDescribe ,
#if defined(ENABLE_OVERLOADING)
FontDescribeWithAbsoluteSizeMethodInfo ,
#endif
fontDescribeWithAbsoluteSize ,
fontDescriptionsFree ,
fontDeserialize ,
#if defined(ENABLE_OVERLOADING)
FontGetCoverageMethodInfo ,
#endif
fontGetCoverage ,
#if defined(ENABLE_OVERLOADING)
FontGetFaceMethodInfo ,
#endif
fontGetFace ,
#if defined(ENABLE_OVERLOADING)
FontGetFeaturesMethodInfo ,
#endif
fontGetFeatures ,
#if defined(ENABLE_OVERLOADING)
FontGetFontMapMethodInfo ,
#endif
fontGetFontMap ,
#if defined(ENABLE_OVERLOADING)
FontGetGlyphExtentsMethodInfo ,
#endif
fontGetGlyphExtents ,
#if defined(ENABLE_OVERLOADING)
FontGetLanguagesMethodInfo ,
#endif
fontGetLanguages ,
#if defined(ENABLE_OVERLOADING)
FontGetMetricsMethodInfo ,
#endif
fontGetMetrics ,
#if defined(ENABLE_OVERLOADING)
FontHasCharMethodInfo ,
#endif
fontHasChar ,
#if defined(ENABLE_OVERLOADING)
FontSerializeMethodInfo ,
#endif
fontSerialize ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.ListModel as Gio.ListModel
import qualified GI.HarfBuzz.Structs.FeatureT as HarfBuzz.FeatureT
import qualified GI.Pango.Callbacks as Pango.Callbacks
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.Objects.Coverage as Pango.Coverage
import {-# SOURCE #-} qualified GI.Pango.Objects.FontFace as Pango.FontFace
import {-# SOURCE #-} qualified GI.Pango.Objects.FontFamily as Pango.FontFamily
import {-# SOURCE #-} qualified GI.Pango.Objects.FontMap as Pango.FontMap
import {-# SOURCE #-} qualified GI.Pango.Objects.Fontset as Pango.Fontset
import {-# SOURCE #-} qualified GI.Pango.Structs.FontDescription as Pango.FontDescription
import {-# SOURCE #-} qualified GI.Pango.Structs.FontMetrics as Pango.FontMetrics
import {-# SOURCE #-} qualified GI.Pango.Structs.Language as Pango.Language
import {-# SOURCE #-} qualified GI.Pango.Structs.Matrix as Pango.Matrix
import {-# SOURCE #-} qualified GI.Pango.Structs.Rectangle as Pango.Rectangle
#else
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.HarfBuzz.Structs.FeatureT as HarfBuzz.FeatureT
import {-# SOURCE #-} qualified GI.Pango.Objects.Context as Pango.Context
import {-# SOURCE #-} qualified GI.Pango.Objects.Coverage as Pango.Coverage
import {-# SOURCE #-} qualified GI.Pango.Objects.FontFace as Pango.FontFace
import {-# SOURCE #-} qualified GI.Pango.Objects.FontMap as Pango.FontMap
import {-# SOURCE #-} qualified GI.Pango.Structs.FontDescription as Pango.FontDescription
import {-# SOURCE #-} qualified GI.Pango.Structs.FontMetrics as Pango.FontMetrics
import {-# SOURCE #-} qualified GI.Pango.Structs.Language as Pango.Language
import {-# SOURCE #-} qualified GI.Pango.Structs.Rectangle as Pango.Rectangle
#endif
newtype Font = Font (SP.ManagedPtr Font)
deriving (Font -> Font -> Bool
(Font -> Font -> Bool) -> (Font -> Font -> Bool) -> Eq Font
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Font -> Font -> Bool
== :: Font -> Font -> Bool
$c/= :: Font -> Font -> Bool
/= :: Font -> Font -> Bool
Eq)
instance SP.ManagedPtrNewtype Font where
toManagedPtr :: Font -> ManagedPtr Font
toManagedPtr (Font ManagedPtr Font
p) = ManagedPtr Font
p
foreign import ccall "pango_font_get_type"
c_pango_font_get_type :: IO B.Types.GType
instance B.Types.TypedObject Font where
glibType :: IO GType
glibType = IO GType
c_pango_font_get_type
instance B.Types.GObject Font
class (SP.GObject o, O.IsDescendantOf Font o) => IsFont o
instance (SP.GObject o, O.IsDescendantOf Font o) => IsFont o
instance O.HasParentTypes Font
type instance O.ParentTypes Font = '[GObject.Object.Object]
toFont :: (MIO.MonadIO m, IsFont o) => o -> m Font
toFont :: forall (m :: * -> *) o. (MonadIO m, IsFont o) => o -> m Font
toFont = IO Font -> m Font
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Font -> m Font) -> (o -> IO Font) -> o -> m Font
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Font -> Font) -> o -> IO Font
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Font -> Font
Font
instance B.GValue.IsGValue (Maybe Font) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_pango_font_get_type
gvalueSet_ :: Ptr GValue -> Maybe Font -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Font
P.Nothing = Ptr GValue -> Ptr Font -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Font
forall a. Ptr a
FP.nullPtr :: FP.Ptr Font)
gvalueSet_ Ptr GValue
gv (P.Just Font
obj) = Font -> (Ptr Font -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Font
obj (Ptr GValue -> Ptr Font -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Font)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr Font)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Font)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject Font ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveFontMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveFontMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveFontMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveFontMethod "describe" o = FontDescribeMethodInfo
ResolveFontMethod "describeWithAbsoluteSize" o = FontDescribeWithAbsoluteSizeMethodInfo
ResolveFontMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveFontMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveFontMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveFontMethod "hasChar" o = FontHasCharMethodInfo
ResolveFontMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveFontMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveFontMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveFontMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveFontMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveFontMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveFontMethod "serialize" o = FontSerializeMethodInfo
ResolveFontMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveFontMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveFontMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveFontMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveFontMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveFontMethod "getCoverage" o = FontGetCoverageMethodInfo
ResolveFontMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveFontMethod "getFace" o = FontGetFaceMethodInfo
ResolveFontMethod "getFeatures" o = FontGetFeaturesMethodInfo
ResolveFontMethod "getFontMap" o = FontGetFontMapMethodInfo
ResolveFontMethod "getGlyphExtents" o = FontGetGlyphExtentsMethodInfo
ResolveFontMethod "getLanguages" o = FontGetLanguagesMethodInfo
ResolveFontMethod "getMetrics" o = FontGetMetricsMethodInfo
ResolveFontMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveFontMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveFontMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveFontMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveFontMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveFontMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFontMethod t Font, O.OverloadedMethod info Font p) => OL.IsLabel t (Font -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveFontMethod t Font, O.OverloadedMethod info Font p, R.HasField t Font p) => R.HasField t Font p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveFontMethod t Font, O.OverloadedMethodInfo info Font) => OL.IsLabel t (O.MethodProxy info Font) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Font
type instance O.AttributeList Font = FontAttributeList
type FontAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Font = FontSignalList
type FontSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "pango_font_describe" pango_font_describe ::
Ptr Font ->
IO (Ptr Pango.FontDescription.FontDescription)
fontDescribe ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> m Pango.FontDescription.FontDescription
fontDescribe :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> m FontDescription
fontDescribe a
font = IO FontDescription -> m FontDescription
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FontDescription -> m FontDescription)
-> IO FontDescription -> m FontDescription
forall a b. (a -> b) -> a -> b
$ do
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
result <- pango_font_describe font'
checkUnexpectedReturnNULL "fontDescribe" result
result' <- (wrapBoxed Pango.FontDescription.FontDescription) result
touchManagedPtr font
return result'
#if defined(ENABLE_OVERLOADING)
data FontDescribeMethodInfo
instance (signature ~ (m Pango.FontDescription.FontDescription), MonadIO m, IsFont a) => O.OverloadedMethod FontDescribeMethodInfo a signature where
overloadedMethod = fontDescribe
instance O.OverloadedMethodInfo FontDescribeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontDescribe",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontDescribe"
})
#endif
foreign import ccall "pango_font_describe_with_absolute_size" pango_font_describe_with_absolute_size ::
Ptr Font ->
IO (Ptr Pango.FontDescription.FontDescription)
fontDescribeWithAbsoluteSize ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> m Pango.FontDescription.FontDescription
fontDescribeWithAbsoluteSize :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> m FontDescription
fontDescribeWithAbsoluteSize a
font = IO FontDescription -> m FontDescription
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FontDescription -> m FontDescription)
-> IO FontDescription -> m FontDescription
forall a b. (a -> b) -> a -> b
$ do
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
result <- pango_font_describe_with_absolute_size font'
checkUnexpectedReturnNULL "fontDescribeWithAbsoluteSize" result
result' <- (wrapBoxed Pango.FontDescription.FontDescription) result
touchManagedPtr font
return result'
#if defined(ENABLE_OVERLOADING)
data FontDescribeWithAbsoluteSizeMethodInfo
instance (signature ~ (m Pango.FontDescription.FontDescription), MonadIO m, IsFont a) => O.OverloadedMethod FontDescribeWithAbsoluteSizeMethodInfo a signature where
overloadedMethod = fontDescribeWithAbsoluteSize
instance O.OverloadedMethodInfo FontDescribeWithAbsoluteSizeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontDescribeWithAbsoluteSize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontDescribeWithAbsoluteSize"
})
#endif
foreign import ccall "pango_font_get_coverage" pango_font_get_coverage ::
Ptr Font ->
Ptr Pango.Language.Language ->
IO (Ptr Pango.Coverage.Coverage)
fontGetCoverage ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> Pango.Language.Language
-> m Pango.Coverage.Coverage
fontGetCoverage :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> Language -> m Coverage
fontGetCoverage a
font Language
language = IO Coverage -> m Coverage
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Coverage -> m Coverage) -> IO Coverage -> m Coverage
forall a b. (a -> b) -> a -> b
$ do
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
language' <- unsafeManagedPtrGetPtr language
result <- pango_font_get_coverage font' language'
checkUnexpectedReturnNULL "fontGetCoverage" result
result' <- (wrapObject Pango.Coverage.Coverage) result
touchManagedPtr font
touchManagedPtr language
return result'
#if defined(ENABLE_OVERLOADING)
data FontGetCoverageMethodInfo
instance (signature ~ (Pango.Language.Language -> m Pango.Coverage.Coverage), MonadIO m, IsFont a) => O.OverloadedMethod FontGetCoverageMethodInfo a signature where
overloadedMethod = fontGetCoverage
instance O.OverloadedMethodInfo FontGetCoverageMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontGetCoverage",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontGetCoverage"
})
#endif
foreign import ccall "pango_font_get_face" pango_font_get_face ::
Ptr Font ->
IO (Ptr Pango.FontFace.FontFace)
fontGetFace ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> m (Maybe Pango.FontFace.FontFace)
fontGetFace :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> m (Maybe FontFace)
fontGetFace a
font = IO (Maybe FontFace) -> m (Maybe FontFace)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe FontFace) -> m (Maybe FontFace))
-> IO (Maybe FontFace) -> m (Maybe FontFace)
forall a b. (a -> b) -> a -> b
$ do
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
result <- pango_font_get_face font'
maybeResult <- convertIfNonNull result $ \Ptr FontFace
result' -> do
result'' <- ((ManagedPtr FontFace -> FontFace) -> Ptr FontFace -> IO FontFace
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr FontFace -> FontFace
Pango.FontFace.FontFace) Ptr FontFace
result'
return result''
touchManagedPtr font
return maybeResult
#if defined(ENABLE_OVERLOADING)
data FontGetFaceMethodInfo
instance (signature ~ (m (Maybe Pango.FontFace.FontFace)), MonadIO m, IsFont a) => O.OverloadedMethod FontGetFaceMethodInfo a signature where
overloadedMethod = fontGetFace
instance O.OverloadedMethodInfo FontGetFaceMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontGetFace",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontGetFace"
})
#endif
foreign import ccall "pango_font_get_features" pango_font_get_features ::
Ptr Font ->
Ptr HarfBuzz.FeatureT.FeatureT ->
Word32 ->
Ptr Word32 ->
IO ()
fontGetFeatures ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> [HarfBuzz.FeatureT.FeatureT]
-> Word32
-> m (([HarfBuzz.FeatureT.FeatureT], Word32))
fontGetFeatures :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> [FeatureT] -> Word32 -> m ([FeatureT], Word32)
fontGetFeatures a
font [FeatureT]
features Word32
numFeatures = IO ([FeatureT], Word32) -> m ([FeatureT], Word32)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ([FeatureT], Word32) -> m ([FeatureT], Word32))
-> IO ([FeatureT], Word32) -> m ([FeatureT], Word32)
forall a b. (a -> b) -> a -> b
$ do
let len :: Word32
len = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ [FeatureT] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [FeatureT]
features
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
features' <- mapM B.ManagedPtr.disownBoxed features
features'' <- packBlockArray 16 features'
numFeatures' <- allocMem :: IO (Ptr Word32)
poke numFeatures' numFeatures
pango_font_get_features font' features'' len numFeatures'
features''' <- (unpackBoxedArrayWithLength 16 len) features''
features'''' <- mapM (wrapBoxed HarfBuzz.FeatureT.FeatureT) features'''
freeMem features''
numFeatures'' <- peek numFeatures'
touchManagedPtr font
mapM_ touchManagedPtr features
freeMem numFeatures'
return (features'''', numFeatures'')
#if defined(ENABLE_OVERLOADING)
data FontGetFeaturesMethodInfo
instance (signature ~ ([HarfBuzz.FeatureT.FeatureT] -> Word32 -> m (([HarfBuzz.FeatureT.FeatureT], Word32))), MonadIO m, IsFont a) => O.OverloadedMethod FontGetFeaturesMethodInfo a signature where
overloadedMethod = fontGetFeatures
instance O.OverloadedMethodInfo FontGetFeaturesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontGetFeatures",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontGetFeatures"
})
#endif
foreign import ccall "pango_font_get_font_map" pango_font_get_font_map ::
Ptr Font ->
IO (Ptr Pango.FontMap.FontMap)
fontGetFontMap ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
Maybe (a)
-> m (Maybe Pango.FontMap.FontMap)
fontGetFontMap :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
Maybe a -> m (Maybe FontMap)
fontGetFontMap Maybe a
font = IO (Maybe FontMap) -> m (Maybe FontMap)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe FontMap) -> m (Maybe FontMap))
-> IO (Maybe FontMap) -> m (Maybe FontMap)
forall a b. (a -> b) -> a -> b
$ do
maybeFont <- case Maybe a
font of
Maybe a
Nothing -> Ptr Font -> IO (Ptr Font)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Font
forall a. Ptr a
FP.nullPtr
Just a
jFont -> do
jFont' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jFont
return jFont'
result <- pango_font_get_font_map maybeFont
maybeResult <- convertIfNonNull result $ \Ptr FontMap
result' -> do
result'' <- ((ManagedPtr FontMap -> FontMap) -> Ptr FontMap -> IO FontMap
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr FontMap -> FontMap
Pango.FontMap.FontMap) Ptr FontMap
result'
return result''
whenJust font touchManagedPtr
return maybeResult
#if defined(ENABLE_OVERLOADING)
data FontGetFontMapMethodInfo
instance (signature ~ (m (Maybe Pango.FontMap.FontMap)), MonadIO m, IsFont a) => O.OverloadedMethod FontGetFontMapMethodInfo a signature where
overloadedMethod i = fontGetFontMap (Just i)
instance O.OverloadedMethodInfo FontGetFontMapMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontGetFontMap",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontGetFontMap"
})
#endif
foreign import ccall "pango_font_get_glyph_extents" pango_font_get_glyph_extents ::
Ptr Font ->
Word32 ->
Ptr Pango.Rectangle.Rectangle ->
Ptr Pango.Rectangle.Rectangle ->
IO ()
fontGetGlyphExtents ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
Maybe (a)
-> Word32
-> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))
fontGetGlyphExtents :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
Maybe a -> Word32 -> m (Rectangle, Rectangle)
fontGetGlyphExtents Maybe a
font Word32
glyph = IO (Rectangle, Rectangle) -> m (Rectangle, Rectangle)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Rectangle, Rectangle) -> m (Rectangle, Rectangle))
-> IO (Rectangle, Rectangle) -> m (Rectangle, Rectangle)
forall a b. (a -> b) -> a -> b
$ do
maybeFont <- case Maybe a
font of
Maybe a
Nothing -> Ptr Font -> IO (Ptr Font)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Font
forall a. Ptr a
FP.nullPtr
Just a
jFont -> do
jFont' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jFont
return jFont'
inkRect <- SP.callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
logicalRect <- SP.callocBytes 16 :: IO (Ptr Pango.Rectangle.Rectangle)
pango_font_get_glyph_extents maybeFont glyph inkRect logicalRect
inkRect' <- (wrapPtr Pango.Rectangle.Rectangle) inkRect
logicalRect' <- (wrapPtr Pango.Rectangle.Rectangle) logicalRect
whenJust font touchManagedPtr
return (inkRect', logicalRect')
#if defined(ENABLE_OVERLOADING)
data FontGetGlyphExtentsMethodInfo
instance (signature ~ (Word32 -> m ((Pango.Rectangle.Rectangle, Pango.Rectangle.Rectangle))), MonadIO m, IsFont a) => O.OverloadedMethod FontGetGlyphExtentsMethodInfo a signature where
overloadedMethod i = fontGetGlyphExtents (Just i)
instance O.OverloadedMethodInfo FontGetGlyphExtentsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontGetGlyphExtents",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontGetGlyphExtents"
})
#endif
foreign import ccall "pango_font_get_languages" pango_font_get_languages ::
Ptr Font ->
IO (Ptr (Ptr Pango.Language.Language))
fontGetLanguages ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> m (Maybe [Pango.Language.Language])
fontGetLanguages :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> m (Maybe [Language])
fontGetLanguages a
font = IO (Maybe [Language]) -> m (Maybe [Language])
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe [Language]) -> m (Maybe [Language]))
-> IO (Maybe [Language]) -> m (Maybe [Language])
forall a b. (a -> b) -> a -> b
$ do
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
result <- pango_font_get_languages font'
maybeResult <- convertIfNonNull result $ \Ptr (Ptr Language)
result' -> do
result'' <- Ptr (Ptr Language) -> IO [Ptr Language]
forall a. Ptr (Ptr a) -> IO [Ptr a]
unpackZeroTerminatedPtrArray Ptr (Ptr Language)
result'
result''' <- mapM (newBoxed Pango.Language.Language) result''
return result'''
touchManagedPtr font
return maybeResult
#if defined(ENABLE_OVERLOADING)
data FontGetLanguagesMethodInfo
instance (signature ~ (m (Maybe [Pango.Language.Language])), MonadIO m, IsFont a) => O.OverloadedMethod FontGetLanguagesMethodInfo a signature where
overloadedMethod = fontGetLanguages
instance O.OverloadedMethodInfo FontGetLanguagesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontGetLanguages",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontGetLanguages"
})
#endif
foreign import ccall "pango_font_get_metrics" pango_font_get_metrics ::
Ptr Font ->
Ptr Pango.Language.Language ->
IO (Ptr Pango.FontMetrics.FontMetrics)
fontGetMetrics ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
Maybe (a)
-> Maybe (Pango.Language.Language)
-> m Pango.FontMetrics.FontMetrics
fontGetMetrics :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
Maybe a -> Maybe Language -> m FontMetrics
fontGetMetrics Maybe a
font Maybe Language
language = IO FontMetrics -> m FontMetrics
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO FontMetrics -> m FontMetrics)
-> IO FontMetrics -> m FontMetrics
forall a b. (a -> b) -> a -> b
$ do
maybeFont <- case Maybe a
font of
Maybe a
Nothing -> Ptr Font -> IO (Ptr Font)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Font
forall a. Ptr a
FP.nullPtr
Just a
jFont -> do
jFont' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
jFont
return jFont'
maybeLanguage <- case language of
Maybe Language
Nothing -> Ptr Language -> IO (Ptr Language)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Language
forall a. Ptr a
FP.nullPtr
Just Language
jLanguage -> do
jLanguage' <- Language -> IO (Ptr Language)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Language
jLanguage
return jLanguage'
result <- pango_font_get_metrics maybeFont maybeLanguage
checkUnexpectedReturnNULL "fontGetMetrics" result
result' <- (wrapBoxed Pango.FontMetrics.FontMetrics) result
whenJust font touchManagedPtr
whenJust language touchManagedPtr
return result'
#if defined(ENABLE_OVERLOADING)
data FontGetMetricsMethodInfo
instance (signature ~ (Maybe (Pango.Language.Language) -> m Pango.FontMetrics.FontMetrics), MonadIO m, IsFont a) => O.OverloadedMethod FontGetMetricsMethodInfo a signature where
overloadedMethod i = fontGetMetrics (Just i)
instance O.OverloadedMethodInfo FontGetMetricsMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontGetMetrics",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontGetMetrics"
})
#endif
foreign import ccall "pango_font_has_char" pango_font_has_char ::
Ptr Font ->
CInt ->
IO CInt
fontHasChar ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> Char
-> m Bool
fontHasChar :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> Char -> m Bool
fontHasChar a
font Char
wc = IO Bool -> m Bool
forall a. IO a -> m a
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
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
let wc' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Char -> Int) -> Char -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Char -> Int
SP.ord) Char
wc
result <- pango_font_has_char font' wc'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr font
return result'
#if defined(ENABLE_OVERLOADING)
data FontHasCharMethodInfo
instance (signature ~ (Char -> m Bool), MonadIO m, IsFont a) => O.OverloadedMethod FontHasCharMethodInfo a signature where
overloadedMethod = fontHasChar
instance O.OverloadedMethodInfo FontHasCharMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontHasChar",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontHasChar"
})
#endif
foreign import ccall "pango_font_serialize" pango_font_serialize ::
Ptr Font ->
IO (Ptr GLib.Bytes.Bytes)
fontSerialize ::
(B.CallStack.HasCallStack, MonadIO m, IsFont a) =>
a
-> m GLib.Bytes.Bytes
fontSerialize :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
a -> m Bytes
fontSerialize a
font = IO Bytes -> m Bytes
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bytes -> m Bytes) -> IO Bytes -> m Bytes
forall a b. (a -> b) -> a -> b
$ do
font' <- a -> IO (Ptr Font)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
font
result <- pango_font_serialize font'
checkUnexpectedReturnNULL "fontSerialize" result
result' <- (wrapBoxed GLib.Bytes.Bytes) result
touchManagedPtr font
return result'
#if defined(ENABLE_OVERLOADING)
data FontSerializeMethodInfo
instance (signature ~ (m GLib.Bytes.Bytes), MonadIO m, IsFont a) => O.OverloadedMethod FontSerializeMethodInfo a signature where
overloadedMethod = fontSerialize
instance O.OverloadedMethodInfo FontSerializeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Objects.Font.fontSerialize",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.30/docs/GI-Pango-Objects-Font.html#v:fontSerialize"
})
#endif
foreign import ccall "pango_font_descriptions_free" pango_font_descriptions_free ::
Ptr (Ptr Pango.FontDescription.FontDescription) ->
Int32 ->
IO ()
{-# DEPRECATED fontDescriptionsFree ["(Since version 1.56)","Just use pango_font_description_free in a loop"] #-}
fontDescriptionsFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe ([Pango.FontDescription.FontDescription])
-> m ()
fontDescriptionsFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe [FontDescription] -> m ()
fontDescriptionsFree Maybe [FontDescription]
descs = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
let nDescs :: Int32
nDescs = case Maybe [FontDescription]
descs of
Maybe [FontDescription]
Nothing -> Int32
0
Just [FontDescription]
jDescs -> Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [FontDescription] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [FontDescription]
jDescs
maybeDescs <- case Maybe [FontDescription]
descs of
Maybe [FontDescription]
Nothing -> Ptr (Ptr FontDescription) -> IO (Ptr (Ptr FontDescription))
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr (Ptr FontDescription)
forall a. Ptr a
FP.nullPtr
Just [FontDescription]
jDescs -> do
jDescs' <- (FontDescription -> IO (Ptr FontDescription))
-> [FontDescription] -> IO [Ptr FontDescription]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM FontDescription -> IO (Ptr FontDescription)
forall a. (HasCallStack, GBoxed a) => a -> IO (Ptr a)
B.ManagedPtr.disownBoxed [FontDescription]
jDescs
jDescs'' <- packPtrArray jDescs'
return jDescs''
pango_font_descriptions_free maybeDescs nDescs
whenJust descs (mapM_ touchManagedPtr)
return ()
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "pango_font_deserialize" pango_font_deserialize ::
Ptr Pango.Context.Context ->
Ptr GLib.Bytes.Bytes ->
Ptr (Ptr GError) ->
IO (Ptr Font)
fontDeserialize ::
(B.CallStack.HasCallStack, MonadIO m, Pango.Context.IsContext a) =>
a
-> GLib.Bytes.Bytes
-> m (Maybe Font)
fontDeserialize :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsContext a) =>
a -> Bytes -> m (Maybe Font)
fontDeserialize a
context Bytes
bytes = IO (Maybe Font) -> m (Maybe Font)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Font) -> m (Maybe Font))
-> IO (Maybe Font) -> m (Maybe Font)
forall a b. (a -> b) -> a -> b
$ do
context' <- a -> IO (Ptr Context)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
context
bytes' <- unsafeManagedPtrGetPtr bytes
onException (do
result <- propagateGError $ pango_font_deserialize context' bytes'
maybeResult <- convertIfNonNull result $ \Ptr Font
result' -> do
result'' <- ((ManagedPtr Font -> Font) -> Ptr Font -> IO Font
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Font -> Font
Font) Ptr Font
result'
return result''
touchManagedPtr context
touchManagedPtr bytes
return maybeResult
) (do
return ()
)
#if defined(ENABLE_OVERLOADING)
#endif