From 9f9a5ae511ae17aaf5c099c862d657a52189d754 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Mon, 2 Jan 2023 14:32:57 +1300 Subject: [PATCH] Fix use of utf8-light dependency, dropping it. --- Data/Text/Glyphize/Buffer.hs | 6 +++++- Data/Text/Glyphize/Font.hs | 8 ++++---- harfbuzz-pure.cabal | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Data/Text/Glyphize/Buffer.hs b/Data/Text/Glyphize/Buffer.hs index f173d3e..358a69d 100644 --- a/Data/Text/Glyphize/Buffer.hs +++ b/Data/Text/Glyphize/Buffer.hs @@ -10,7 +10,6 @@ import Control.Exception (bracket) --- To fill computed text property. import Data.Text.Encoding (decodeUtf8Lenient) -import Codec.Binary.UTF8.Light (encodeUTF8, w2c, c2w) import qualified Data.Text.Array as A import GHC.Exts (ByteArray#, sizeofByteArray#, Int#) @@ -282,6 +281,11 @@ tag_to_string tag = [ w2c (shiftR tag 0 .&. 0x7f) ] +c2w :: Char -> Word32 +c2w = toEnum . fromEnum +w2c :: Word32 -> Char +w2c = toEnum . fromEnum + ------ --- Haskell-to-C conversion ------ diff --git a/Data/Text/Glyphize/Font.hs b/Data/Text/Glyphize/Font.hs index 6b4c391..15342ef 100644 --- a/Data/Text/Glyphize/Font.hs +++ b/Data/Text/Glyphize/Font.hs @@ -6,10 +6,10 @@ import Data.ByteString (packCStringLen) import Data.Word (Word8, Word32) import Data.Int (Int32) import FreeType.Core.Base (FT_Face) -import Data.Text.Glyphize.Buffer (tag_to_string, tag_from_string, Direction, dir2int) +import Data.Text.Glyphize.Buffer (tag_to_string, tag_from_string, Direction, dir2int, + c2w, w2c) import Control.Monad (forM, unless) -import Codec.Binary.UTF8.Light (w2c, c2w) import Data.Maybe (fromMaybe) import System.IO.Unsafe (unsafePerformIO) @@ -353,8 +353,8 @@ fontFace font = unsafePerformIO $ withForeignPtr font $ \font' -> do newForeignPtr_ face' -- FIXME: Keep the font alive... foreign import ccall "hb_font_get_face" hb_font_get_face :: Font_ -> IO Face_ - -- | Fetches the glyph ID for a Unicode codepoint in the specified `Font`, - -- with an optional variation selector. +-- | Fetches the glyph ID for a Unicode codepoint in the specified `Font`, +-- with an optional variation selector. fontGlyph :: Font -> Char -> Maybe Char -> Maybe Word32 fontGlyph font char var = unsafePerformIO $ withForeignPtr font $ \font' -> alloca $ \ret -> do diff --git a/harfbuzz-pure.cabal b/harfbuzz-pure.cabal index 47425b7..d9b861a 100644 --- a/harfbuzz-pure.cabal +++ b/harfbuzz-pure.cabal @@ -10,7 +10,7 @@ name: harfbuzz-pure -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 0.1.0.0 +version: 0.1.0.1 -- A short (one-line) description of the package. synopsis: Pure-functional Harfbuzz language bindings @@ -60,7 +60,7 @@ library -- other-extensions: -- Other library packages from which modules are imported. - build-depends: base >=4.12 && <4.13, text >= 2.0 && < 3, utf8-light >= 0.4 && < 0.5, + build-depends: base >=4.12 && <4.13, text >= 2.0 && < 3, bytestring >= 0.11, freetype2 >= 0.2, derive-storable >= 0.3 && < 1 pkgconfig-depends: harfbuzz -- 2.30.2