module GI.Pango.Structs.FontMetrics
(
FontMetrics(..) ,
newZeroFontMetrics ,
noFontMetrics ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsGetApproximateCharWidthMethodInfo,
#endif
fontMetricsGetApproximateCharWidth ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsGetApproximateDigitWidthMethodInfo,
#endif
fontMetricsGetApproximateDigitWidth ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsGetAscentMethodInfo ,
#endif
fontMetricsGetAscent ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsGetDescentMethodInfo ,
#endif
fontMetricsGetDescent ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsGetStrikethroughPositionMethodInfo,
#endif
fontMetricsGetStrikethroughPosition ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsGetStrikethroughThicknessMethodInfo,
#endif
fontMetricsGetStrikethroughThickness ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsGetUnderlinePositionMethodInfo,
#endif
fontMetricsGetUnderlinePosition ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsGetUnderlineThicknessMethodInfo,
#endif
fontMetricsGetUnderlineThickness ,
fontMetricsNew ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsRefMethodInfo ,
#endif
fontMetricsRef ,
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
FontMetricsUnrefMethodInfo ,
#endif
fontMetricsUnref ,
) 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.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
newtype FontMetrics = FontMetrics (ManagedPtr FontMetrics)
foreign import ccall "pango_font_metrics_get_type" c_pango_font_metrics_get_type ::
IO GType
instance BoxedObject FontMetrics where
boxedType _ = c_pango_font_metrics_get_type
newZeroFontMetrics :: MonadIO m => m FontMetrics
newZeroFontMetrics = liftIO $ callocBoxedBytes 36 >>= wrapBoxed FontMetrics
instance tag ~ 'AttrSet => Constructible FontMetrics tag where
new _ attrs = do
o <- newZeroFontMetrics
GI.Attributes.set o attrs
return o
noFontMetrics :: Maybe FontMetrics
noFontMetrics = Nothing
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList FontMetrics
type instance O.AttributeList FontMetrics = FontMetricsAttributeList
type FontMetricsAttributeList = ('[ ] :: [(Symbol, *)])
#endif
foreign import ccall "pango_font_metrics_new" pango_font_metrics_new ::
IO (Ptr FontMetrics)
fontMetricsNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m FontMetrics
fontMetricsNew = liftIO $ do
result <- pango_font_metrics_new
checkUnexpectedReturnNULL "fontMetricsNew" result
result' <- (wrapBoxed FontMetrics) result
return result'
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
#endif
foreign import ccall "pango_font_metrics_get_approximate_char_width" pango_font_metrics_get_approximate_char_width ::
Ptr FontMetrics ->
IO Int32
fontMetricsGetApproximateCharWidth ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m Int32
fontMetricsGetApproximateCharWidth metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_get_approximate_char_width metrics'
touchManagedPtr metrics
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsGetApproximateCharWidthMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetApproximateCharWidthMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsGetApproximateCharWidth
#endif
foreign import ccall "pango_font_metrics_get_approximate_digit_width" pango_font_metrics_get_approximate_digit_width ::
Ptr FontMetrics ->
IO Int32
fontMetricsGetApproximateDigitWidth ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m Int32
fontMetricsGetApproximateDigitWidth metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_get_approximate_digit_width metrics'
touchManagedPtr metrics
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsGetApproximateDigitWidthMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetApproximateDigitWidthMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsGetApproximateDigitWidth
#endif
foreign import ccall "pango_font_metrics_get_ascent" pango_font_metrics_get_ascent ::
Ptr FontMetrics ->
IO Int32
fontMetricsGetAscent ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m Int32
fontMetricsGetAscent metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_get_ascent metrics'
touchManagedPtr metrics
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsGetAscentMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetAscentMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsGetAscent
#endif
foreign import ccall "pango_font_metrics_get_descent" pango_font_metrics_get_descent ::
Ptr FontMetrics ->
IO Int32
fontMetricsGetDescent ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m Int32
fontMetricsGetDescent metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_get_descent metrics'
touchManagedPtr metrics
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsGetDescentMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetDescentMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsGetDescent
#endif
foreign import ccall "pango_font_metrics_get_strikethrough_position" pango_font_metrics_get_strikethrough_position ::
Ptr FontMetrics ->
IO Int32
fontMetricsGetStrikethroughPosition ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m Int32
fontMetricsGetStrikethroughPosition metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_get_strikethrough_position metrics'
touchManagedPtr metrics
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsGetStrikethroughPositionMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetStrikethroughPositionMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsGetStrikethroughPosition
#endif
foreign import ccall "pango_font_metrics_get_strikethrough_thickness" pango_font_metrics_get_strikethrough_thickness ::
Ptr FontMetrics ->
IO Int32
fontMetricsGetStrikethroughThickness ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m Int32
fontMetricsGetStrikethroughThickness metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_get_strikethrough_thickness metrics'
touchManagedPtr metrics
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsGetStrikethroughThicknessMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetStrikethroughThicknessMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsGetStrikethroughThickness
#endif
foreign import ccall "pango_font_metrics_get_underline_position" pango_font_metrics_get_underline_position ::
Ptr FontMetrics ->
IO Int32
fontMetricsGetUnderlinePosition ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m Int32
fontMetricsGetUnderlinePosition metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_get_underline_position metrics'
touchManagedPtr metrics
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsGetUnderlinePositionMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetUnderlinePositionMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsGetUnderlinePosition
#endif
foreign import ccall "pango_font_metrics_get_underline_thickness" pango_font_metrics_get_underline_thickness ::
Ptr FontMetrics ->
IO Int32
fontMetricsGetUnderlineThickness ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m Int32
fontMetricsGetUnderlineThickness metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_get_underline_thickness metrics'
touchManagedPtr metrics
return result
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsGetUnderlineThicknessMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetUnderlineThicknessMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsGetUnderlineThickness
#endif
foreign import ccall "pango_font_metrics_ref" pango_font_metrics_ref ::
Ptr FontMetrics ->
IO (Ptr FontMetrics)
fontMetricsRef ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m (Maybe FontMetrics)
fontMetricsRef metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
result <- pango_font_metrics_ref metrics'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (wrapBoxed FontMetrics) result'
return result''
touchManagedPtr metrics
return maybeResult
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsRefMethodInfo
instance (signature ~ (m (Maybe FontMetrics)), MonadIO m) => O.MethodInfo FontMetricsRefMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsRef
#endif
foreign import ccall "pango_font_metrics_unref" pango_font_metrics_unref ::
Ptr FontMetrics ->
IO ()
fontMetricsUnref ::
(B.CallStack.HasCallStack, MonadIO m) =>
FontMetrics
-> m ()
fontMetricsUnref metrics = liftIO $ do
metrics' <- unsafeManagedPtrGetPtr metrics
pango_font_metrics_unref metrics'
touchManagedPtr metrics
return ()
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data FontMetricsUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo FontMetricsUnrefMethodInfo FontMetrics signature where
overloadedMethod _ = fontMetricsUnref
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveFontMetricsMethod (t :: Symbol) (o :: *) :: * where
ResolveFontMetricsMethod "ref" o = FontMetricsRefMethodInfo
ResolveFontMetricsMethod "unref" o = FontMetricsUnrefMethodInfo
ResolveFontMetricsMethod "getApproximateCharWidth" o = FontMetricsGetApproximateCharWidthMethodInfo
ResolveFontMetricsMethod "getApproximateDigitWidth" o = FontMetricsGetApproximateDigitWidthMethodInfo
ResolveFontMetricsMethod "getAscent" o = FontMetricsGetAscentMethodInfo
ResolveFontMetricsMethod "getDescent" o = FontMetricsGetDescentMethodInfo
ResolveFontMetricsMethod "getStrikethroughPosition" o = FontMetricsGetStrikethroughPositionMethodInfo
ResolveFontMetricsMethod "getStrikethroughThickness" o = FontMetricsGetStrikethroughThicknessMethodInfo
ResolveFontMetricsMethod "getUnderlinePosition" o = FontMetricsGetUnderlinePositionMethodInfo
ResolveFontMetricsMethod "getUnderlineThickness" o = FontMetricsGetUnderlineThicknessMethodInfo
ResolveFontMetricsMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveFontMetricsMethod t FontMetrics, O.MethodInfo info FontMetrics p) => O.IsLabelProxy t (FontMetrics -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveFontMetricsMethod t FontMetrics, O.MethodInfo info FontMetrics p) => O.IsLabel t (FontMetrics -> 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