{-# LINE 2 "./Graphics/Rendering/Pango/Font.chs" #-}
module Graphics.Rendering.Pango.Font (
module Graphics.Rendering.Pango.Description,
FontMap,
FontMapClass,
pangoFontMapListFamilies,
FontFamily,
FontFamilyClass,
pangoFontFamilyIsMonospace,
pangoFontFamilyListFaces,
FontFace,
FontFaceClass,
pangoFontFaceListSizes,
pangoFontFaceDescribe,
Font,
FontClass,
) where
import Control.Monad (liftM)
import qualified Data.Text as T (unpack)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.GObject (makeNewGObject)
import Graphics.Rendering.Pango.BasicTypes
{-# LINE 83 "./Graphics/Rendering/Pango/Font.chs" #-}
import Graphics.Rendering.Pango.Types
{-# LINE 84 "./Graphics/Rendering/Pango/Font.chs" #-}
import Graphics.Rendering.Pango.Enums (FontMetrics)
import Graphics.Rendering.Pango.Description
import Graphics.Rendering.Pango.Structs
{-# LINE 89 "./Graphics/Rendering/Pango/Font.chs" #-}
pangoFontMapListFamilies :: FontMap -> IO [FontFamily]
pangoFontMapListFamilies fm = alloca $ \arrPtrPtr -> alloca $ \sizePtr -> do
(\(FontMap arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->pango_font_map_list_families argPtr1 arg2 arg3) fm arrPtrPtr sizePtr
arrPtr <- peek arrPtrPtr
size <- peek sizePtr
ffsPtr <- peekArray (fromIntegral size)
(castPtr arrPtr::Ptr (Ptr FontFamily))
g_free (castPtr arrPtr)
mapM (makeNewGObject mkFontFamily . return . castPtr) ffsPtr
instance Show FontFamily where
show ff = T.unpack . unsafePerformIO $ do
strPtr <- (\(FontFamily arg1) -> withForeignPtr arg1 $ \argPtr1 ->pango_font_family_get_name argPtr1) ff
peekUTFString strPtr
pangoFontFamilyIsMonospace :: FontFamily -> Bool
pangoFontFamilyIsMonospace ff = unsafePerformIO $
liftM toBool $ (\(FontFamily arg1) -> withForeignPtr arg1 $ \argPtr1 ->pango_font_family_is_monospace argPtr1) ff
pangoFontFamilyListFaces :: FontFamily -> IO [FontFace]
pangoFontFamilyListFaces ff = alloca $ \arrPtrPtr -> alloca $ \sizePtr -> do
(\(FontFamily arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->pango_font_family_list_faces argPtr1 arg2 arg3) ff arrPtrPtr sizePtr
arrPtr <- peek arrPtrPtr
size <- peek sizePtr
ffsPtr <- peekArray (fromIntegral size)
(castPtr arrPtr::Ptr (Ptr FontFace))
g_free (castPtr arrPtr)
mapM (makeNewGObject mkFontFace . return . castPtr) ffsPtr
instance Show FontFace where
show ff = T.unpack . unsafePerformIO $ do
strPtr <- (\(FontFace arg1) -> withForeignPtr arg1 $ \argPtr1 ->pango_font_face_get_face_name argPtr1) ff
peekUTFString strPtr
pangoFontFaceListSizes :: FontFace -> IO (Maybe [Double])
pangoFontFaceListSizes ff = alloca $ \arrPtrPtr -> alloca $ \sizePtr -> do
(\(FontFace arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->pango_font_face_list_sizes argPtr1 arg2 arg3) ff arrPtrPtr sizePtr
arrPtr <- peek arrPtrPtr
size <- peek sizePtr
if arrPtr==nullPtr then return Nothing else do
sizes <- peekArray (fromIntegral size) arrPtr
g_free (castPtr arrPtr)
return (Just (map intToPu sizes))
pangoFontFaceDescribe :: FontFace -> IO FontDescription
pangoFontFaceDescribe ff = do
fdPtr <- (\(FontFace arg1) -> withForeignPtr arg1 $ \argPtr1 ->pango_font_face_describe argPtr1) ff
makeNewFontDescription fdPtr
foreign import ccall unsafe "pango_font_map_list_families"
pango_font_map_list_families :: ((Ptr FontMap) -> ((Ptr (Ptr FontFamily)) -> ((Ptr CInt) -> (IO ()))))
foreign import ccall unsafe "g_free"
g_free :: ((Ptr ()) -> (IO ()))
foreign import ccall unsafe "pango_font_family_get_name"
pango_font_family_get_name :: ((Ptr FontFamily) -> (IO (Ptr CChar)))
foreign import ccall unsafe "pango_font_family_is_monospace"
pango_font_family_is_monospace :: ((Ptr FontFamily) -> (IO CInt))
foreign import ccall unsafe "pango_font_family_list_faces"
pango_font_family_list_faces :: ((Ptr FontFamily) -> ((Ptr (Ptr FontFace)) -> ((Ptr CInt) -> (IO ()))))
foreign import ccall unsafe "pango_font_face_get_face_name"
pango_font_face_get_face_name :: ((Ptr FontFace) -> (IO (Ptr CChar)))
foreign import ccall unsafe "pango_font_face_list_sizes"
pango_font_face_list_sizes :: ((Ptr FontFace) -> ((Ptr (Ptr CInt)) -> ((Ptr CInt) -> (IO ()))))
foreign import ccall unsafe "pango_font_face_describe"
pango_font_face_describe :: ((Ptr FontFace) -> (IO (Ptr FontDescription)))