{- | 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 #PangoFontMetrics 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. -} module GI.Pango.Structs.FontMetrics ( -- * Exported types FontMetrics(..) , noFontMetrics , -- * Methods -- ** fontMetricsGetApproximateCharWidth fontMetricsGetApproximateCharWidth , -- ** fontMetricsGetApproximateDigitWidth fontMetricsGetApproximateDigitWidth , -- ** fontMetricsGetAscent fontMetricsGetAscent , -- ** fontMetricsGetDescent fontMetricsGetDescent , -- ** fontMetricsGetStrikethroughPosition fontMetricsGetStrikethroughPosition , -- ** fontMetricsGetStrikethroughThickness fontMetricsGetStrikethroughThickness , -- ** fontMetricsGetUnderlinePosition fontMetricsGetUnderlinePosition , -- ** fontMetricsGetUnderlineThickness fontMetricsGetUnderlineThickness , -- ** fontMetricsNew fontMetricsNew , -- ** fontMetricsRef fontMetricsRef , -- ** fontMetricsUnref fontMetricsUnref , -- * Properties -- ** ApproximateCharWidth fontMetricsReadApproximateCharWidth , -- ** ApproximateDigitWidth fontMetricsReadApproximateDigitWidth , -- ** Ascent fontMetricsReadAscent , -- ** Descent fontMetricsReadDescent , -- ** RefCount fontMetricsReadRefCount , -- ** StrikethroughPosition fontMetricsReadStrikethroughPosition , -- ** StrikethroughThickness fontMetricsReadStrikethroughThickness , -- ** UnderlinePosition fontMetricsReadUnderlinePosition , -- ** UnderlineThickness fontMetricsReadUnderlineThickness , ) 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 newtype FontMetrics = FontMetrics (ForeignPtr 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 noFontMetrics :: Maybe FontMetrics noFontMetrics = Nothing fontMetricsReadRefCount :: FontMetrics -> IO Word32 fontMetricsReadRefCount s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO Word32 return val fontMetricsReadAscent :: FontMetrics -> IO Int32 fontMetricsReadAscent s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 4) :: IO Int32 return val fontMetricsReadDescent :: FontMetrics -> IO Int32 fontMetricsReadDescent s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Int32 return val fontMetricsReadApproximateCharWidth :: FontMetrics -> IO Int32 fontMetricsReadApproximateCharWidth s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 12) :: IO Int32 return val fontMetricsReadApproximateDigitWidth :: FontMetrics -> IO Int32 fontMetricsReadApproximateDigitWidth s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 16) :: IO Int32 return val fontMetricsReadUnderlinePosition :: FontMetrics -> IO Int32 fontMetricsReadUnderlinePosition s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 20) :: IO Int32 return val fontMetricsReadUnderlineThickness :: FontMetrics -> IO Int32 fontMetricsReadUnderlineThickness s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 24) :: IO Int32 return val fontMetricsReadStrikethroughPosition :: FontMetrics -> IO Int32 fontMetricsReadStrikethroughPosition s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 28) :: IO Int32 return val fontMetricsReadStrikethroughThickness :: FontMetrics -> IO Int32 fontMetricsReadStrikethroughThickness s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 32) :: IO Int32 return val -- method FontMetrics::new -- method type : Constructor -- Args : [] -- Lengths : [] -- hInArgs : [] -- returnType : TInterface "Pango" "FontMetrics" -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_new" pango_font_metrics_new :: IO (Ptr FontMetrics) fontMetricsNew :: (MonadIO m) => m FontMetrics fontMetricsNew = liftIO $ do result <- pango_font_metrics_new checkUnexpectedReturnNULL "pango_font_metrics_new" result result' <- (wrapBoxed FontMetrics) result return result' -- method FontMetrics::get_approximate_char_width -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_get_approximate_char_width" pango_font_metrics_get_approximate_char_width :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO Int32 fontMetricsGetApproximateCharWidth :: (MonadIO m) => FontMetrics -> -- _obj m Int32 fontMetricsGetApproximateCharWidth _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_get_approximate_char_width _obj' touchManagedPtr _obj return result -- method FontMetrics::get_approximate_digit_width -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_get_approximate_digit_width" pango_font_metrics_get_approximate_digit_width :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO Int32 fontMetricsGetApproximateDigitWidth :: (MonadIO m) => FontMetrics -> -- _obj m Int32 fontMetricsGetApproximateDigitWidth _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_get_approximate_digit_width _obj' touchManagedPtr _obj return result -- method FontMetrics::get_ascent -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_get_ascent" pango_font_metrics_get_ascent :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO Int32 fontMetricsGetAscent :: (MonadIO m) => FontMetrics -> -- _obj m Int32 fontMetricsGetAscent _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_get_ascent _obj' touchManagedPtr _obj return result -- method FontMetrics::get_descent -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_get_descent" pango_font_metrics_get_descent :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO Int32 fontMetricsGetDescent :: (MonadIO m) => FontMetrics -> -- _obj m Int32 fontMetricsGetDescent _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_get_descent _obj' touchManagedPtr _obj return result -- method FontMetrics::get_strikethrough_position -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_get_strikethrough_position" pango_font_metrics_get_strikethrough_position :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO Int32 fontMetricsGetStrikethroughPosition :: (MonadIO m) => FontMetrics -> -- _obj m Int32 fontMetricsGetStrikethroughPosition _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_get_strikethrough_position _obj' touchManagedPtr _obj return result -- method FontMetrics::get_strikethrough_thickness -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_get_strikethrough_thickness" pango_font_metrics_get_strikethrough_thickness :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO Int32 fontMetricsGetStrikethroughThickness :: (MonadIO m) => FontMetrics -> -- _obj m Int32 fontMetricsGetStrikethroughThickness _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_get_strikethrough_thickness _obj' touchManagedPtr _obj return result -- method FontMetrics::get_underline_position -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_get_underline_position" pango_font_metrics_get_underline_position :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO Int32 fontMetricsGetUnderlinePosition :: (MonadIO m) => FontMetrics -> -- _obj m Int32 fontMetricsGetUnderlinePosition _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_get_underline_position _obj' touchManagedPtr _obj return result -- method FontMetrics::get_underline_thickness -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_get_underline_thickness" pango_font_metrics_get_underline_thickness :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO Int32 fontMetricsGetUnderlineThickness :: (MonadIO m) => FontMetrics -> -- _obj m Int32 fontMetricsGetUnderlineThickness _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_get_underline_thickness _obj' touchManagedPtr _obj return result -- method FontMetrics::ref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Pango" "FontMetrics" -- throws : False -- Skip return : False foreign import ccall "pango_font_metrics_ref" pango_font_metrics_ref :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO (Ptr FontMetrics) fontMetricsRef :: (MonadIO m) => FontMetrics -> -- _obj m FontMetrics fontMetricsRef _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- pango_font_metrics_ref _obj' checkUnexpectedReturnNULL "pango_font_metrics_ref" result result' <- (wrapBoxed FontMetrics) result touchManagedPtr _obj return result' -- method FontMetrics::unref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Pango" "FontMetrics", 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_metrics_unref" pango_font_metrics_unref :: Ptr FontMetrics -> -- _obj : TInterface "Pango" "FontMetrics" IO () fontMetricsUnref :: (MonadIO m) => FontMetrics -> -- _obj m () fontMetricsUnref _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj pango_font_metrics_unref _obj' touchManagedPtr _obj return ()