{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

A 'GI.Pango.Structs.FontMetrics.FontMetrics' structure holds the overall metric information
for a font (possibly restricted to a script). The fields of this
structure are private to implementations of a font backend. See
the documentation of the corresponding getters for documentation
of their meaning.
-}

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

module GI.Pango.Structs.FontMetrics
    (

-- * Exported types
    FontMetrics(..)                         ,
    newZeroFontMetrics                      ,
    noFontMetrics                           ,


 -- * Methods
-- ** getApproximateCharWidth #method:getApproximateCharWidth#

#if ENABLE_OVERLOADING
    FontMetricsGetApproximateCharWidthMethodInfo,
#endif
    fontMetricsGetApproximateCharWidth      ,


-- ** getApproximateDigitWidth #method:getApproximateDigitWidth#

#if ENABLE_OVERLOADING
    FontMetricsGetApproximateDigitWidthMethodInfo,
#endif
    fontMetricsGetApproximateDigitWidth     ,


-- ** getAscent #method:getAscent#

#if ENABLE_OVERLOADING
    FontMetricsGetAscentMethodInfo          ,
#endif
    fontMetricsGetAscent                    ,


-- ** getDescent #method:getDescent#

#if ENABLE_OVERLOADING
    FontMetricsGetDescentMethodInfo         ,
#endif
    fontMetricsGetDescent                   ,


-- ** getStrikethroughPosition #method:getStrikethroughPosition#

#if ENABLE_OVERLOADING
    FontMetricsGetStrikethroughPositionMethodInfo,
#endif
    fontMetricsGetStrikethroughPosition     ,


-- ** getStrikethroughThickness #method:getStrikethroughThickness#

#if ENABLE_OVERLOADING
    FontMetricsGetStrikethroughThicknessMethodInfo,
#endif
    fontMetricsGetStrikethroughThickness    ,


-- ** getUnderlinePosition #method:getUnderlinePosition#

#if ENABLE_OVERLOADING
    FontMetricsGetUnderlinePositionMethodInfo,
#endif
    fontMetricsGetUnderlinePosition         ,


-- ** getUnderlineThickness #method:getUnderlineThickness#

#if ENABLE_OVERLOADING
    FontMetricsGetUnderlineThicknessMethodInfo,
#endif
    fontMetricsGetUnderlineThickness        ,


-- ** new #method:new#

    fontMetricsNew                          ,


-- ** ref #method:ref#

#if ENABLE_OVERLOADING
    FontMetricsRefMethodInfo                ,
#endif
    fontMetricsRef                          ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    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.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


-- | Memory-managed wrapper type.
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

-- | Construct a `FontMetrics` struct initialized to zero.
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


-- | A convenience alias for `Nothing` :: `Maybe` `FontMetrics`.
noFontMetrics :: Maybe FontMetrics
noFontMetrics = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList FontMetrics
type instance O.AttributeList FontMetrics = FontMetricsAttributeList
type FontMetricsAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method FontMetrics::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Pango", name = "FontMetrics"}))
-- throws : False
-- Skip return : False

foreign import ccall "pango_font_metrics_new" pango_font_metrics_new ::
    IO (Ptr FontMetrics)

{- |
Creates a new 'GI.Pango.Structs.FontMetrics.FontMetrics' structure. This is only for
internal use by Pango backends and there is no public way
to set the fields of the structure.
-}
fontMetricsNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m FontMetrics
    {- ^ __Returns:__ a newly-created 'GI.Pango.Structs.FontMetrics.FontMetrics' structure
  with a reference count of 1. -}
fontMetricsNew  = liftIO $ do
    result <- pango_font_metrics_new
    checkUnexpectedReturnNULL "fontMetricsNew" result
    result' <- (wrapBoxed FontMetrics) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method FontMetrics::get_approximate_char_width
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure", 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_font_metrics_get_approximate_char_width" pango_font_metrics_get_approximate_char_width ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO Int32

{- |
Gets the approximate character width for a font metrics structure.
This is merely a representative value useful, for example, for
determining the initial size for a window. Actual characters in
text will be wider and narrower than this.
-}
fontMetricsGetApproximateCharWidth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure -}
    -> m Int32
    {- ^ __Returns:__ the character width, in Pango units. -}
fontMetricsGetApproximateCharWidth metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    result <- pango_font_metrics_get_approximate_char_width metrics'
    touchManagedPtr metrics
    return result

#if ENABLE_OVERLOADING
data FontMetricsGetApproximateCharWidthMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetApproximateCharWidthMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsGetApproximateCharWidth

#endif

-- method FontMetrics::get_approximate_digit_width
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure", 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_font_metrics_get_approximate_digit_width" pango_font_metrics_get_approximate_digit_width ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO Int32

{- |
Gets the approximate digit width for a font metrics structure.
This is merely a representative value useful, for example, for
determining the initial size for a window. Actual digits in
text can be wider or narrower than this, though this value
is generally somewhat more accurate than the result of
'GI.Pango.Structs.FontMetrics.fontMetricsGetApproximateCharWidth' for digits.
-}
fontMetricsGetApproximateDigitWidth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure -}
    -> m Int32
    {- ^ __Returns:__ the digit width, in Pango units. -}
fontMetricsGetApproximateDigitWidth metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    result <- pango_font_metrics_get_approximate_digit_width metrics'
    touchManagedPtr metrics
    return result

#if ENABLE_OVERLOADING
data FontMetricsGetApproximateDigitWidthMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetApproximateDigitWidthMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsGetApproximateDigitWidth

#endif

-- method FontMetrics::get_ascent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure", 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_font_metrics_get_ascent" pango_font_metrics_get_ascent ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO Int32

{- |
Gets the ascent from a font metrics structure. The ascent is
the distance from the baseline to the logical top of a line
of text. (The logical top may be above or below the top of the
actual drawn ink. It is necessary to lay out the text to figure
where the ink will be.)
-}
fontMetricsGetAscent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure -}
    -> m Int32
    {- ^ __Returns:__ the ascent, in Pango units. -}
fontMetricsGetAscent metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    result <- pango_font_metrics_get_ascent metrics'
    touchManagedPtr metrics
    return result

#if ENABLE_OVERLOADING
data FontMetricsGetAscentMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetAscentMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsGetAscent

#endif

-- method FontMetrics::get_descent
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure", 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_font_metrics_get_descent" pango_font_metrics_get_descent ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO Int32

{- |
Gets the descent from a font metrics structure. The descent is
the distance from the baseline to the logical bottom of a line
of text. (The logical bottom may be above or below the bottom of the
actual drawn ink. It is necessary to lay out the text to figure
where the ink will be.)
-}
fontMetricsGetDescent ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure -}
    -> m Int32
    {- ^ __Returns:__ the descent, in Pango units. -}
fontMetricsGetDescent metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    result <- pango_font_metrics_get_descent metrics'
    touchManagedPtr metrics
    return result

#if ENABLE_OVERLOADING
data FontMetricsGetDescentMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetDescentMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsGetDescent

#endif

-- method FontMetrics::get_strikethrough_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure", 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_font_metrics_get_strikethrough_position" pango_font_metrics_get_strikethrough_position ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO Int32

{- |
Gets the suggested position to draw the strikethrough.
The value returned is the distance \<emphasis>above\<\/emphasis> the
baseline of the top of the strikethrough.

/Since: 1.6/
-}
fontMetricsGetStrikethroughPosition ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure -}
    -> m Int32
    {- ^ __Returns:__ the suggested strikethrough position, in Pango units. -}
fontMetricsGetStrikethroughPosition metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    result <- pango_font_metrics_get_strikethrough_position metrics'
    touchManagedPtr metrics
    return result

#if ENABLE_OVERLOADING
data FontMetricsGetStrikethroughPositionMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetStrikethroughPositionMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsGetStrikethroughPosition

#endif

-- method FontMetrics::get_strikethrough_thickness
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure", 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_font_metrics_get_strikethrough_thickness" pango_font_metrics_get_strikethrough_thickness ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO Int32

{- |
Gets the suggested thickness to draw for the strikethrough.

/Since: 1.6/
-}
fontMetricsGetStrikethroughThickness ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure -}
    -> m Int32
    {- ^ __Returns:__ the suggested strikethrough thickness, in Pango units. -}
fontMetricsGetStrikethroughThickness metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    result <- pango_font_metrics_get_strikethrough_thickness metrics'
    touchManagedPtr metrics
    return result

#if ENABLE_OVERLOADING
data FontMetricsGetStrikethroughThicknessMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetStrikethroughThicknessMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsGetStrikethroughThickness

#endif

-- method FontMetrics::get_underline_position
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure", 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_font_metrics_get_underline_position" pango_font_metrics_get_underline_position ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO Int32

{- |
Gets the suggested position to draw the underline.
The value returned is the distance \<emphasis>above\<\/emphasis> the
baseline of the top of the underline. Since most fonts have
underline positions beneath the baseline, this value is typically
negative.

/Since: 1.6/
-}
fontMetricsGetUnderlinePosition ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure -}
    -> m Int32
    {- ^ __Returns:__ the suggested underline position, in Pango units. -}
fontMetricsGetUnderlinePosition metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    result <- pango_font_metrics_get_underline_position metrics'
    touchManagedPtr metrics
    return result

#if ENABLE_OVERLOADING
data FontMetricsGetUnderlinePositionMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetUnderlinePositionMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsGetUnderlinePosition

#endif

-- method FontMetrics::get_underline_thickness
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure", 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_font_metrics_get_underline_thickness" pango_font_metrics_get_underline_thickness ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO Int32

{- |
Gets the suggested thickness to draw for the underline.

/Since: 1.6/
-}
fontMetricsGetUnderlineThickness ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure -}
    -> m Int32
    {- ^ __Returns:__ the suggested underline thickness, in Pango units. -}
fontMetricsGetUnderlineThickness metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    result <- pango_font_metrics_get_underline_thickness metrics'
    touchManagedPtr metrics
    return result

#if ENABLE_OVERLOADING
data FontMetricsGetUnderlineThicknessMethodInfo
instance (signature ~ (m Int32), MonadIO m) => O.MethodInfo FontMetricsGetUnderlineThicknessMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsGetUnderlineThickness

#endif

-- method FontMetrics::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure, may be %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Pango", name = "FontMetrics"}))
-- throws : False
-- Skip return : False

foreign import ccall "pango_font_metrics_ref" pango_font_metrics_ref ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO (Ptr FontMetrics)

{- |
Increase the reference count of a font metrics structure by one.
-}
fontMetricsRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure, may be 'Nothing' -}
    -> m (Maybe FontMetrics)
    {- ^ __Returns:__ /@metrics@/ -}
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 ENABLE_OVERLOADING
data FontMetricsRefMethodInfo
instance (signature ~ (m (Maybe FontMetrics)), MonadIO m) => O.MethodInfo FontMetricsRefMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsRef

#endif

-- method FontMetrics::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "metrics", argType = TInterface (Name {namespace = "Pango", name = "FontMetrics"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontMetrics structure, may be %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_font_metrics_unref" pango_font_metrics_unref ::
    Ptr FontMetrics ->                      -- metrics : TInterface (Name {namespace = "Pango", name = "FontMetrics"})
    IO ()

{- |
Decrease the reference count of a font metrics structure by one. If
the result is zero, frees the structure and any associated
memory.
-}
fontMetricsUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FontMetrics
    {- ^ /@metrics@/: a 'GI.Pango.Structs.FontMetrics.FontMetrics' structure, may be 'Nothing' -}
    -> m ()
fontMetricsUnref metrics = liftIO $ do
    metrics' <- unsafeManagedPtrGetPtr metrics
    pango_font_metrics_unref metrics'
    touchManagedPtr metrics
    return ()

#if ENABLE_OVERLOADING
data FontMetricsUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo FontMetricsUnrefMethodInfo FontMetrics signature where
    overloadedMethod _ = fontMetricsUnref

#endif

#if ENABLE_OVERLOADING
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