From 614373ce2efd58cb374a592f258923de016754ef Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Tue, 22 Nov 2022 15:49:55 +1300 Subject: [PATCH] Compile and test Init routines. --- Graphics/Text/Font/Choose/Config.hs | 1 + Graphics/Text/Font/Choose/Init.hs | 6 ++++-- fontconfig-pure.cabal | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Graphics/Text/Font/Choose/Config.hs b/Graphics/Text/Font/Choose/Config.hs index 9a4961e..94327d2 100644 --- a/Graphics/Text/Font/Choose/Config.hs +++ b/Graphics/Text/Font/Choose/Config.hs @@ -23,6 +23,7 @@ type Config_ = Ptr Config' configCreate :: IO Config configCreate = newForeignPtr fcConfigDestroy =<< throwNull <$> fcConfigCreate foreign import ccall "FcConfigCreate" fcConfigCreate :: IO Config_ +ptr2config = newForeignPtr fcConfigDestroy foreign import ccall "&FcConfigDestroy" fcConfigDestroy :: FunPtr (Config_ -> IO ()) configSetCurrent :: Config -> IO () diff --git a/Graphics/Text/Font/Choose/Init.hs b/Graphics/Text/Font/Choose/Init.hs index fac0d8e..5bd3674 100644 --- a/Graphics/Text/Font/Choose/Init.hs +++ b/Graphics/Text/Font/Choose/Init.hs @@ -5,8 +5,10 @@ import Prelude hiding (init) import Graphics.Text.Font.Choose.Config -foreign import ccall "FcInitLoadConfig" initLoadConfig :: IO Config -foreign import ccall "FcInitLoadConfigAndFonts" initLoadConfigAndFonts :: IO Config +initLoadConfig = fcInitLoadConfig >>= ptr2config +foreign import ccall "FcInitLoadConfig" fcInitLoadConfig :: IO Config_ +initLoadConfigAndFonts = fcInitLoadConfigAndFonts >>= ptr2config +foreign import ccall "FcInitLoadConfigAndFonts" fcInitLoadConfigAndFonts :: IO Config_ foreign import ccall "FcInit" init :: IO Bool foreign import ccall "FcFini" fini :: IO () diff --git a/fontconfig-pure.cabal b/fontconfig-pure.cabal index ab21c07..4c164cf 100644 --- a/fontconfig-pure.cabal +++ b/fontconfig-pure.cabal @@ -56,7 +56,7 @@ library Graphics.Text.Font.Choose.Strings, Graphics.Text.Font.Choose.Range, Graphics.Text.Font.Choose.LangSet, Graphics.Text.Font.Choose.Value, Graphics.Text.Font.Choose.Pattern, Graphics.Text.Font.Choose.FontSet, - Graphics.Text.Font.Choose.Config + Graphics.Text.Font.Choose.Config, Graphics.Text.Font.Choose.Init c-sources: cbits/pattern.c -- 2.30.2