From 144c40dbf48c165643a343436bc7b1a36d404a26 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Wed, 16 Feb 2022 15:12:27 +1300 Subject: [PATCH] Try wrapping HarfBuzz C++ functions in C functions for calling convention/linking issues. Committing so I can try building on a newer OS. --- Data/Text/Glyphize/Buffer.hs | 8 ++++---- Main.hs | 5 ++++- harfbuzz-pure.cabal | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/Data/Text/Glyphize/Buffer.hs b/Data/Text/Glyphize/Buffer.hs index 4f16264..68b6152 100644 --- a/Data/Text/Glyphize/Buffer.hs +++ b/Data/Text/Glyphize/Buffer.hs @@ -80,7 +80,7 @@ data Buffer = Buffer { replacementCodepoint :: Char -- ^ the hb_codepoint_t that replaces invalid entries for a given encoding -- when adding text to buffer . -} +} deriving (Eq, Show, Read) -- | An empty buffer with sensible default properties. defaultBuffer = Buffer { @@ -100,9 +100,9 @@ defaultBuffer = Buffer { replacementCodepoint = '\xFFFD' } -data ContentType = ContentTypeUnicode | ContentTypeGlyphs deriving (Eq, Show) -data Direction = DirLTR | DirRTL | DirTTB | DirBTT deriving (Eq, Show) -data ClusterLevel = ClusterMonotoneGraphemes | ClusterMonotoneChars | ClusterChars deriving (Eq, Show) +data ContentType = ContentTypeUnicode | ContentTypeGlyphs deriving (Eq, Show, Read) +data Direction = DirLTR | DirRTL | DirTTB | DirBTT deriving (Eq, Show, Read) +data ClusterLevel = ClusterMonotoneGraphemes | ClusterMonotoneChars | ClusterChars deriving (Eq, Show, Read) data GlyphInfo = GlyphInfo { codepoint :: Word32, diff --git a/Main.hs b/Main.hs index 456e290..2beb473 100644 --- a/Main.hs +++ b/Main.hs @@ -2,8 +2,11 @@ module Main where import "harfbuzz-pure" Data.Text.Glyphize +import "harfbuzz-pure" Data.Text.Glyphize.Buffer main :: IO () main = do - putStr "Hello, world!\n" + buf' <- freeze' defaultBuffer + -- buf <- thaw' buf' + print "Hello, world" -- TODO test I can shape text! diff --git a/harfbuzz-pure.cabal b/harfbuzz-pure.cabal index 23e678a..d60706e 100644 --- a/harfbuzz-pure.cabal +++ b/harfbuzz-pure.cabal @@ -62,7 +62,8 @@ library -- Other library packages from which modules are imported. build-depends: base >=4.9 && <5, bytestring, text, text-short, utf8-light -- , freetype2 >= 0.2 - extra-libraries: harfbuzz + pkgconfig-depends: harfbuzz + cxx-sources: c-bits/hbc-buffer.c -- Directories containing source files. -- hs-source-dirs: -- 2.30.2