From afc5608d58a63dd48d3132c53bebd38f66c10a52 Mon Sep 17 00:00:00 2001 From: Adrian Cochrane Date: Sat, 12 Feb 2022 19:25:43 +1300 Subject: [PATCH] Correction: buffer's codepoints are all Chars. --- Data/Text/Glyphize/Buffer.hs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Data/Text/Glyphize/Buffer.hs b/Data/Text/Glyphize/Buffer.hs index 687480e..d4b9c17 100644 --- a/Data/Text/Glyphize/Buffer.hs +++ b/Data/Text/Glyphize/Buffer.hs @@ -69,11 +69,11 @@ data Buffer = Buffer { clusterLevel :: ClusterLevel, -- ^ dictates one aspect of how HarfBuzz will treat non-base characters -- during shaping. - invisibleGlyph :: Word32, + invisibleGlyph :: Char, -- ^ The glyph number that replaces invisible characters in the -- shaping result. If set to zero (default), the glyph for the U+0020 -- SPACE character is used. Otherwise, this value is used verbatim. - notFoundGlyph :: Word32, + notFoundGlyph :: Char, -- ^ the glyph number that replaces characters not found in the font during shaping. -- The not-found glyph defaults to zero, sometimes knows as the ".notdef" glyph. -- This API allows for differentiating the two. @@ -95,8 +95,8 @@ defaultBuffer = Buffer { removeDefaultIgnorables = False, don'tInsertDottedCircle = False, clusterLevel = ClusterMonotoneGraphemes, - invisibleGlyph = 0, - notFoundGlyph = 0, + invisibleGlyph = '\0', + notFoundGlyph = '\0', replacementCodepoint = '\xFFFD' } @@ -196,9 +196,9 @@ freeze' buf = do ClusterMonotoneGraphemes -> 0 ClusterMonotoneChars -> 1 ClusterChars -> 2 - hb_buffer_set_invisible_glyph buffer $ invisibleGlyph buf - hb_buffer_set_not_found_glyph buffer $ notFoundGlyph buf - hb_buffer_set_replacement_codepoint buffer $ ord $ replacementCodepoint buf + hb_buffer_set_invisible_glyph buffer $ c2w $ invisibleGlyph buf + hb_buffer_set_not_found_glyph buffer $ c2w $ notFoundGlyph buf + hb_buffer_set_replacement_codepoint buffer $ c2w $ replacementCodepoint buf case (contentType buf, direction buf, script buf, language buf) of (Just ContentTypeUnicode, Nothing, _, _) -> hb_buffer_guess_segment_properties buffer (Just ContentTypeUnicode, _, Nothing, _) -> hb_buffer_guess_segment_properties buffer @@ -260,7 +260,7 @@ thaw' buf' = do 1 -> ClusterMonotoneChars 2 -> ClusterChars _ -> ClusterMonotoneGraphemes, - invisibleGlyph = invisibleGlyph', notFoundGlyph = notFoundGlyph', + invisibleGlyph = w2c invisibleGlyph', notFoundGlyph = w2c notFoundGlyph', replacementCodepoint = w2c replacementCodepoint' } @@ -320,7 +320,7 @@ foreign import ccall "hb_buffer_set_invisible_glyph" hb_buffer_set_invisible_gly foreign import ccall "hb_buffer_set_not_found_glyph" hb_buffer_set_not_found_glyph :: Ptr Buffer'' -> Word32 -> IO () foreign import ccall "hb_buffer_set_replacement_codepoint" hb_buffer_set_replacement_codepoint - :: Ptr Buffer'' -> Int -> IO () + :: Ptr Buffer'' -> Word32 -> IO () foreign import ccall "hb_buffer_guess_segment_properties" hb_buffer_guess_segment_properties :: Ptr Buffer'' -> IO () -- 2.30.2