Buffer
Object Hierarchy:
Description:
[ CCode ( cname = "hb_buffer_t" , copy_function = "g_boxed_copy" , free_function = "g_boxed_free" , type_id = "hb_gobject_buffer_get_type ()" ) ]
[ Compact ]
[ GIR ( name = "buffer_t" ) ]
public class Buffer
[ Compact ]
[ GIR ( name = "buffer_t" ) ]
public class Buffer
The main structure holding the input text and its properties before shaping, and output glyphs and their information after shaping.
Namespace: HarfBuzz
Package: harfbuzz-gobject
Content:
Static methods:
- public static Buffer create ()
Creates a new Buffer with all properties to defaults.
- public static Buffer get_empty ()
Fetches an empty Buffer.
- public static BufferSerializeFormat serialize_format_from_string (uint8[] str)
Parses a string into an BufferSerializeFormat.
- public static unowned string serialize_format_to_string (BufferSerializeFormat format)
Converts
formatto the string corresponding it, or `NULL` if it is not a valid BufferSerializeFormat. - public static unowned string[] serialize_list_formats ()
Returns a list of supported buffer serialization formats.
Methods:
- public void add (Codepoint codepoint, uint cluster)
Appends a character with the Unicode value of
codepointtobuffer, and gives it the initial cluster value ofcluster. - public void add_codepoints (Codepoint[] text, uint item_offset, int item_length)
Appends characters from
textarray tobuffer. - public void add_latin1 (uint8[] text, uint item_offset, int item_length)
Similar to add_codepoints, but allows only access to first 256 Unicode code points that can fit in 8-bit strings.
- public void add_utf16 (uint16[] text, uint item_offset, int item_length)
See add_codepoints.
- public void add_utf32 (uint32[] text, uint item_offset, int item_length)
See add_codepoints.
- public void add_utf8 (uint8[] text, uint item_offset, int item_length)
See add_codepoints.
- public Bool allocation_successful ()
Check if allocating memory for the buffer succeeded.
- public void append (Buffer source, uint start, uint end)
Append (part of) contents of another buffer to this buffer.
- public void clear_contents ()
Similar to reset, but does not clear the Unicode functions and the replacement code point.
- public Buffer create_similar ()
Creates a new Buffer, similar to create.
- public Bool deserialize_glyphs (char[] buf, out string end_ptr, Font? font, BufferSerializeFormat format)
Deserializes glyphs
bufferfrom textual representation in the format produced by serialize_glyphs. - public Bool deserialize_unicode (char[] buf, out string end_ptr, BufferSerializeFormat format)
Deserializes Unicode
bufferfrom textual representation in the format produced by serialize_unicode. - public BufferDiffFlags diff (Buffer reference, Codepoint dottedcircle_glyph, uint position_fuzz)
If dottedcircle_glyph is (hb_codepoint_t) -1 then DOTTED_CIRCLE_PRESENT and NOTDEF_PRESENT are never returned.
- public BufferClusterLevel get_cluster_level ()
Fetches the cluster level of a buffer.
- public BufferContentType get_content_type ()
Fetches the type of
buffercontents. - public Direction get_direction ()
See set_direction
- public BufferFlags get_flags ()
Fetches the BufferFlags of
buffer. - public unowned Glyph[] get_glyph_infos ()
Returns
bufferglyph information array. - public unowned GlyphPosition[] get_glyph_positions ()
Returns
bufferglyph position array. - public Codepoint get_invisible_glyph ()
See set_invisible_glyph.
- public unowned Language get_language ()
See set_language.
- public uint get_length ()
Returns the number of items in the buffer.
- public Codepoint get_not_found_glyph ()
See set_not_found_glyph.
- public Codepoint get_replacement_codepoint ()
Fetches the Codepoint that replaces invalid entries for a given encoding when adding text to
buffer. - public Script get_script ()
Fetches the script of
buffer. - public void get_segment_properties (out unowned SegmentProperties props)
Sets
propsto the SegmentProperties ofbuffer. - public UnicodeFuncs get_unicode_funcs ()
Fetches the Unicode-functions structure of a buffer.
- public void guess_segment_properties ()
Sets unset buffer segment properties based on buffer Unicode contents.
- public Bool has_positions ()
Returns whether
bufferhas glyph position data. - public void normalize_glyphs ()
Reorders a glyph buffer to have canonical in-cluster glyph order / position.
- public Bool pre_allocate (uint size)
Pre allocates memory for
bufferto fit at leastsizenumber of items. - public void reset ()
Resets the buffer to its initial status, as if it was just newly created with create.
- public void reverse ()
Reverses buffer contents.
- public void reverse_clusters ()
Reverses buffer clusters.
- public void reverse_range (uint start, uint end)
Reverses buffer contents between
startandend. - public uint serialize (uint start, uint end, out uint8[] buf, out uint buf_consumed, Font? font, BufferSerializeFormat format, BufferSerializeFlags flags)
Serializes
bufferinto a textual representation of its content, whether Unicode codepoints or glyph identifiers and positioning information. - public uint serialize_glyphs (uint start, uint end, out uint8[] buf, out uint buf_consumed, Font? font, BufferSerializeFormat format, BufferSerializeFlags flags)
Serializes
bufferinto a textual representation of its glyph content, useful for showing the contents of the buffer, for example during debugging. - public uint serialize_unicode (uint start, uint end, out uint8[] buf, out uint buf_consumed, BufferSerializeFormat format, BufferSerializeFlags flags)
Serializes
bufferinto a textual representation of its content, when the buffer contains Unicode codepoints (i. - public void set_cluster_level (BufferClusterLevel cluster_level)
Sets the cluster level of a buffer.
- public void set_content_type (BufferContentType content_type)
Sets the type of
buffercontents. - public void set_direction (Direction direction)
Set the text flow direction of the buffer.
- public void set_flags (BufferFlags flags)
Sets
bufferflags toflags. - public void set_invisible_glyph (Codepoint invisible)
Sets the Codepoint that replaces invisible characters in the shaping result.
- public void set_language (Language language)
Sets the language of
buffertolanguage. - public Bool set_length (uint length)
Similar to pre_allocate, but clears any new items added at the end.
- public void set_message_func (owned BufferMessageFunc func)
Sets the implementation function for BufferMessageFunc.
- public void set_not_found_glyph (Codepoint not_found)
Sets the Codepoint that replaces characters not found in the font during shaping.
- public void set_replacement_codepoint (Codepoint replacement)
Sets the Codepoint that replaces invalid entries for a given encoding when adding text to
buffer. - public void set_script (Script script)
Sets the script of
buffertoscript. - public void set_segment_properties (SegmentProperties props)
Sets the segment properties of the buffer, a shortcut for calling set_direction, set_script and set_language individually.
- public void set_unicode_funcs (UnicodeFuncs unicode_funcs)
Sets the Unicode-functions structure of a buffer to
unicode_funcs.