From a327c852daa751de8d395ea1412b26ec6ff89a0f Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Wed, 23 Nov 2022 12:18:10 +1300 Subject: [PATCH] Fix linking issues, still has issues decoding patterns. --- Graphics/Text/Font/Choose/Pattern.hs | 2 +- Graphics/Text/Font/Choose/Value.hs | 2 +- Main.hs | 15 ++++++++++++++- fontconfig-pure.cabal | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Graphics/Text/Font/Choose/Pattern.hs b/Graphics/Text/Font/Choose/Pattern.hs index ddd3555..9b4b7cd 100644 --- a/Graphics/Text/Font/Choose/Pattern.hs +++ b/Graphics/Text/Font/Choose/Pattern.hs @@ -86,7 +86,7 @@ withPattern pat cb = withNewPattern $ \pat' -> do (fcPatternAdd_ pat' obj' (strength == Strong) True) cb pat' -- Does Haskell FFI support unboxed structs? Do I really need to write a C wrapper? -foreign import ccall "my_FCPatternAdd" fcPatternAdd_ :: +foreign import ccall "my_FcPatternAdd" fcPatternAdd_ :: Pattern_ -> CString -> Bool -> Bool -> Value_ -> IO Bool patternAsPointer :: Pattern -> IO Pattern_ diff --git a/Graphics/Text/Font/Choose/Value.hs b/Graphics/Text/Font/Choose/Value.hs index dbbee5a..f546501 100644 --- a/Graphics/Text/Font/Choose/Value.hs +++ b/Graphics/Text/Font/Choose/Value.hs @@ -38,7 +38,7 @@ instance Hashable Value type Value_ = Ptr Int -foreign import ccall "sizeof_Value" value'Size :: Int +foreign import ccall "size_value" value'Size :: Int pokeUnion ptr x = castPtr (ptr `advancePtr` 1) `poke` x withValue :: Value -> (Value_ -> IO a) -> IO a diff --git a/Main.hs b/Main.hs index 65ae4a0..9c079d2 100644 --- a/Main.hs +++ b/Main.hs @@ -1,4 +1,17 @@ +{-# LANGUAGE PackageImports #-} module Main where +import "fontconfig-pure" Graphics.Text.Font.Choose as Font + +import System.Environment (getArgs) + main :: IO () -main = putStrLn "Hello, Haskell!" +main = do + print "a" + args <- getArgs + print "b" + let query = nameParse $ case args of { + [] -> "serif"; + words -> unwords words} + print "c" + print query diff --git a/fontconfig-pure.cabal b/fontconfig-pure.cabal index c80fedf..db22591 100644 --- a/fontconfig-pure.cabal +++ b/fontconfig-pure.cabal @@ -92,7 +92,7 @@ executable fontconfig-pure -- other-extensions: -- Other library packages from which modules are imported. - build-depends: base >=4.12 && <4.13 + build-depends: base >=4.12 && <4.13, fontconfig-pure -- Directories containing source files. -- hs-source-dirs: -- 2.30.2