    -- GENERATED by C->Haskell Compiler, version 0.28.8 Switcheroo, 25 November 2017 (Haskell)
    -- Edit the ORIGNAL .chs file instead!

    {-# LINE 1 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}
    -----------------------------------------------------------------------------
    -- |
    -- Module      :  GI.Cairo.Render.Internal.Drawing.Text
    -- Copyright   :  (c) Paolo Martini 2005
    -- License     :  BSD-style (see cairo/COPYRIGHT)
    --
    -- Maintainer  :  p.martini@neuralnoise.com
    -- Stability   :  experimental
    -- Portability :  portable
    --
    -- Rendering text.
    -----------------------------------------------------------------------------

    module GI.Cairo.Render.Internal.Drawing.Text where
    import qualified Foreign.C.Types as C2HSImp
    import qualified Foreign.Ptr as C2HSImp

    import GI.Cairo.Render.Types
    {-# LINE 18 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

    import GI.Cairo.Render.Internal.Utilities (CairoString(..))

    import Data.GI.Base(wrapBoxed, withManagedPtr)
    import Foreign
    import Foreign.C

    {-# LINE 26 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

    selectFontFace :: CairoString string => Cairo -> string -> FontSlant -> FontWeight -> IO ()
    selectFontFace :: forall string.
    CairoString string =>
    Cairo -> string -> FontSlant -> FontWeight -> IO ()
    selectFontFace Cairo
    c string
    string FontSlant
    slant FontWeight
    weight =
        Cairo -> (Ptr Cairo -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr Cairo
    c ((Ptr Cairo -> IO ()) -> IO ()) -> (Ptr Cairo -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Cairo
    ctxt ->
          string -> (CString -> IO ()) -> IO ()
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. CairoString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    string ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \CString
    string' ->
          Ptr Cairo -> CString -> CInt -> CInt -> IO ()
    cairo_select_font_face
    {-# LINE 32 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

            ctxt string' (cFromEnum slant) (cFromEnum weight)

    setFontSize :: (Cairo) -> (Double) -> IO ()
    setFontSize :: Cairo -> Double -> IO ()
    setFontSize a1 Double
    a2 =
      Cairo -> (Ptr Cairo -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr Cairo
    a1 ((Ptr Cairo -> IO ()) -> IO ()) -> (Ptr Cairo -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Cairo
    a1' ->
      let {a2' :: CDouble
    a2' = Double -> CDouble
    forall a b. (Real a, Fractional b) => a -> b
    realToFrac Double
    a2} in
      Ptr Cairo -> CDouble -> IO ()
    setFontSize'_ Ptr Cairo
    a1' CDouble
    a2' IO () -> IO () -> IO ()
    forall a b. IO a -> IO b -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >>
      () -> IO ()
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return ()

    {-# LINE 35 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

    setFontMatrix :: (Cairo) -> (Matrix) -> IO ()
    setFontMatrix a1 a2 =
      withManagedPtr a1 $ \a1' ->
      with a2 $ \a2' ->
      setFontMatrix'_ a1' a2' >>
      return ()

    {-# LINE 36 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

    getFontMatrix :: (Cairo) -> IO ((Matrix))
    getFontMatrix a1 =
      withManagedPtr a1 $ \a1' ->
      alloca $ \a2' ->
      getFontMatrix'_ a1' a2' >>
      peek  a2'>>= \a2'' ->
      return (a2'')

    {-# LINE 37 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

    setFontOptions :: (Cairo) -> (FontOptions) -> IO ()
    setFontOptions a1 a2 =
      withManagedPtr a1 $ \a1' ->
      withFontOptions a2 $ \a2' ->
      setFontOptions'_ a1' a2' >>
      return ()

    {-# LINE 38 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

    showText :: CairoString string => Cairo -> string -> IO ()
    showText c string =
        withManagedPtr c $ \ctxt ->
        withUTFString string $ \string' ->
        cairo_show_text
    {-# LINE 44 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

            ctxt string'

    fontExtents :: (Cairo) -> IO ((FontExtents))
    fontExtents :: Cairo -> IO FontExtents
    fontExtents Cairo
    a1 =
      Cairo -> (Ptr Cairo -> IO FontExtents) -> IO FontExtents
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr Cairo
    a1 ((Ptr Cairo -> IO FontExtents) -> IO FontExtents)
    -> (Ptr Cairo -> IO FontExtents) -> IO FontExtents
    forall a b. (a -> b) -> a -> b
    $ \Ptr Cairo
    a1' ->
      (Ptr FontExtents -> IO FontExtents) -> IO FontExtents
    forall a b. Storable a => (Ptr a -> IO b) -> IO b
    alloca ((Ptr FontExtents -> IO FontExtents) -> IO FontExtents)
    -> (Ptr FontExtents -> IO FontExtents) -> IO FontExtents
    forall a b. (a -> b) -> a -> b
    $ \Ptr FontExtents
    a2' ->
      Ptr Cairo -> Ptr FontExtents -> IO ()
    fontExtents'_ Ptr Cairo
    a1' Ptr FontExtents
    a2' IO () -> IO FontExtents -> IO FontExtents
    forall a b. IO a -> IO b -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
    >>
      Ptr FontExtents -> IO FontExtents
    forall a. Storable a => Ptr a -> IO a
    peek  Ptr FontExtents
    a2'IO FontExtents -> (FontExtents -> IO FontExtents) -> IO FontExtents
    forall a b. IO a -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \FontExtents
    a2'' ->
      FontExtents -> IO FontExtents
    forall a. a -> IO a
    forall (m :: * -> *) a. Monad m => a -> m a
    return (FontExtents
    a2'')

    {-# LINE 47 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

    textExtents :: CairoString string => Cairo -> string -> IO TextExtents
    textExtents c string =
        withManagedPtr c $ \ctxt ->
          withUTFString string $ \string' ->
          alloca $ \result -> do
             cairo_text_extents
    {-# LINE 54 "./GI/Cairo/Render/Internal/Drawing/Text.chs" #-}

                 ctxt string' result
             peek result

    foreign import ccall safe "GI/Cairo/Render/Internal/Drawing/Text.chs.h cairo_select_font_face"
      cairo_select_font_face :: ((CairoPtr) -> ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ())))))

    foreign import ccall safe "GI/Cairo/Render/Internal/Drawing/Text.chs.h cairo_set_font_size"
      setFontSize'_ :: ((CairoPtr) -> (C2HSImp.CDouble -> (IO ())))

    foreign import ccall safe "GI/Cairo/Render/Internal/Drawing/Text.chs.h cairo_set_font_matrix"
      setFontMatrix'_ :: ((CairoPtr) -> ((MatrixPtr) -> (IO ())))

    foreign import ccall safe "GI/Cairo/Render/Internal/Drawing/Text.chs.h cairo_get_font_matrix"
      getFontMatrix'_ :: ((CairoPtr) -> ((MatrixPtr) -> (IO ())))

    foreign import ccall safe "GI/Cairo/Render/Internal/Drawing/Text.chs.h cairo_set_font_options"
      setFontOptions'_ :: ((CairoPtr) -> ((FontOptionsPtr) -> (IO ())))

    foreign import ccall safe "GI/Cairo/Render/Internal/Drawing/Text.chs.h cairo_show_text"
      cairo_show_text :: ((CairoPtr) -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO ())))

    foreign import ccall safe "GI/Cairo/Render/Internal/Drawing/Text.chs.h cairo_font_extents"
      fontExtents'_ :: ((CairoPtr) -> ((FontExtentsPtr) -> (IO ())))

    foreign import ccall safe "GI/Cairo/Render/Internal/Drawing/Text.chs.h cairo_text_extents"
      cairo_text_extents :: ((CairoPtr) -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((TextExtentsPtr) -> (IO ()))))