    -- GENERATED by C->Haskell Compiler, version 0.13.13 (gtk2hs branch) "Bin IO", 27 May 2012 (Haskell)
    -- Edit the ORIGINAL .chs file instead!

    {-# LINE 1 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}
    -----------------------------------------------------------------------------
    -- |
    -- Module      :  Graphics.Rendering.Cairo.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 Graphics.Rendering.Cairo.Internal.Drawing.Text where

    import Graphics.Rendering.Cairo.Types
    {-# LINE 16 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}

    import Graphics.Rendering.Cairo.Internal.Utilities (CairoString(..))

    import Foreign
    import Foreign.C

    {-# LINE 23 "./Graphics/Rendering/Cairo/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 =
        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' ->
        (\(Cairo Ptr Cairo
    arg1) CString
    arg2 CInt
    arg3 CInt
    arg4 -> Ptr Cairo -> CString -> CInt -> CInt -> IO ()
    cairo_select_font_face Ptr Cairo
    arg1 CString
    arg2 CInt
    arg3 CInt
    arg4)
    {-# LINE 28 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}
            Cairo
    c CString
    string' (FontSlant -> CInt
    forall e i. (Enum e, Integral i) => e -> i
    cFromEnum FontSlant
    slant) (FontWeight -> CInt
    forall e i. (Enum e, Integral i) => e -> i
    cFromEnum FontWeight
    weight)

    setFontSize :: Cairo -> Double -> IO ()
    setFontSize :: Cairo -> Double -> IO ()
    setFontSize a1 Double
    a2 =
      let {a1' :: Ptr Cairo
    a1' = Cairo -> Ptr Cairo
    unCairo Cairo
    a1} in
      let {a2' :: CDouble
    a2' = Double -> CDouble
    forall a b. (RealFloat a, RealFloat b) => a -> b
    cFloatConv Double
    a2} in
      setFontSize'_ a1' a2' >>= \res ->
      return ()
    showText :: forall string. CairoString string => Cairo -> string -> IO ()
    {-# LINE 31 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}
    setFontMatrix :: Cairo -> Matrix -> IO ()
    setFontMatrix a1 a2 =
      let {a1' = unCairo a1} in
      with a2 $ \a2' ->
      setFontMatrix'_ a1' a2' >>= \res ->
      return ()
    {-# LINE 32 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}
    getFontMatrix :: Cairo -> IO (Matrix)
    getFontMatrix a1 =
      let {a1' = unCairo a1} in
      alloca $ \a2' ->
      getFontMatrix'_ a1' a2' >>= \res ->
      peek a2'>>= \a2'' ->
      return (a2'')
    {-# LINE 33 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}
    setFontOptions :: Cairo -> FontOptions -> IO ()
    setFontOptions a1 a2 =
      let {a1' = unCairo a1} in
      withFontOptions a2 $ \a2' ->
      setFontOptions'_ a1' a2' >>= \res ->
      return ()
    {-# LINE 34 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}

    showText :: CairoString string => Cairo -> string -> IO ()
    showText c string =
        withUTFString string $ \string' ->
        (\(Cairo arg1) arg2 -> cairo_show_text arg1 arg2)
    {-# LINE 39 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}
            c string'

    fontExtents :: Cairo -> IO (FontExtents)
    fontExtents :: Cairo -> IO FontExtents
    fontExtents Cairo
    a1 =
      let {a1' :: Ptr Cairo
    a1' = Cairo -> Ptr Cairo
    unCairo Cairo
    a1} in
      (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 -> (a -> IO b) -> IO b
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= \()
    res ->
      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 42 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}

    textExtents :: CairoString string => Cairo -> string -> IO TextExtents
    textExtents c string =
        withUTFString string $ \string' ->
        alloca $ \result -> do
            (\(Cairo arg1) arg2 arg3 -> cairo_text_extents arg1 arg2 arg3)
    {-# LINE 48 "./Graphics/Rendering/Cairo/Internal/Drawing/Text.chs" #-}
                c string' result
            peek result

    foreign import ccall safe "cairo_select_font_face"
      cairo_select_font_face :: ((Ptr Cairo) -> ((Ptr CChar) -> (CInt -> (CInt -> (IO ())))))

    foreign import ccall safe "cairo_set_font_size"
      setFontSize'_ :: ((Ptr Cairo) -> (CDouble -> (IO ())))

    foreign import ccall safe "cairo_set_font_matrix"
      setFontMatrix'_ :: ((Ptr Cairo) -> ((Ptr Matrix) -> (IO ())))

    foreign import ccall safe "cairo_get_font_matrix"
      getFontMatrix'_ :: ((Ptr Cairo) -> ((Ptr Matrix) -> (IO ())))

    foreign import ccall safe "cairo_set_font_options"
      setFontOptions'_ :: ((Ptr Cairo) -> ((Ptr FontOptions) -> (IO ())))

    foreign import ccall safe "cairo_show_text"
      cairo_show_text :: ((Ptr Cairo) -> ((Ptr CChar) -> (IO ())))

    foreign import ccall safe "cairo_font_extents"
      fontExtents'_ :: ((Ptr Cairo) -> ((Ptr FontExtents) -> (IO ())))

    foreign import ccall safe "cairo_text_extents"
      cairo_text_extents :: ((Ptr Cairo) -> ((Ptr CChar) -> ((Ptr TextExtents) -> (IO ()))))