~alcinnz/harfbuzz-pure

afc5608d58a63dd48d3132c53bebd38f66c10a52 — Adrian Cochrane 2 years ago 4674b43
Correction: buffer's codepoints are all Chars.
1 files changed, 9 insertions(+), 9 deletions(-)

M Data/Text/Glyphize/Buffer.hs
M Data/Text/Glyphize/Buffer.hs => Data/Text/Glyphize/Buffer.hs +9 -9
@@ 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 ()