Sign in

    moonbit-community/harfbuzz/buffer does not have a README file

    Buffer

    pub struct Buffer {
    infos : Array[GlyphInfo]
    positions : Array[GlyphPosition]
    direction :
    Direction

    script :
    Script

    language :
    Language

    gsub_features : Array[
    Tag
    ]
    gpos_features : Array[
    Tag
    ]
    gsub_features_default : Bool
    gpos_features_default : Bool
    gsub_feature_values : FeatureValues?
    preserve_default_ignorables : Bool
    remove_default_ignorables : Bool
    not_found_variation_selector : UInt?
    } derive(Show, ToJson)

    Text buffer for shaping.

    Buffer::add_char

    fn Buffer::add_char(self : Buffer, ch : Char, cluster? : Int) -> Unit

    Append a character with cluster.

    Buffer::add_codepoint

    fn Buffer::add_codepoint(self : Buffer, codepoint : UInt, cluster? : Int) -> Unit

    Append a codepoint with cluster.

    Buffer::add_string

    fn Buffer::add_string(self : Buffer, text : String) -> Unit

    Append all characters from a string.

    Buffer::add_tracking

    fn Buffer::add_tracking(self : Buffer, adjustment : Int, horizontal : Bool) -> Unit

    Add tracking adjustment to advances.

    Buffer::apply_gpos

    fn Buffer::apply_gpos(self : Buffer, font :
    Font
    , include_all_features? : Bool, adjust_mark_offsets? : Bool) -> Result[Bool, ShapeError]

    Apply GPOS positioning to the current glyph sequence. Returns true when GPOS was present.

    Buffer::apply_kerx

    fn Buffer::apply_kerx(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Apply AAT kerx kerning adjustments if present.

    Buffer::apply_morx

    fn Buffer::apply_morx(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Apply AAT morx/mort substitutions and rearrangements if present.

    Buffer::apply_trak

    fn Buffer::apply_trak(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Apply AAT trak tracking adjustments if present.

    Buffer::clear

    fn Buffer::clear(self : Buffer) -> Unit

    Clear all glyph data.

    Buffer::get_direction

    Get direction.

    Buffer::get_language

    Get language.

    Buffer::get_not_found_variation_selector

    fn Buffer::get_not_found_variation_selector(self : Buffer) -> UInt?

    Get the fallback glyph for not-found variation selectors.

    Buffer::get_script

    Get script.

    Buffer::gpos_features

    Buffer::gsub_features

    Buffer::guess_segment_properties

    fn Buffer::guess_segment_properties(self : Buffer) -> Unit

    Fill missing segment properties with defaults.

    Buffer::has_kerx

    fn Buffer::has_kerx(self : Buffer, font :
    Font
    ) -> Result[Bool, ShapeError]

    Return true if kerx data is present.

    Buffer::infos

    fn Buffer::infos(self : Buffer) -> ArrayView[GlyphInfo]

    Access glyph infos.

    Buffer::is_empty

    fn Buffer::is_empty(self : Buffer) -> Bool

    Return true when empty.

    Buffer::len

    fn Buffer::len(self : Buffer) -> Int

    Number of glyphs in the buffer.

    Buffer::merge_clusters

    fn Buffer::merge_clusters(self : Buffer, start : Int, end : Int) -> Unit

    Merge clusters in the range [start, end).

    Buffer::merge_combining_mark_clusters

    fn Buffer::merge_combining_mark_clusters(self : Buffer) -> Unit

    Merge clusters for base + combining-mark sequences.

    Buffer::new

    fn Buffer::new() -> Buffer

    Create an empty buffer.

    Buffer::normalize

    fn Buffer::normalize(self : Buffer) -> Unit

    Normalize buffer codepoints by reordering combining marks.

    Buffer::positions

    fn Buffer::positions(self : Buffer) -> ArrayView[GlyphPosition]

    Access glyph positions.

    Buffer::replace_glyphs

    fn Buffer::replace_glyphs(self : Buffer, infos : Array[GlyphInfo], positions? : Array[GlyphPosition]) -> Bool

    Replace glyph infos and positions. Returns false if lengths mismatch.

    Buffer::serialize

    fn Buffer::serialize(self : Buffer, format? : BufferSerializeFormat, mode? : BufferSerializeMode, start? : Int, end? : Int, no_positions? : Bool, no_clusters? : Bool, no_advances? : Bool) -> String

    Buffer::set_direction

    fn Buffer::set_direction(self : Buffer, direction :
    Direction
    ) -> Unit

    Set direction.

    Buffer::set_gpos_features

    fn Buffer::set_gpos_features(self : Buffer, features : Array[
    Tag
    ]) -> Unit

    Buffer::set_gsub_feature_values

    fn Buffer::set_gsub_feature_values(self : Buffer, tag :
    Tag
    , values : Array[Int]) -> Unit

    Set per-glyph GSUB feature values for a specific tag.

    Buffer::set_gsub_features

    fn Buffer::set_gsub_features(self : Buffer, features : Array[
    Tag
    ]) -> Unit

    Buffer::set_language

    fn Buffer::set_language(self : Buffer, language :
    Language
    ) -> Unit

    Set language.

    Buffer::set_not_found_variation_selector

    fn Buffer::set_not_found_variation_selector(self : Buffer, glyph : UInt?) -> Unit

    Set the fallback glyph for not-found variation selectors.

    Buffer::set_preserve_default_ignorables

    fn Buffer::set_preserve_default_ignorables(self : Buffer, preserve : Bool) -> Unit

    Preserve default-ignorable codepoints (do not hide/zero).

    Buffer::set_remove_default_ignorables

    fn Buffer::set_remove_default_ignorables(self : Buffer, remove : Bool) -> Unit

    Remove default-ignorable glyphs instead of zeroing advances.

    Buffer::set_script

    fn Buffer::set_script(self : Buffer, script :
    Script
    ) -> Unit

    Set script.

    Buffer::shape_arabic

    fn Buffer::shape_arabic(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Buffer::shape_basic

    fn Buffer::shape_basic(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Populate glyph IDs and advances using cmap + hmtx.

    Buffer::shape_hangul

    fn Buffer::shape_hangul(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Buffer::shape_hebrew

    fn Buffer::shape_hebrew(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Buffer::shape_indic

    fn Buffer::shape_indic(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Buffer::shape_khmer

    fn Buffer::shape_khmer(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Buffer::shape_myanmar

    fn Buffer::shape_myanmar(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Buffer::shape_ot

    fn Buffer::shape_ot(self : Buffer, font :
    Font
    , fallback_position? : Bool) -> Result[Unit, ShapeError]

    Shape with GSUB single substitution and GPOS pair adjustment.

    Buffer::shape_thai

    fn Buffer::shape_thai(self : Buffer, font :
    Font
    ) -> Result[Unit, ShapeError]

    Buffer::shape_use

    Buffer::verify

    fn Buffer::verify(self : Buffer) -> Bool

    Verify basic buffer invariants (cluster monotonicity and length consistency).

    BufferSerializeFormat

    pub(all) enum BufferSerializeFormat {
    Invalid
    Text
    Json
    } derive(Eq, Show)

    BufferSerializeFormat::from_string

    fn BufferSerializeFormat::from_string(s : String, len? : Int) -> BufferSerializeFormat

    BufferSerializeFormat::to_string

    fn BufferSerializeFormat::to_string(self : BufferSerializeFormat) -> String?

    BufferSerializeMode

    pub(all) enum BufferSerializeMode {
    Glyphs
    Unicode
    } derive(Eq, Show)

    BufferSerializeMode::from_string

    fn BufferSerializeMode::from_string(s : String, len? : Int) -> BufferSerializeMode

    FeatureValues

    type FeatureValues derive(Show, ToJson)

    GlyphExtents

    type GlyphExtents derive(Show)

    GlyphInfo

    pub struct GlyphInfo {
    codepoint : UInt
    cluster : Int
    unicode : UInt
    } derive(Eq, Show, ToJson)

    Glyph info entry.

    GlyphPosition

    pub struct GlyphPosition {
    x_advance : Int
    y_advance : Int
    x_offset : Int
    y_offset : Int
    } derive(Eq, Show, ToJson)

    Glyph positioning data.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io