Functions

  blob_copy_writable_or_fail (blob)
  blob_create_from_file (file_name)
  blob_create_sub_blob (parent, offset, length)
  blob_get_data (blob)
  blob_get_data_writable (blob)
  blob_get_empty ()
  blob_get_length (blob)
  blob_is_immutable (blob)
  blob_make_immutable (blob)
  buffer_add (buffer, codepoint, cluster)
  buffer_add_codepoints (buffer, text, item_offset, item_length)
  buffer_add_latin1 (buffer, text, item_offset, item_length)
  buffer_add_utf16 (buffer, text, item_offset, item_length)
  buffer_add_utf32 (buffer, text, item_offset, item_length)
  buffer_add_utf8 (buffer, text, item_offset, item_length)
  buffer_allocation_successful (buffer)
  buffer_append (buffer, source, start, end)
  buffer_clear_contents (buffer)
  buffer_create ()
  buffer_deserialize_glyphs (buffer, buf, font, format)
  buffer_deserialize_unicode (buffer, buf, format)
  buffer_diff (buffer, reference, dottedcircle_glyph, position_fuzz)
  buffer_get_cluster_level (buffer)
  buffer_get_content_type (buffer)
  buffer_get_direction (buffer)
  buffer_get_empty ()
  buffer_get_flags (buffer)
  buffer_get_glyph_infos (buffer)
  buffer_get_glyph_positions (buffer)
  buffer_get_invisible_glyph (buffer)
  buffer_get_language (buffer)
  buffer_get_length (buffer)
  buffer_get_replacement_codepoint (buffer)
  buffer_get_script (buffer)
  buffer_get_segment_properties (buffer)
  buffer_get_unicode_funcs (buffer)
  buffer_guess_segment_properties (buffer)
  buffer_has_positions (buffer)
  buffer_normalize_glyphs (buffer)
  buffer_pre_allocate (buffer, size)
  buffer_reset (buffer)
  buffer_reverse (buffer)
  buffer_reverse_clusters (buffer)
  buffer_reverse_range (buffer, start, end)
  buffer_serialize (buffer, start, end, font, format, flags)
  buffer_serialize_format_from_string (str)
  buffer_serialize_format_to_string (format)
  buffer_serialize_glyphs (buffer, start, end, font, format, flags)
  buffer_serialize_list_formats ()
  buffer_serialize_unicode (buffer, start, end, format, flags)
  buffer_set_cluster_level (buffer, cluster_level)
  buffer_set_content_type (buffer, content_type)
  buffer_set_direction (buffer, direction)
  buffer_set_flags (buffer, flags)
  buffer_set_invisible_glyph (buffer, invisible)
  buffer_set_language (buffer, language)
  buffer_set_length (buffer, length)
  buffer_set_message_func (buffer, func, *user_data)
  buffer_set_replacement_codepoint (buffer, replacement)
  buffer_set_script (buffer, script)
  buffer_set_segment_properties (buffer, props)
  buffer_set_unicode_funcs (buffer, unicode_funcs)
  color_get_alpha (color)
  color_get_blue (color)
  color_get_green (color)
  color_get_red (color)
  direction_from_string (str)
  direction_to_string (direction)
  face_builder_add_table (face, tag, blob)
  face_builder_create ()
  face_collect_unicodes (face, out)
  face_collect_variation_selectors (face, out)
  face_collect_variation_unicodes (face, variation_selector, out)
  face_count (blob)
  face_create (blob, index)
  face_create_for_tables (reference_table_func, *user_data)
  face_get_empty ()
  face_get_glyph_count (face)
  face_get_index (face)
  face_get_table_tags (face, start_offset)
  face_get_upem (face)
  face_is_immutable (face)
  face_make_immutable (face)
  face_reference_blob (face)
  face_reference_table (face, tag)
  face_set_glyph_count (face, glyph_count)
  face_set_index (face, index)
  face_set_upem (face, upem)
  feature_from_string (str)
  feature_to_string (feature)
  font_add_glyph_origin_for_direction (font, glyph, direction, x, y)
  font_create (face)
  font_create_sub_font (parent)
  font_funcs_create ()
  font_funcs_get_empty ()
  font_funcs_is_immutable (ffuncs)
  font_funcs_make_immutable (ffuncs)
  font_funcs_set_font_h_extents_func (ffuncs, func, *user_data)
  font_funcs_set_font_v_extents_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_contour_point_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_extents_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_from_name_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_h_advance_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_h_advances_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_h_kerning_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_h_origin_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_name_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_v_advance_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_v_advances_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_v_kerning_func (ffuncs, func, *user_data)
  font_funcs_set_glyph_v_origin_func (ffuncs, func, *user_data)
  font_funcs_set_nominal_glyph_func (ffuncs, func, *user_data)
  font_funcs_set_nominal_glyphs_func (ffuncs, func, *user_data)
  font_funcs_set_variation_glyph_func (ffuncs, func, *user_data)
  font_get_empty ()
  font_get_extents_for_direction (font, direction)
  font_get_face (font)
  font_get_glyph (font, unicode, variation_selector)
  font_get_glyph_advance_for_direction (font, glyph, direction)
  font_get_glyph_advances_for_direction (font, direction, count, first_glyph, glyph_stride)
  font_get_glyph_contour_point (font, glyph, point_index)
  font_get_glyph_contour_point_for_origin (font, glyph, point_index, direction)
  font_get_glyph_extents (font, glyph)
  font_get_glyph_extents_for_origin (font, glyph, direction)
  font_get_glyph_from_name (font, name)
  font_get_glyph_h_advance (font, glyph)
  font_get_glyph_h_advances (font, count, first_glyph, glyph_stride)
  font_get_glyph_h_kerning (font, left_glyph, right_glyph)
  font_get_glyph_h_origin (font, glyph)
  font_get_glyph_kerning_for_direction (font, first_glyph, second_glyph, direction)
  font_get_glyph_name (font, glyph)
  font_get_glyph_origin_for_direction (font, glyph, direction)
  font_get_glyph_v_advance (font, glyph)
  font_get_glyph_v_advances (font, count, first_glyph, glyph_stride)
  font_get_glyph_v_kerning (font, top_glyph, bottom_glyph)
  font_get_glyph_v_origin (font, glyph)
  font_get_h_extents (font)
  font_get_nominal_glyph (font, unicode)
  font_get_nominal_glyphs (font, count, first_unicode, unicode_stride, first_glyph, glyph_stride)
  font_get_parent (font)
  font_get_ppem (font)
  font_get_ptem (font)
  font_get_scale (font)
  font_get_v_extents (font)
  font_get_var_coords_normalized (font, length)
  font_get_variation_glyph (font, unicode, variation_selector)
  font_glyph_from_string (font, s)
  font_glyph_to_string (font, glyph)
  font_is_immutable (font)
  font_make_immutable (font)
  font_set_face (font, face)
  font_set_funcs (font, klass, font_data, destroy)
  font_set_funcs_data (font, font_data, destroy)
  font_set_parent (font, parent)
  font_set_ppem (font, x_ppem, y_ppem)
  font_set_ptem (font, ptem)
  font_set_scale (font, x_scale, y_scale)
  font_set_var_coords_design (font, coords)
  font_set_var_coords_normalized (font, coords)
  font_set_var_named_instance (font, instance_index)
  font_set_variations (font, variations)
  font_subtract_glyph_origin_for_direction (font, glyph, direction, x, y)
  ft_font_changed (font)
  ft_font_get_load_flags (font)
  ft_font_set_funcs (font)
  ft_font_set_load_flags (font, load_flags)
  ft_font_unlock_face (font)
  glib_blob_create (gbytes)
  glib_get_unicode_funcs ()
  glib_script_from_script (script)
  glib_script_to_script (script)
  glyph_info_get_glyph_flags (info)
  language_from_string (str)
  language_get_default ()
  language_to_string (language)
  map_allocation_successful (map)
  map_clear (map)
  map_create ()
  map_del (map, key)
  map_get (map, key)
  map_get_empty ()
  map_get_population (map)
  map_has (map, key)
  map_is_empty (map)
  map_set (map, key, value)
  ot_color_glyph_get_layers (face, glyph, start_offset)
  ot_color_glyph_reference_png (font, glyph)
  ot_color_glyph_reference_svg (face, glyph)
  ot_color_has_layers (face)
  ot_color_has_palettes (face)
  ot_color_has_png (face)
  ot_color_has_svg (face)
  ot_color_palette_color_get_name_id (face, color_index)
  ot_color_palette_get_colors (face, palette_index, start_offset)
  ot_color_palette_get_count (face)
  ot_color_palette_get_flags (face, palette_index)
  ot_color_palette_get_name_id (face, palette_index)
  ot_font_set_funcs (font)
  ot_layout_collect_features (face, table_tag, scripts, languages, features)
  ot_layout_collect_lookups (face, table_tag, scripts, languages, features)
  ot_layout_feature_get_characters (face, table_tag, feature_index, start_offset)
  ot_layout_feature_get_lookups (face, table_tag, feature_index, start_offset)
  ot_layout_feature_get_name_ids (face, table_tag, feature_index)
  ot_layout_feature_with_variations_get_lookups (face, table_tag, feature_index, variations_index, start_offset)
  ot_layout_get_attach_points (face, glyph, start_offset)
  ot_layout_get_baseline (font, baseline_tag, direction, script_tag, language_tag)
  ot_layout_get_glyph_class (face, glyph)
  ot_layout_get_glyphs_in_class (face, klass)
  ot_layout_get_ligature_carets (font, direction, glyph, start_offset)
  ot_layout_get_size_params (face)
  ot_layout_has_glyph_classes (face)
  ot_layout_has_positioning (face)
  ot_layout_has_substitution (face)
  ot_layout_language_find_feature (face, table_tag, script_index, language_index, feature_tag)
  ot_layout_language_get_feature_indexes (face, table_tag, script_index, language_index, start_offset)
  ot_layout_language_get_feature_tags (face, table_tag, script_index, language_index, start_offset)
  ot_layout_language_get_required_feature (face, table_tag, script_index, language_index)
  ot_layout_language_get_required_feature_index (face, table_tag, script_index, language_index)
  ot_layout_lookup_collect_glyphs (face, table_tag, lookup_index)
  ot_layout_lookup_get_glyph_alternates (face, lookup_index, glyph, start_offset)
  ot_layout_lookup_substitute_closure (face, lookup_index)
  ot_layout_lookup_would_substitute (face, lookup_index, glyphs, glyphs_length, zero_context)
  ot_layout_lookups_substitute_closure (face, lookups)
  ot_layout_script_find_language (face, table_tag, script_index, language_tag, language_index)
  ot_layout_script_get_language_tags (face, table_tag, script_index, start_offset)
  ot_layout_script_select_language (face, table_tag, script_index, language_count, language_tags)
  ot_layout_table_choose_script (face, table_tag, script_tags)
  ot_layout_table_find_feature_variations (face, table_tag, coords, num_coords)
  ot_layout_table_find_script (face, table_tag, script_tag)
  ot_layout_table_get_feature_tags (face, table_tag, start_offset)
  ot_layout_table_get_lookup_count (face, table_tag)
  ot_layout_table_get_script_tags (face, table_tag, start_offset)
  ot_layout_table_select_script (face, table_tag, script_count, script_tags)
  ot_math_get_constant (font, constant)
  ot_math_get_glyph_assembly (font, glyph, direction, start_offset)
  ot_math_get_glyph_italics_correction (font, glyph)
  ot_math_get_glyph_kerning (font, glyph, kern, correction_height)
  ot_math_get_glyph_top_accent_attachment (font, glyph)
  ot_math_get_glyph_variants (font, glyph, direction, start_offset)
  ot_math_get_min_connector_overlap (font, direction)
  ot_math_has_data (face)
  ot_math_is_glyph_extended_shape (face, glyph)
  ot_meta_get_entry_tags (face, start_offset)
  ot_meta_reference_entry (face, meta_tag)
  ot_metrics_get_position (font, metrics_tag)
  ot_metrics_get_variation (font, metrics_tag)
  ot_metrics_get_x_variation (font, metrics_tag)
  ot_metrics_get_y_variation (font, metrics_tag)
  ot_name_get_utf16 (face, name_id, language)
  ot_name_get_utf32 (face, name_id, language)
  ot_name_get_utf8 (face, name_id, language)
  ot_name_list_names (face)
  ot_shape_glyphs_closure (font, buffer, features)
  ot_tag_from_language (language)
  ot_tag_to_language (tag)
  ot_tag_to_script (tag)
  ot_tags_from_script (script, script_tag_1, script_tag_2)
  ot_tags_from_script_and_language (script, language, script_count, language_count)
  ot_tags_to_script_and_language (script_tag, language_tag, script, language)
  ot_var_find_axis (face, axis_tag, axis_index)
  ot_var_find_axis_info (face, axis_tag)
  ot_var_get_axes (face, start_offset)
  ot_var_get_axis_count (face)
  ot_var_get_axis_infos (face, start_offset)
  ot_var_get_named_instance_count (face)
  ot_var_has_data (face)
  ot_var_named_instance_get_design_coords (face, instance_index)
  ot_var_named_instance_get_postscript_name_id (face, instance_index)
  ot_var_named_instance_get_subfamily_name_id (face, instance_index)
  ot_var_normalize_coords (face, coords_length, design_coords)
  ot_var_normalize_variations (face, variations, variations_length)
  script_from_iso15924_tag (tag)
  script_from_string (str)
  script_get_horizontal_direction (script)
  script_to_iso15924_tag (script)
  segment_properties_equal (a, b)
  segment_properties_hash (p)
  set_add (set, codepoint)
  set_add_range (set, first, last)
  set_allocation_successful (set)
  set_clear (set)
  set_create ()
  set_del (set, codepoint)
  set_del_range (set, first, last)
  set_get_empty ()
  set_get_max (set)
  set_get_min (set)
  set_get_population (set)
  set_has (set, codepoint)
  set_intersect (set, other)
  set_invert (set)
  set_is_empty (set)
  set_is_equal (set, other)
  set_is_subset (set, larger_set)
  set_next (set, codepoint)
  set_next_range (set, last)
  set_previous (set, codepoint)
  set_previous_range (set, first)
  set_set (set, other)
  set_subtract (set, other)
  set_symmetric_difference (set, other)
  set_union (set, other)
  shape (font, buffer, features)
  shape_full (font, buffer, features, shaper_list)
  shape_list_shapers ()
  shape_plan_create (face, props, user_features, shaper_list)
  shape_plan_create2 (face, props, user_features, coords, shaper_list)
  shape_plan_create_cached (face, props, user_features, shaper_list)
  shape_plan_create_cached2 (face, props, user_features, coords, shaper_list)
  shape_plan_execute (shape_plan, font, buffer, features)
  shape_plan_get_empty ()
  shape_plan_get_shaper (shape_plan)
  tag_from_string (str)
  tag_to_string (tag)
  unicode_combining_class (ufuncs, unicode)
  unicode_compose (ufuncs, a, b)
  unicode_decompose (ufuncs, ab)
  unicode_decompose_compatibility (ufuncs, u)
  unicode_eastasian_width (ufuncs, unicode)
  unicode_funcs_create (parent)
  unicode_funcs_get_default ()
  unicode_funcs_get_empty ()
  unicode_funcs_get_parent (ufuncs)
  unicode_funcs_is_immutable (ufuncs)
  unicode_funcs_make_immutable (ufuncs)
  unicode_funcs_set_combining_class_func (ufuncs, func, *user_data)
  unicode_funcs_set_compose_func (ufuncs, func, *user_data)
  unicode_funcs_set_decompose_compatibility_func (ufuncs, func, *user_data)
  unicode_funcs_set_decompose_func (ufuncs, func, *user_data)
  unicode_funcs_set_eastasian_width_func (ufuncs, func, *user_data)
  unicode_funcs_set_general_category_func (ufuncs, func, *user_data)
  unicode_funcs_set_mirroring_func (ufuncs, func, *user_data)
  unicode_funcs_set_script_func (ufuncs, func, *user_data)
  unicode_general_category (ufuncs, unicode)
  unicode_mirroring (ufuncs, unicode)
  unicode_script (ufuncs, unicode)
  variation_from_string (str, len, variation)
  variation_to_string (variation, buf, size)
  version ()
  version_atleast (major, minor, micro)
  version_string ()

Details

HarfBuzz.blob_copy_writable_or_fail(blob)
Parameters:blob (HarfBuzz.blob_t) – A blob.
Returns:The new blob, or nullptr if allocation failed
Return type:HarfBuzz.blob_t

Makes a writable copy of blob.

New in version 1.8.0.

HarfBuzz.blob_create_from_file(file_name)
Parameters:file_name (str) – A font filename
Returns:An HarfBuzz.blob_t pointer with the content of the file
Return type:HarfBuzz.blob_t

Creates a new blob containing the data from the specified binary font file.

New in version 1.7.7.

HarfBuzz.blob_create_sub_blob(parent, offset, length)
Parameters:
  • parent (HarfBuzz.blob_t) – Parent blob.
  • offset (int) – Start offset of sub-blob within parent, in bytes.
  • length (int) – Length of sub-blob.
Returns:

New blob, or the empty blob if something failed or if length is zero or offset is beyond the end of parent’s data. Destroy with hb_blob_destroy().

Return type:

HarfBuzz.blob_t

Returns a blob that represents a range of bytes in parent. The new blob is always created with HarfBuzz.memory_mode_t.READONLY, meaning that it will never modify data in the parent blob. The parent data is not expected to be modified, and will result in undefined behavior if it is.

Makes parent immutable.

New in version 0.9.2.

HarfBuzz.blob_get_data(blob)
Parameters:blob (HarfBuzz.blob_t) – a blob.
Returns:the byte data of blob.
Return type:[str]

Fetches the data from a blob.

New in version 0.9.2.

HarfBuzz.blob_get_data_writable(blob)
Parameters:blob (HarfBuzz.blob_t) – a blob.
Returns:Writable blob data, or None if failed.
Return type:[str]

Tries to make blob data writable (possibly copying it) and return pointer to data.

Fails if blob has been made immutable, or if memory allocation fails.

New in version 0.9.2.

HarfBuzz.blob_get_empty()
Returns:The empty blob.
Return type:HarfBuzz.blob_t

Returns the singleton empty blob.

See TODO:link object types for more information.

New in version 0.9.2.

HarfBuzz.blob_get_length(blob)
Parameters:blob (HarfBuzz.blob_t) – a blob.
Returns:the length of blob data in bytes.
Return type:int

Fetches the length of a blob’s data.

New in version 0.9.2.

HarfBuzz.blob_is_immutable(blob)
Parameters:blob (HarfBuzz.blob_t) – a blob.
Returns:%true if blob is immutable, false otherwise
Return type:int

Tests whether a blob is immutable.

New in version 0.9.2.

HarfBuzz.blob_make_immutable(blob)
Parameters:blob (HarfBuzz.blob_t) – a blob

Makes a blob immutable.

New in version 0.9.2.

HarfBuzz.buffer_add(buffer, codepoint, cluster)
Parameters:

Appends a character with the Unicode value of codepoint to buffer, and gives it the initial cluster value of cluster. Clusters can be any thing the client wants, they are usually used to refer to the index of the character in the input text stream and are output in HarfBuzz.glyph_info_t.cluster field.

This function does not check the validity of codepoint, it is up to the caller to ensure it is a valid Unicode code point.

New in version 0.9.7.

HarfBuzz.buffer_add_codepoints(buffer, text, item_offset, item_length)
Parameters:
  • buffer (HarfBuzz.buffer_t) – a HarfBuzz.buffer_t to append characters to.
  • text ([int]) – an array of Unicode code points to append.
  • item_offset (int) – the offset of the first code point to add to the buffer.
  • item_length (int) – the number of code points to add to the buffer, or -1 for the end of text (assuming it is None terminated).

Appends characters from text array to buffer. The item_offset is the position of the first character from text that will be appended, and item_length is the number of character. When shaping part of a larger text (e.g. a run of text from a paragraph), instead of passing just the substring corresponding to the run, it is preferable to pass the whole paragraph and specify the run start and length as item_offset and item_length, respectively, to give HarfBuzz the full context to be able, for example, to do cross-run Arabic shaping or properly handle combining marks at stat of run.

This function does not check the validity of text, it is up to the caller to ensure it contains a valid Unicode code points.

New in version 0.9.31.

HarfBuzz.buffer_add_latin1(buffer, text, item_offset, item_length)
Parameters:
  • buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
  • text (bytes) – an array of UTF-8 characters to append
  • item_offset (int) – the offset of the first character to add to the buffer
  • item_length (int) – the number of characters to add to the buffer, or -1 for the end of text (assuming it is None terminated)

Similar to HarfBuzz.buffer_add_codepoints(), but allows only access to first 256 Unicode code points that can fit in 8-bit strings.

Has nothing to do with non-Unicode Latin-1 encoding.

New in version 0.9.39.

HarfBuzz.buffer_add_utf16(buffer, text, item_offset, item_length)
Parameters:
  • buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
  • text ([int]) – An array of UTF-16 characters to append
  • item_offset (int) – The offset of the first character to add to the buffer
  • item_length (int) – The number of characters to add to the buffer, or -1 for the end of text (assuming it is None terminated)

See HarfBuzz.buffer_add_codepoints().

Replaces invalid UTF-16 characters with the buffer replacement code point, see HarfBuzz.buffer_set_replacement_codepoint().

New in version 0.9.2.

HarfBuzz.buffer_add_utf32(buffer, text, item_offset, item_length)
Parameters:
  • buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
  • text ([int]) – An array of UTF-32 characters to append
  • item_offset (int) – The offset of the first character to add to the buffer
  • item_length (int) – The number of characters to add to the buffer, or -1 for the end of text (assuming it is None terminated)

See HarfBuzz.buffer_add_codepoints().

Replaces invalid UTF-32 characters with the buffer replacement code point, see HarfBuzz.buffer_set_replacement_codepoint().

New in version 0.9.2.

HarfBuzz.buffer_add_utf8(buffer, text, item_offset, item_length)
Parameters:
  • buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
  • text (bytes) – An array of UTF-8 characters to append.
  • item_offset (int) – The offset of the first character to add to the buffer.
  • item_length (int) – The number of characters to add to the buffer, or -1 for the end of text (assuming it is None terminated).

See HarfBuzz.buffer_add_codepoints().

Replaces invalid UTF-8 characters with the buffer replacement code point, see HarfBuzz.buffer_set_replacement_codepoint().

New in version 0.9.2.

HarfBuzz.buffer_allocation_successful(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:%true if buffer memory allocation succeeded, %false otherwise.
Return type:int

Check if allocating memory for the buffer succeeded.

New in version 0.9.2.

HarfBuzz.buffer_append(buffer, source, start, end)
Parameters:

Append (part of) contents of another buffer to this buffer.

New in version 1.5.0.

HarfBuzz.buffer_clear_contents(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t

Similar to HarfBuzz.buffer_reset(), but does not clear the Unicode functions and the replacement code point.

New in version 0.9.11.

HarfBuzz.buffer_create()
Returns:A newly allocated HarfBuzz.buffer_t with a reference count of 1. The initial reference count should be released with hb_buffer_destroy() when you are done using the HarfBuzz.buffer_t. This function never returns None. If memory cannot be allocated, a special HarfBuzz.buffer_t object will be returned on which HarfBuzz.buffer_allocation_successful() returns %false.
Return type:HarfBuzz.buffer_t

Creates a new HarfBuzz.buffer_t with all properties to defaults.

New in version 0.9.2.

HarfBuzz.buffer_deserialize_glyphs(buffer, buf, font, format)
Parameters:
Return type:

(int, end_ptr: str)

New in version 0.9.7.

HarfBuzz.buffer_deserialize_unicode(buffer, buf, format)
Parameters:
Return type:

(int, end_ptr: str)

New in version 2.7.3.

HarfBuzz.buffer_diff(buffer, reference, dottedcircle_glyph, position_fuzz)
Parameters:
  • buffer (HarfBuzz.buffer_t) – a buffer.
  • reference (HarfBuzz.buffer_t) – other buffer to compare to.
  • dottedcircle_glyph (int) – glyph id of U+25CC DOTTED CIRCLE, or (hb_codepont_t) -1.
  • position_fuzz (int) – allowed absolute difference in position values.
Return type:

HarfBuzz.buffer_diff_flags_t

If dottedcircle_glyph is (hb_codepoint_t) -1 then HarfBuzz.buffer_diff_flags_t.DOTTED_CIRCLE_PRESENT and HarfBuzz.buffer_diff_flags_t.NOTDEF_PRESENT are never returned. This should be used by most callers if just comparing two buffers is needed.

New in version 1.5.0.

HarfBuzz.buffer_get_cluster_level(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The cluster level of buffer
Return type:HarfBuzz.buffer_cluster_level_t

Fetches the cluster level of a buffer. The HarfBuzz.buffer_cluster_level_t dictates one aspect of how HarfBuzz will treat non-base characters during shaping.

New in version 0.9.42.

HarfBuzz.buffer_get_content_type(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The type of buffer contents
Return type:HarfBuzz.buffer_content_type_t

Fetches the type of buffer contents. Buffers are either empty, contain characters (before shaping), or contain glyphs (the result of shaping).

New in version 0.9.5.

HarfBuzz.buffer_get_direction(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The direction of the buffer.
Return type:HarfBuzz.direction_t

See HarfBuzz.buffer_set_direction()

New in version 0.9.2.

HarfBuzz.buffer_get_empty()
Returns:The empty buffer
Return type:HarfBuzz.buffer_t

Fetches an empty HarfBuzz.buffer_t.

New in version 0.9.2.

HarfBuzz.buffer_get_flags(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The buffer flags
Return type:HarfBuzz.buffer_flags_t

Fetches the HarfBuzz.buffer_flags_t of buffer.

New in version 0.9.7.

HarfBuzz.buffer_get_glyph_infos(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The buffer glyph information array. The value valid as long as buffer has not been modified.
Return type:[HarfBuzz.glyph_info_t]

Returns buffer glyph information array. Returned pointer is valid as long as buffer contents are not modified.

New in version 0.9.2.

HarfBuzz.buffer_get_glyph_positions(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The buffer glyph position array. The value valid as long as buffer has not been modified.
Return type:[HarfBuzz.glyph_position_t]

Returns buffer glyph position array. Returned pointer is valid as long as buffer contents are not modified.

New in version 0.9.2.

HarfBuzz.buffer_get_invisible_glyph(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The buffer invisible #hb_codepoint_t
Return type:int

See HarfBuzz.buffer_set_invisible_glyph().

New in version 2.0.0.

HarfBuzz.buffer_get_language(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The HarfBuzz.language_t of the buffer. Must not be freed by the caller.
Return type:HarfBuzz.language_t

See HarfBuzz.buffer_set_language().

New in version 0.9.2.

HarfBuzz.buffer_get_length(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The buffer length. The value valid as long as buffer has not been modified.
Return type:int

Returns the number of items in the buffer.

New in version 0.9.2.

HarfBuzz.buffer_get_replacement_codepoint(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The buffer replacement #hb_codepoint_t
Return type:int

Fetches the #hb_codepoint_t that replaces invalid entries for a given encoding when adding text to buffer.

New in version 0.9.31.

HarfBuzz.buffer_get_script(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The HarfBuzz.script_t of the buffer
Return type:HarfBuzz.script_t

Fetches the script of buffer.

New in version 0.9.2.

HarfBuzz.buffer_get_segment_properties(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The output HarfBuzz.segment_properties_t
Return type:props: HarfBuzz.segment_properties_t

Sets props to the HarfBuzz.segment_properties_t of buffer.

New in version 0.9.7.

HarfBuzz.buffer_get_unicode_funcs(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t
Returns:The Unicode-functions structure
Return type:HarfBuzz.unicode_funcs_t

Fetches the Unicode-functions structure of a buffer.

New in version 0.9.2.

HarfBuzz.buffer_guess_segment_properties(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t

Sets unset buffer segment properties based on buffer Unicode contents. If buffer is not empty, it must have content type HarfBuzz.buffer_content_type_t.UNICODE.

If buffer script is not set (ie. is HarfBuzz.script_t.INVALID), it will be set to the Unicode script of the first character in the buffer that has a script other than HarfBuzz.script_t.COMMON, HarfBuzz.script_t.INHERITED, and HarfBuzz.script_t.UNKNOWN.

Next, if buffer direction is not set (ie. is HarfBuzz.direction_t.INVALID), it will be set to the natural horizontal direction of the buffer script as returned by HarfBuzz.script_get_horizontal_direction(). If HarfBuzz.script_get_horizontal_direction() returns HarfBuzz.direction_t.INVALID, then HarfBuzz.direction_t.LTR is used.

Finally, if buffer language is not set (ie. is HarfBuzz.LANGUAGE_INVALID), it will be set to the process’s default language as returned by HarfBuzz.language_get_default(). This may change in the future by taking buffer script into consideration when choosing a language. Note that HarfBuzz.language_get_default() is NOT threadsafe the first time it is called. See documentation for that function for details.

New in version 0.9.7.

HarfBuzz.buffer_has_positions(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – an HarfBuzz.buffer_t.
Returns:%true if the buffer has position array, %false otherwise.
Return type:int

Returns whether buffer has glyph position data. A buffer gains position data when HarfBuzz.buffer_get_glyph_positions() is called on it, and cleared of position data when HarfBuzz.buffer_clear_contents() is called.

New in version 2.7.3.

HarfBuzz.buffer_normalize_glyphs(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t

Reorders a glyph buffer to have canonical in-cluster glyph order / position. The resulting clusters should behave identical to pre-reordering clusters.

This has nothing to do with Unicode normalization.

New in version 0.9.2.

HarfBuzz.buffer_pre_allocate(buffer, size)
Parameters:
Returns:

%true if buffer memory allocation succeeded, %false otherwise

Return type:

int

Pre allocates memory for buffer to fit at least size number of items.

New in version 0.9.2.

HarfBuzz.buffer_reset(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t

Resets the buffer to its initial status, as if it was just newly created with HarfBuzz.buffer_create().

New in version 0.9.2.

HarfBuzz.buffer_reverse(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t

Reverses buffer contents.

New in version 0.9.2.

HarfBuzz.buffer_reverse_clusters(buffer)
Parameters:buffer (HarfBuzz.buffer_t) – An HarfBuzz.buffer_t

Reverses buffer clusters. That is, the buffer contents are reversed, then each cluster (consecutive items having the same cluster number) are reversed again.

New in version 0.9.2.

HarfBuzz.buffer_reverse_range(buffer, start, end)
Parameters:

Reverses buffer contents between start and end.

New in version 0.9.41.

HarfBuzz.buffer_serialize(buffer, start, end, font, format, flags)
Parameters:
Returns:

The number of serialized items.

buf:output string to write serialized buffer into.
buf_consumed:if not None, will be set to the number of byes written into buf.

Return type:

(int, buf: bytes, buf_consumed: int)

Serializes buffer into a textual representation of its content, whether Unicode codepoints or glyph identifiers and positioning information. This is useful for showing the contents of the buffer, for example during debugging. See the documentation of HarfBuzz.buffer_serialize_unicode() and HarfBuzz.buffer_serialize_glyphs() for a description of the output format.

New in version 2.7.3.

HarfBuzz.buffer_serialize_format_from_string(str)
Parameters:str (bytes) – a string to parse
Returns:The parsed HarfBuzz.buffer_serialize_format_t.
Return type:HarfBuzz.buffer_serialize_format_t

Parses a string into an HarfBuzz.buffer_serialize_format_t. Does not check if str is a valid buffer serialization format, use HarfBuzz.buffer_serialize_list_formats() to get the list of supported formats.

New in version 0.9.7.

HarfBuzz.buffer_serialize_format_to_string(format)
Parameters:format (HarfBuzz.buffer_serialize_format_t) – an HarfBuzz.buffer_serialize_format_t to convert.
Returns:A None terminated string corresponding to format. Should not be freed.
Return type:str

Converts format to the string corresponding it, or None if it is not a valid HarfBuzz.buffer_serialize_format_t.

New in version 0.9.7.

HarfBuzz.buffer_serialize_glyphs(buffer, start, end, font, format, flags)
Parameters:
Returns:

The number of serialized items.

buf:output string to write serialized buffer into.
buf_consumed:if not None, will be set to the number of byes written into buf.

Return type:

(int, buf: bytes, buf_consumed: int)

Serializes buffer into a textual representation of its glyph content, useful for showing the contents of the buffer, for example during debugging. There are currently two supported serialization formats:

text

A human-readable, plain text format. The serialized glyphs will look something like:

`` [uni0651=0@518,0+0|uni0628=0+1897] ``

json

A machine-readable, structured format. The serialized glyphs will look something like:

`` [{“g”:”uni0651”,”cl”:0,”dx”:518,”dy”:0,”ax”:0,”ay”:0}, {“g”:”uni0628”,”cl”:0,”dx”:0,”dy”:0,”ax”:1897,”ay”:0}] ``

Each glyph is a JSON object, with the following properties:

New in version 0.9.7.

HarfBuzz.buffer_serialize_list_formats()
Returns:A string array of buffer serialization formats. Should not be freed.
Return type:[str]

Returns a list of supported buffer serialization formats.

New in version 0.9.7.

HarfBuzz.buffer_serialize_unicode(buffer, start, end, format, flags)
Parameters:
Returns:

The number of serialized items.

buf:output string to write serialized buffer into.
buf_consumed:if not None, will be set to the number of byes written into buf.

Return type:

(int, buf: bytes, buf_consumed: int)

Serializes buffer into a textual representation of its content, when the buffer contains Unicode codepoints (i.e., before shaping). This is useful for showing the contents of the buffer, for example during debugging. There are currently two supported serialization formats:

text

A human-readable, plain text format. The serialized codepoints will look something like:

``  <U+0651=0|U+0628=1> ``

json

A machine-readable, structured format. The serialized codepoints will be a list of objects with the following properties:

For example:

`` [{u:1617,cl:0},{u:1576,cl:1}] ``

New in version 2.7.3.

HarfBuzz.buffer_set_cluster_level(buffer, cluster_level)
Parameters:

Sets the cluster level of a buffer. The HarfBuzz.buffer_cluster_level_t dictates one aspect of how HarfBuzz will treat non-base characters during shaping.

New in version 0.9.42.

HarfBuzz.buffer_set_content_type(buffer, content_type)
Parameters:

Sets the type of buffer contents. Buffers are either empty, contain characters (before shaping), or contain glyphs (the result of shaping).

New in version 0.9.5.

HarfBuzz.buffer_set_direction(buffer, direction)
Parameters:

Set the text flow direction of the buffer. No shaping can happen without setting buffer direction, and it controls the visual direction for the output glyphs; for RTL direction the glyphs will be reversed. Many layout features depend on the proper setting of the direction, for example, reversing RTL text before shaping, then shaping with LTR direction is not the same as keeping the text in logical order and shaping with RTL direction.

New in version 0.9.2.

HarfBuzz.buffer_set_flags(buffer, flags)
Parameters:

Sets buffer flags to flags. See HarfBuzz.buffer_flags_t.

New in version 0.9.7.

HarfBuzz.buffer_set_invisible_glyph(buffer, invisible)
Parameters:

Sets the #hb_codepoint_t 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.

New in version 2.0.0.

HarfBuzz.buffer_set_language(buffer, language)
Parameters:

Sets the language of buffer to language.

Languages are crucial for selecting which OpenType feature to apply to the buffer which can result in applying language-specific behaviour. Languages are orthogonal to the scripts, and though they are related, they are different concepts and should not be confused with each other.

Use HarfBuzz.language_from_string() to convert from BCP 47 language tags to HarfBuzz.language_t.

New in version 0.9.2.

HarfBuzz.buffer_set_length(buffer, length)
Parameters:
Returns:

%true if buffer memory allocation succeeded, %false otherwise.

Return type:

int

Similar to HarfBuzz.buffer_pre_allocate(), but clears any new items added at the end.

New in version 0.9.2.

HarfBuzz.buffer_set_message_func(buffer, func, *user_data)
Parameters:

New in version 1.1.3.

HarfBuzz.buffer_set_replacement_codepoint(buffer, replacement)
Parameters:

Sets the #hb_codepoint_t that replaces invalid entries for a given encoding when adding text to buffer.

Default is HarfBuzz.BUFFER_REPLACEMENT_CODEPOINT_DEFAULT.

New in version 0.9.31.

HarfBuzz.buffer_set_script(buffer, script)
Parameters:

Sets the script of buffer to script.

Script is crucial for choosing the proper shaping behaviour for scripts that require it (e.g. Arabic) and the which OpenType features defined in the font to be applied.

You can pass one of the predefined HarfBuzz.script_t values, or use HarfBuzz.script_from_string() or HarfBuzz.script_from_iso15924_tag() to get the corresponding script from an ISO 15924 script tag.

New in version 0.9.2.

HarfBuzz.buffer_set_segment_properties(buffer, props)
Parameters:

Sets the segment properties of the buffer, a shortcut for calling HarfBuzz.buffer_set_direction(), HarfBuzz.buffer_set_script() and HarfBuzz.buffer_set_language() individually.

New in version 0.9.7.

HarfBuzz.buffer_set_unicode_funcs(buffer, unicode_funcs)
Parameters:

Sets the Unicode-functions structure of a buffer to unicode_funcs.

New in version 0.9.2.

HarfBuzz.color_get_alpha(color)
Parameters:color (int) –
Returns:Alpha channel value of the given color
Return type:int

color: a #hb_color_t we are interested in its channels.

New in version 2.1.0.

HarfBuzz.color_get_blue(color)
Parameters:color (int) –
Returns:Blue channel value of the given color
Return type:int

color: a #hb_color_t we are interested in its channels.

New in version 2.1.0.

HarfBuzz.color_get_green(color)
Parameters:color (int) –
Returns:Green channel value of the given color
Return type:int

color: a #hb_color_t we are interested in its channels.

New in version 2.1.0.

HarfBuzz.color_get_red(color)
Parameters:color (int) –
Returns:Red channel value of the given color
Return type:int

color: a #hb_color_t we are interested in its channels.

New in version 2.1.0.

HarfBuzz.direction_from_string(str)
Parameters:str (bytes) – String to convert
Returns:The HarfBuzz.direction_t matching str
Return type:HarfBuzz.direction_t

Converts a string to an HarfBuzz.direction_t.

Matching is loose and applies only to the first letter. For examples, “LTR” and “left-to-right” will both return HarfBuzz.direction_t.LTR.

Unmatched strings will return HarfBuzz.direction_t.INVALID.

New in version 0.9.2.

HarfBuzz.direction_to_string(direction)
Parameters:direction (HarfBuzz.direction_t) – The HarfBuzz.direction_t to convert
Returns:The string corresponding to direction
Return type:str

Converts an HarfBuzz.direction_t to a string.

New in version 0.9.2.

HarfBuzz.face_builder_add_table(face, tag, blob)
Parameters:
Return type:

int

Add table for tag with data provided by blob to the face. face must be created using HarfBuzz.face_builder_create().

New in version 1.9.0.

HarfBuzz.face_builder_create()
Returns:New face.
Return type:HarfBuzz.face_t

Creates a HarfBuzz.face_t that can be used with HarfBuzz.face_builder_add_table(). After tables are added to the face, it can be compiled to a binary font file by calling HarfBuzz.face_reference_blob().

New in version 1.9.0.

HarfBuzz.face_collect_unicodes(face, out)
Parameters:

Collects all of the Unicode characters covered by face and adds them to the HarfBuzz.set_t set out.

New in version 1.9.0.

HarfBuzz.face_collect_variation_selectors(face, out)
Parameters:

Collects all Unicode “Variation Selector” characters covered by face and adds them to the HarfBuzz.set_t set out.

New in version 1.9.0.

HarfBuzz.face_collect_variation_unicodes(face, variation_selector, out)
Parameters:
  • face (HarfBuzz.face_t) – A face object
  • variation_selector (int) – The Variation Selector to query
  • out (HarfBuzz.set_t) – The set to add Unicode characters to

Collects all Unicode characters for variation_selector covered by face and adds them to the HarfBuzz.set_t set out.

New in version 1.9.0.

HarfBuzz.face_count(blob)
Parameters:blob (HarfBuzz.blob_t) – a blob.
Returns:Number of faces in blob
Return type:int

Fetches the number of faces in a blob.

New in version 1.7.7.

HarfBuzz.face_create(blob, index)
Parameters:
Returns:

The new face object

Return type:

HarfBuzz.face_t

Constructs a new face object from the specified blob and a face index into that blob. This is used for blobs of file formats such as Dfont and TTC that can contain more than one face.

New in version 0.9.2.

HarfBuzz.face_create_for_tables(reference_table_func, *user_data)
Parameters:
Returns:

The new face object

Return type:

HarfBuzz.face_t

Variant of HarfBuzz.face_create(), built for those cases where it is more convenient to provide data for individual tables instead of the whole font data. With the caveat that HarfBuzz.face_get_table_tags() does not currently work with faces created this way.

Creates a new face object from the specified user_data and reference_table_func, with the destroy callback.

New in version 0.9.2.

HarfBuzz.face_get_empty()
Returns:The empty face object
Return type:HarfBuzz.face_t

Fetches the singleton empty face object.

New in version 0.9.2.

HarfBuzz.face_get_glyph_count(face)
Parameters:face (HarfBuzz.face_t) – A face object
Returns:The glyph-count value of face
Return type:int

Fetches the glyph-count value of the specified face object.

New in version 0.9.7.

HarfBuzz.face_get_index(face)
Parameters:face (HarfBuzz.face_t) – A face object
Returns:The index of face.
Return type:int

Fetches the face-index corresponding to the given face.

Note: face indices within a collection are zero-based.

New in version 0.9.2.

HarfBuzz.face_get_table_tags(face, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – A face object
  • start_offset (int) – The index of first table tag to retrieve
Returns:

Total number of tables, or zero if it is not possible to list

table_tags:The array of table tags found

Return type:

(int, table_tags: [int])

Fetches a list of all table tags for a face, if possible. The list returned will begin at the offset provided

New in version 1.6.0.

HarfBuzz.face_get_upem(face)
Parameters:face (HarfBuzz.face_t) – A face object
Returns:The upem value of face
Return type:int

Fetches the units-per-em (upem) value of the specified face object.

New in version 0.9.2.

HarfBuzz.face_is_immutable(face)
Parameters:face (HarfBuzz.face_t) – A face object
Returns:True is face is immutable, false otherwise
Return type:int

Tests whether the given face object is immutable.

New in version 0.9.2.

HarfBuzz.face_make_immutable(face)
Parameters:face (HarfBuzz.face_t) – A face object

Makes the given face object immutable.

New in version 0.9.2.

HarfBuzz.face_reference_blob(face)
Parameters:face (HarfBuzz.face_t) – A face object
Returns:A pointer to the blob for face
Return type:HarfBuzz.blob_t

Fetches a pointer to the binary blob that contains the specified face. Returns an empty blob if referencing face data is not possible.

New in version 0.9.2.

HarfBuzz.face_reference_table(face, tag)
Parameters:
  • face (HarfBuzz.face_t) – A face object
  • tag (int) – The #hb_tag_t of the table to query
Returns:

A pointer to the tag table within face

Return type:

HarfBuzz.blob_t

Fetches a reference to the specified table within the specified face.

New in version 0.9.2.

HarfBuzz.face_set_glyph_count(face, glyph_count)
Parameters:
  • face (HarfBuzz.face_t) – A face object
  • glyph_count (int) – The glyph-count value to assign

Sets the glyph count for a face object to the specified value.

New in version 0.9.7.

HarfBuzz.face_set_index(face, index)
Parameters:

Assigns the specified face-index to face. Fails if the face is immutable.

Note: face indices within a collection are zero-based.

New in version 0.9.2.

HarfBuzz.face_set_upem(face, upem)
Parameters:
  • face (HarfBuzz.face_t) – A face object
  • upem (int) – The units-per-em value to assign

Sets the units-per-em (upem) for a face object to the specified value.

New in version 0.9.2.

HarfBuzz.feature_from_string(str)
Parameters:str (bytes) – a string to parse
Returns:%true if str is successfully parsed, %false otherwise
feature:the HarfBuzz.feature_t to initialize with the parsed values
Return type:(int, feature: HarfBuzz.feature_t)

Parses a string into a HarfBuzz.feature_t.

The format for specifying feature strings follows. All valid CSS font-feature-settings values other than ‘normal’ and the global values are also accepted, though not documented below. CSS string escapes are not supported.

The range indices refer to the positions between Unicode characters. The position before the first character is always 0.

The format is Python-esque. Here is how it all works:

Syntax Value Start End

Setting value: kern 1 0 ∞ Turn feature on +kern 1 0 ∞ Turn feature on -kern 0 0 ∞ Turn feature off kern=0 0 0 ∞ Turn feature off kern=1 1 0 ∞ Turn feature on aalt=2 2 0 ∞ Choose 2nd alternate Setting index: kern[] 1 0 ∞ Turn feature on kern[:] 1 0 ∞ Turn feature on kern[5:] 1 5 ∞ Turn feature on, partial kern[:5] 1 0 5 Turn feature on, partial kern[3:5] 1 3 5 Turn feature on, range kern[3] 1 3 3+1 Turn feature on, single str Mixing it all: aalt[3:5]=2 2 3 5 Turn 2nd alternate on for range

New in version 0.9.5.

HarfBuzz.feature_to_string(feature)
Parameters:feature (HarfBuzz.feature_t) – an HarfBuzz.feature_t to convert
Returns:output string
Return type:buf: [str]

Converts a HarfBuzz.feature_t into a None-terminated string in the format understood by HarfBuzz.feature_from_string(). The client in responsible for allocating big enough size for buf, 128 bytes is more than enough.

New in version 0.9.5.

HarfBuzz.font_add_glyph_origin_for_direction(font, glyph, direction, x, y)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
  • glyph (int) – The glyph ID to query
  • direction (HarfBuzz.direction_t) – The direction of the text segment
  • x (int) – Input = The original X coordinate Output = The X coordinate plus the X-coordinate of the origin
  • y (int) – Input = The original Y coordinate Output = The Y coordinate plus the Y-coordinate of the origin
Returns:

x:Input = The original X coordinate Output = The X coordinate plus the X-coordinate of the origin
y:Input = The original Y coordinate Output = The Y coordinate plus the Y-coordinate of the origin

Return type:

(x: int, y: int)

Adds the origin coordinates to an (X,Y) point coordinate, in the specified glyph ID in the specified font.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 0.9.2.

HarfBuzz.font_create(face)
Parameters:face (HarfBuzz.face_t) – a face.
Returns:The new font object
Return type:HarfBuzz.font_t

Constructs a new font object from the specified face.

New in version 0.9.2.

HarfBuzz.font_create_sub_font(parent)
Parameters:parent (HarfBuzz.font_t) – The parent font object
Returns:The new sub-font font object
Return type:HarfBuzz.font_t

Constructs a sub-font font object from the specified parent font, replicating the parent’s properties.

New in version 0.9.2.

HarfBuzz.font_funcs_create()
Returns:The font-functions structure
Return type:HarfBuzz.font_funcs_t

Creates a new HarfBuzz.font_funcs_t structure of font functions.

New in version 0.9.2.

HarfBuzz.font_funcs_get_empty()
Returns:The font-functions structure
Return type:HarfBuzz.font_funcs_t

Fetches an empty font-functions structure.

New in version 0.9.2.

HarfBuzz.font_funcs_is_immutable(ffuncs)
Parameters:ffuncs (HarfBuzz.font_funcs_t) – The font-functions structure
Returns:%true if ffuncs is immutable, false otherwise
Return type:int

Tests whether a font-functions structure is immutable.

New in version 0.9.2.

HarfBuzz.font_funcs_make_immutable(ffuncs)
Parameters:ffuncs (HarfBuzz.font_funcs_t) – The font-functions structure

Makes a font-functions structure immutable.

New in version 0.9.2.

HarfBuzz.font_funcs_set_font_h_extents_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for #hb_font_get_font_h_extents_func_t.

New in version 1.1.2.

HarfBuzz.font_funcs_set_font_v_extents_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for #hb_font_get_font_v_extents_func_t.

New in version 1.1.2.

HarfBuzz.font_funcs_set_glyph_contour_point_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.font_get_glyph_contour_point_func_t.

New in version 0.9.2.

HarfBuzz.font_funcs_set_glyph_extents_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.font_get_glyph_extents_func_t.

New in version 0.9.2.

HarfBuzz.font_funcs_set_glyph_from_name_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.font_get_glyph_from_name_func_t.

New in version 0.9.2.

HarfBuzz.font_funcs_set_glyph_func(ffuncs, func, *user_data)
Parameters:

Deprecated. Use HarfBuzz.font_funcs_set_nominal_glyph_func() and HarfBuzz.font_funcs_set_variation_glyph_func() instead.

New in version 0.9.2.

Deprecated since version 1.2.3.

HarfBuzz.font_funcs_set_glyph_h_advance_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for #hb_font_get_glyph_h_advance_func_t.

New in version 0.9.2.

HarfBuzz.font_funcs_set_glyph_h_advances_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for #hb_font_get_glyph_h_advances_func_t.

New in version 1.8.6.

HarfBuzz.font_funcs_set_glyph_h_kerning_func(ffuncs, func, *user_data)
Parameters:

New in version 0.9.2.

HarfBuzz.font_funcs_set_glyph_h_origin_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for #hb_font_get_glyph_h_origin_func_t.

New in version 0.9.2.

HarfBuzz.font_funcs_set_glyph_name_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.font_get_glyph_name_func_t.

New in version 0.9.2.

HarfBuzz.font_funcs_set_glyph_v_advance_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for #hb_font_get_glyph_v_advance_func_t.

New in version 0.9.2.

HarfBuzz.font_funcs_set_glyph_v_advances_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for #hb_font_get_glyph_v_advances_func_t.

New in version 1.8.6.

HarfBuzz.font_funcs_set_glyph_v_kerning_func(ffuncs, func, *user_data)
Parameters:

New in version 0.9.2.

Deprecated since version 2.0.0.

HarfBuzz.font_funcs_set_glyph_v_origin_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for #hb_font_get_glyph_v_origin_func_t.

New in version 0.9.2.

HarfBuzz.font_funcs_set_nominal_glyph_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.font_get_nominal_glyph_func_t.

New in version 1.2.3.

HarfBuzz.font_funcs_set_nominal_glyphs_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.font_get_nominal_glyphs_func_t.

New in version 2.0.0.

HarfBuzz.font_funcs_set_variation_glyph_func(ffuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.font_get_variation_glyph_func_t.

New in version 1.2.3.

HarfBuzz.font_get_empty()
Returns:The empty font object
Return type:HarfBuzz.font_t

Fetches the empty font object.

New in version 0.9.2.

HarfBuzz.font_get_extents_for_direction(font, direction)
Parameters:
Returns:

The HarfBuzz.glyph_extents_t retrieved

Return type:

extents: HarfBuzz.font_extents_t

Fetches the extents for a font in a text segment of the specified direction.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 1.1.3.

HarfBuzz.font_get_face(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:The HarfBuzz.face_t value
Return type:HarfBuzz.face_t

Fetches the face associated with the specified font object.

New in version 0.9.2.

HarfBuzz.font_get_glyph(font, unicode, variation_selector)
Parameters:
Returns:

%true if data found, false otherwise

glyph:The glyph ID retrieved

Return type:

(int, glyph: int)

Fetches the glyph ID for a Unicode code point in the specified font, with an optional variation selector.

If variation_selector is 0, calls HarfBuzz.font_get_nominal_glyph(); otherwise calls HarfBuzz.font_get_variation_glyph().

New in version 0.9.2.

HarfBuzz.font_get_glyph_advance_for_direction(font, glyph, direction)
Parameters:
Returns:

x:The horizontal advance retrieved
y:The vertical advance retrieved

Return type:

(x: int, y: int)

Fetches the advance for a glyph ID from the specified font, in a text segment of the specified direction.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 0.9.2.

HarfBuzz.font_get_glyph_advances_for_direction(font, direction, count, first_glyph, glyph_stride)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
  • direction (HarfBuzz.direction_t) – The direction of the text segment
  • count (int) – The number of glyph IDs in the sequence queried
  • first_glyph (int) – The first glyph ID to query
  • glyph_stride (int) – The stride between successive glyph IDs
Returns:

first_advance:The first advance retrieved
advance_stride:The stride between successive advances

Return type:

(first_advance: int, advance_stride: int)

Fetches the advances for a sequence of glyph IDs in the specified font, in a text segment of the specified direction.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 1.8.6.

HarfBuzz.font_get_glyph_contour_point(font, glyph, point_index)
Parameters:
Returns:

%true if data found, false otherwise

x:The X value retrieved for the contour point
y:The Y value retrieved for the contour point

Return type:

(int, x: int, y: int)

Fetches the (x,y) coordinates of a specified contour-point index in the specified glyph, within the specified font.

New in version 0.9.2.

HarfBuzz.font_get_glyph_contour_point_for_origin(font, glyph, point_index, direction)
Parameters:
Returns:

%true if data found, false otherwise

x:The X value retrieved for the contour point
y:The Y value retrieved for the contour point

Return type:

(int, x: int, y: int)

Fetches the (X,Y) coordinates of a specified contour-point index in the specified glyph ID in the specified font, with respect to the origin in a text segment in the specified direction.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 0.9.2.

HarfBuzz.font_get_glyph_extents(font, glyph)
Parameters:
Returns:

%true if data found, false otherwise

extents:The HarfBuzz.glyph_extents_t retrieved

Return type:

(int, extents: HarfBuzz.glyph_extents_t)

Fetches the HarfBuzz.glyph_extents_t data for a glyph ID in the specified font.

New in version 0.9.2.

HarfBuzz.font_get_glyph_extents_for_origin(font, glyph, direction)
Parameters:
Returns:

%true if data found, false otherwise

extents:The HarfBuzz.glyph_extents_t retrieved

Return type:

(int, extents: HarfBuzz.glyph_extents_t)

Fetches the HarfBuzz.glyph_extents_t data for a glyph ID in the specified font, with respect to the origin in a text segment in the specified direction.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 0.9.2.

HarfBuzz.font_get_glyph_from_name(font, name)
Parameters:
Returns:

%true if data found, false otherwise

glyph:The glyph ID retrieved

Return type:

(int, glyph: int)

Fetches the glyph ID that corresponds to a name string in the specified font.

Note: len == -1 means the name string is null-terminated.

New in version 0.9.2.

HarfBuzz.font_get_glyph_h_advance(font, glyph)
Parameters:
Returns:

The advance of glyph within font

Return type:

int

Fetches the advance for a glyph ID in the specified font, for horizontal text segments.

New in version 0.9.2.

HarfBuzz.font_get_glyph_h_advances(font, count, first_glyph, glyph_stride)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
  • count (int) – The number of glyph IDs in the sequence queried
  • first_glyph (int) – The first glyph ID to query
  • glyph_stride (int) – The stride between successive glyph IDs
Returns:

first_advance:The first advance retrieved
advance_stride:The stride between successive advances

Return type:

(first_advance: int, advance_stride: int)

Fetches the advances for a sequence of glyph IDs in the specified font, for horizontal text segments.

New in version 1.8.6.

HarfBuzz.font_get_glyph_h_kerning(font, left_glyph, right_glyph)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
  • left_glyph (int) – The glyph ID of the left glyph in the glyph pair
  • right_glyph (int) – The glyph ID of the right glyph in the glyph pair
Returns:

The kerning adjustment value

Return type:

int

Fetches the kerning-adjustment value for a glyph-pair in the specified font, in horizontal text segments.

It handles legacy kerning only (as returned by the corresponding HarfBuzz.font_funcs_t function).

New in version 0.9.2.

HarfBuzz.font_get_glyph_h_origin(font, glyph)
Parameters:
Returns:

%true if data found, false otherwise

x:The X coordinate of the origin
y:The Y coordinate of the origin

Return type:

(int, x: int, y: int)

Fetches the (X,Y) coordinates of the origin for a glyph ID in the specified font, for horizontal text segments.

New in version 0.9.2.

HarfBuzz.font_get_glyph_kerning_for_direction(font, first_glyph, second_glyph, direction)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
  • first_glyph (int) – The glyph ID of the first glyph in the glyph pair to query
  • second_glyph (int) – The glyph ID of the second glyph in the glyph pair to query
  • direction (HarfBuzz.direction_t) – The direction of the text segment
Returns:

x:The horizontal kerning-adjustment value retrieved
y:The vertical kerning-adjustment value retrieved

Return type:

(x: int, y: int)

Fetches the kerning-adjustment value for a glyph-pair in the specified font.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 0.9.2.

HarfBuzz.font_get_glyph_name(font, glyph)
Parameters:
Returns:

%true if data found, zero otherwise

name:Name string retrieved for the glyph ID

Return type:

(int, name: [str])

Fetches the glyph-name string for a glyph ID in the specified font.

New in version 0.9.2.

HarfBuzz.font_get_glyph_origin_for_direction(font, glyph, direction)
Parameters:
Returns:

x:The X coordinate retrieved for the origin
y:The Y coordinate retrieved for the origin

Return type:

(x: int, y: int)

Fetches the (X,Y) coordinates of the origin for a glyph in the specified font.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 0.9.2.

HarfBuzz.font_get_glyph_v_advance(font, glyph)
Parameters:
Returns:

The advance of glyph within font

Return type:

int

Fetches the advance for a glyph ID in the specified font, for vertical text segments.

New in version 0.9.2.

HarfBuzz.font_get_glyph_v_advances(font, count, first_glyph, glyph_stride)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
  • count (int) – The number of glyph IDs in the sequence queried
  • first_glyph (int) – The first glyph ID to query
  • glyph_stride (int) – The stride between successive glyph IDs
Returns:

first_advance:The first advance retrieved
advance_stride:The stride between successive advances

Return type:

(first_advance: int, advance_stride: int)

Fetches the advances for a sequence of glyph IDs in the specified font, for vertical text segments.

New in version 1.8.6.

HarfBuzz.font_get_glyph_v_kerning(font, top_glyph, bottom_glyph)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
  • top_glyph (int) – The glyph ID of the top glyph in the glyph pair
  • bottom_glyph (int) – The glyph ID of the bottom glyph in the glyph pair
Returns:

The kerning adjustment value

Return type:

int

Fetches the kerning-adjustment value for a glyph-pair in the specified font, in vertical text segments.

It handles legacy kerning only (as returned by the corresponding HarfBuzz.font_funcs_t function).

New in version 0.9.2.

Deprecated since version 2.0.0.

HarfBuzz.font_get_glyph_v_origin(font, glyph)
Parameters:
Returns:

%true if data found, false otherwise

x:The X coordinate of the origin
y:The Y coordinate of the origin

Return type:

(int, x: int, y: int)

Fetches the (X,Y) coordinates of the origin for a glyph ID in the specified font, for vertical text segments.

New in version 0.9.2.

HarfBuzz.font_get_h_extents(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:%true if data found, false otherwise
extents:The font extents retrieved
Return type:(int, extents: HarfBuzz.font_extents_t)

Fetches the extents for a specified font, in horizontal text segments.

New in version 1.1.3.

HarfBuzz.font_get_nominal_glyph(font, unicode)
Parameters:
Returns:

%true if data found, false otherwise

glyph:The glyph ID retrieved

Return type:

(int, glyph: int)

Fetches the nominal glyph ID for a Unicode code point in the specified font.

This version of the function should not be used to fetch glyph IDs for code points modified by variation selectors. For variation-selector support, user HarfBuzz.font_get_variation_glyph() or use HarfBuzz.font_get_glyph().

New in version 1.2.3.

HarfBuzz.font_get_nominal_glyphs(font, count, first_unicode, unicode_stride, first_glyph, glyph_stride)
Parameters:
Return type:

int

New in version 2.6.3.

HarfBuzz.font_get_parent(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:The parent font object
Return type:HarfBuzz.font_t

Fetches the parent font of font.

New in version 0.9.2.

HarfBuzz.font_get_ppem(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:
x_ppem:Horizontal ppem value
y_ppem:Vertical ppem value
Return type:(x_ppem: int, y_ppem: int)

Fetches the horizontal and vertical points-per-em (ppem) of a font.

New in version 0.9.2.

HarfBuzz.font_get_ptem(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:Point size. A value of zero means “not set.”
Return type:float

Fetches the “point size” of a font. Used in CoreText to implement optical sizing.

New in version 0.9.2.

HarfBuzz.font_get_scale(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:
x_scale:Horizontal scale value
y_scale:Vertical scale value
Return type:(x_scale: int, y_scale: int)

Fetches the horizontal and vertical scale of a font.

New in version 0.9.2.

HarfBuzz.font_get_v_extents(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:%true if data found, false otherwise
extents:The font extents retrieved
Return type:(int, extents: HarfBuzz.font_extents_t)

Fetches the extents for a specified font, in vertical text segments.

New in version 1.1.3.

HarfBuzz.font_get_var_coords_normalized(font, length)
Parameters:
Return type:

int

Fetches the list of normalized variation coordinates currently set on a font.

Return value is valid as long as variation coordinates of the font are not modified.

New in version 1.4.2.

HarfBuzz.font_get_variation_glyph(font, unicode, variation_selector)
Parameters:
Returns:

%true if data found, false otherwise

glyph:The glyph ID retrieved

Return type:

(int, glyph: int)

Fetches the glyph ID for a Unicode code point when followed by by the specified variation-selector code point, in the specified font.

New in version 1.2.3.

HarfBuzz.font_glyph_from_string(font, s)
Parameters:
Returns:

%true if data found, false otherwise

glyph:The glyph ID corresponding to the string requested

Return type:

(int, glyph: int)

Fetches the glyph ID from font that matches the specified string. Strings of the format gidDDD or uniUUUU are parsed automatically.

Note: len == -1 means the string is null-terminated.

New in version 0.9.2.

HarfBuzz.font_glyph_to_string(font, glyph)
Parameters:
Returns:

The string containing the glyph name

Return type:

s: [str]

Fetches the name of the specified glyph ID in font and returns it in string s.

If the glyph ID has no name in font, a string of the form gidDDD is generated, with DDD being the glyph ID.

New in version 0.9.2.

HarfBuzz.font_is_immutable(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:%true if font is immutable, false otherwise
Return type:int

Tests whether a font object is immutable.

New in version 0.9.2.

HarfBuzz.font_make_immutable(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon

Makes font immutable.

New in version 0.9.2.

HarfBuzz.font_set_face(font, face)
Parameters:

Sets face as the font-face value of font.

New in version 1.4.3.

HarfBuzz.font_set_funcs(font, klass, font_data, destroy)
Parameters:

Replaces the font-functions structure attached to a font, updating the font’s user-data with font-data and the destroy callback.

New in version 0.9.2.

HarfBuzz.font_set_funcs_data(font, font_data, destroy)
Parameters:

Replaces the user data attached to a font, updating the font’s destroy callback.

New in version 0.9.2.

HarfBuzz.font_set_parent(font, parent)
Parameters:

Sets the parent font of font.

New in version 1.0.5.

HarfBuzz.font_set_ppem(font, x_ppem, y_ppem)
Parameters:

Sets the horizontal and vertical pixels-per-em (ppem) of a font.

New in version 0.9.2.

HarfBuzz.font_set_ptem(font, ptem)
Parameters:

Sets the “point size” of a font. Set to zero to unset. Used in CoreText to implement optical sizing.

Note: There are 72 points in an inch.

New in version 1.6.0.

HarfBuzz.font_set_scale(font, x_scale, y_scale)
Parameters:

Sets the horizontal and vertical scale of a font.

New in version 0.9.2.

HarfBuzz.font_set_var_coords_design(font, coords)
Parameters:

Applies a list of variation coordinates (in design-space units) to a font.

New in version 1.4.2.

HarfBuzz.font_set_var_coords_normalized(font, coords)
Parameters:

Applies a list of variation coordinates (in normalized units) to a font.

Note: Coordinates should be normalized to 2.14.

New in version 1.4.2.

HarfBuzz.font_set_var_named_instance(font, instance_index)
Parameters:

Sets design coords of a font from a named instance index.

New in version 2.6.0.

HarfBuzz.font_set_variations(font, variations)
Parameters:

Applies a list of font-variation settings to a font.

New in version 1.4.2.

HarfBuzz.font_subtract_glyph_origin_for_direction(font, glyph, direction, x, y)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
  • glyph (int) – The glyph ID to query
  • direction (HarfBuzz.direction_t) – The direction of the text segment
  • x (int) – Input = The original X coordinate Output = The X coordinate minus the X-coordinate of the origin
  • y (int) – Input = The original Y coordinate Output = The Y coordinate minus the Y-coordinate of the origin
Returns:

x:Input = The original X coordinate Output = The X coordinate minus the X-coordinate of the origin
y:Input = The original Y coordinate Output = The Y coordinate minus the Y-coordinate of the origin

Return type:

(x: int, y: int)

Subtracts the origin coordinates from an (X,Y) point coordinate, in the specified glyph ID in the specified font.

Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.

New in version 0.9.2.

HarfBuzz.ft_font_changed(font)
Parameters:font (HarfBuzz.font_t) –
HarfBuzz.ft_font_get_load_flags(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon
Returns:FT_Load_Glyph flags found
Return type:int

Fetches the FT_Load_Glyph load flags of the specified HarfBuzz.font_t.

For more information, see https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_load_xxx

New in version 1.0.5.

HarfBuzz.ft_font_set_funcs(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon

Configures the font-functions structure of the specified HarfBuzz.font_t font object to use FreeType font functions.

In particular, you can use this function to configure an existing HarfBuzz.face_t face object for use with FreeType font functions even if that HarfBuzz.face_t face object was initially created with HarfBuzz.face_create(), and therefore was not initially configured to use FreeType font functions.

An HarfBuzz.face_t face object created with hb_ft_face_create() is preconfigured for FreeType font functions and does not require this function to be used.

Note: Internally, this function creates an FT_Face.

New in version 1.0.5.

HarfBuzz.ft_font_set_load_flags(font, load_flags)
Parameters:

Sets the FT_Load_Glyph load flags for the specified HarfBuzz.font_t.

For more information, see https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_load_xxx

New in version 1.0.5.

HarfBuzz.ft_font_unlock_face(font)
Parameters:font (HarfBuzz.font_t) –

New in version 2.6.5.

HarfBuzz.glib_blob_create(gbytes)
Parameters:gbytes (GLib.Bytes) – the GLib.Bytes structure to work upon
Returns:the new HarfBuzz.blob_t blob object
Return type:HarfBuzz.blob_t

Creates an HarfBuzz.blob_t blob from the specified GLib.Bytes data structure.

New in version 0.9.38.

HarfBuzz.glib_get_unicode_funcs()
Returns:a pointer to the HarfBuzz.unicode_funcs_t Unicode-functions structure
Return type:HarfBuzz.unicode_funcs_t

Fetches a Unicode-functions structure that is populated with the appropriate GLib function for each method.

New in version 0.9.38.

HarfBuzz.glib_script_from_script(script)
Parameters:script (HarfBuzz.script_t) – The HarfBuzz.script_t to query
Returns:the GLib.UnicodeScript identifier found
Return type:GLib.UnicodeScript

Fetches the GLib.UnicodeScript identifier that corresponds to the specified HarfBuzz.script_t script.

New in version 0.9.38.

HarfBuzz.glib_script_to_script(script)
Parameters:script (GLib.UnicodeScript) – The GLib.UnicodeScript identifier to query
Returns:the HarfBuzz.script_t script found
Return type:HarfBuzz.script_t

Fetches the HarfBuzz.script_t script that corresponds to the specified GLib.UnicodeScript identifier.

New in version 0.9.38.

HarfBuzz.glyph_info_get_glyph_flags(info)
Parameters:info (HarfBuzz.glyph_info_t) – a HarfBuzz.glyph_info_t
Returns:The HarfBuzz.glyph_flags_t encoded within info
Return type:HarfBuzz.glyph_flags_t

Returns glyph flags encoded within a HarfBuzz.glyph_info_t.

New in version 1.5.0.

HarfBuzz.language_from_string(str)
Parameters:str (bytes) – a string representing a BCP 47 language tag
Returns:The HarfBuzz.language_t corresponding to the BCP 47 language tag.
Return type:HarfBuzz.language_t

Converts str representing a BCP 47 language tag to the corresponding HarfBuzz.language_t.

New in version 0.9.2.

HarfBuzz.language_get_default()
Returns:The default language of the locale as an HarfBuzz.language_t
Return type:HarfBuzz.language_t

Fetch the default language from current locale.

Note that the first time this function is called, it calls “setlocale (LC_CTYPE, nullptr)” to fetch current locale. The underlying setlocale function is, in many implementations, NOT threadsafe. To avoid problems, call this function once before multiple threads can call it. This function is only used from HarfBuzz.buffer_guess_segment_properties() by HarfBuzz itself.

New in version 0.9.2.

HarfBuzz.language_to_string(language)
Parameters:language (HarfBuzz.language_t) – The HarfBuzz.language_t to convert
Returns:A None-terminated string representing the language. Must not be freed by the caller.
Return type:str

Converts an HarfBuzz.language_t to a string.

New in version 0.9.2.

HarfBuzz.map_allocation_successful(map)
Parameters:map (HarfBuzz.map_t) – A map
Returns:%true if allocation succeeded, false otherwise
Return type:int

Tests whether memory allocation for a set was successful.

New in version 1.7.7.

HarfBuzz.map_clear(map)
Parameters:map (HarfBuzz.map_t) – A map

Clears out the contents of map.

New in version 1.7.7.

HarfBuzz.map_create()
Returns:The new HarfBuzz.map_t
Return type:HarfBuzz.map_t

Creates a new, initially empty map.

New in version 1.7.7.

HarfBuzz.map_del(map, key)
Parameters:

Removes key and its stored value from map.

New in version 1.7.7.

HarfBuzz.map_get(map, key)
Parameters:
Return type:

int

Fetches the value stored for key in map.

New in version 1.7.7.

HarfBuzz.map_get_empty()
Returns:The empty HarfBuzz.map_t
Return type:HarfBuzz.map_t

Fetches the singleton empty HarfBuzz.map_t.

New in version 1.7.7.

HarfBuzz.map_get_population(map)
Parameters:map (HarfBuzz.map_t) – A map
Returns:The population of map
Return type:int

Returns the number of key-value pairs in the map.

New in version 1.7.7.

HarfBuzz.map_has(map, key)
Parameters:
Returns:

%true if key is found in map, false otherwise

Return type:

int

Tests whether key is an element of map.

New in version 1.7.7.

HarfBuzz.map_is_empty(map)
Parameters:map (HarfBuzz.map_t) – A map
Returns:%true if map is empty
Return type:int

Tests whether map is empty (contains no elements).

New in version 1.7.7.

HarfBuzz.map_set(map, key, value)
Parameters:
  • map (HarfBuzz.map_t) – A map
  • key (int) – The key to store in the map
  • value (int) – The value to store for key

Stores key:value in the map.

New in version 1.7.7.

HarfBuzz.ot_color_glyph_get_layers(face, glyph, start_offset)
Parameters:
Returns:

Total number of layers available for the glyph index queried

layers:The array of layers found

Return type:

(int, layers: [HarfBuzz.ot_color_layer_t])

Fetches a list of all color layers for the specified glyph index in the specified face. The list returned will begin at the offset provided.

New in version 2.1.0.

HarfBuzz.ot_color_glyph_reference_png(font, glyph)
Parameters:
Returns:

An HarfBuzz.blob_t containing the PNG image for the glyph, if available

Return type:

HarfBuzz.blob_t

Fetches the PNG image for a glyph. This function takes a font object, not a face object, as input. To get an optimally sized PNG blob, the UPEM value must be set on the font object. If UPEM is unset, the blob returned will be the largest PNG available.

New in version 2.1.0.

HarfBuzz.ot_color_glyph_reference_svg(face, glyph)
Parameters:
Returns:

An HarfBuzz.blob_t containing the SVG document of the glyph, if available

Return type:

HarfBuzz.blob_t

Fetches the SVG document for a glyph. The blob may be either plain text or gzip-encoded.

New in version 2.1.0.

HarfBuzz.ot_color_has_layers(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
Returns:true if data found, false otherwise
Return type:int

Tests whether a face includes any COLR color layers.

New in version 2.1.0.

HarfBuzz.ot_color_has_palettes(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
Returns:true if data found, false otherwise
Return type:int

Tests whether a face includes a CPAL color-palette table.

New in version 2.1.0.

HarfBuzz.ot_color_has_png(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
Returns:true if data found, false otherwise
Return type:int

Tests whether a face has PNG glyph images (either in CBDT or sbix tables).

New in version 2.1.0.

HarfBuzz.ot_color_has_svg(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon.
Returns:true if data found, false otherwise.
Return type:int

Tests whether a face includes any SVG glyph images.

New in version 2.1.0.

HarfBuzz.ot_color_palette_color_get_name_id(face, color_index)
Parameters:
Returns:

the Name ID found for the color.

Return type:

int

Fetches the name table Name ID that provides display names for the specificed color in a face’s CPAL color palette.

Display names can be generic (e.g., “Background”) or specific (e.g., “Eye color”).

New in version 2.1.0.

HarfBuzz.ot_color_palette_get_colors(face, palette_index, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • palette_index (int) – the index of the color palette to query
  • start_offset (int) – offset of the first color to retrieve
Returns:

the total number of colors in the palette

colors:The array of #hb_color_t records found

Return type:

(int, colors: [int])

Fetches a list of the colors in a color palette.

After calling this function, colors will be filled with the palette colors. If colors is None, the function will just return the number of total colors without storing any actual colors; this can be used for allocating a buffer of suitable size before calling HarfBuzz.ot_color_palette_get_colors() a second time.

New in version 2.1.0.

HarfBuzz.ot_color_palette_get_count(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
Returns:the number of palettes found
Return type:int

Fetches the number of color palettes in a face.

New in version 2.1.0.

HarfBuzz.ot_color_palette_get_flags(face, palette_index)
Parameters:
Returns:

the HarfBuzz.ot_color_palette_flags_t of the requested color palette

Return type:

HarfBuzz.ot_color_palette_flags_t

Fetches the flags defined for a color palette.

New in version 2.1.0.

HarfBuzz.ot_color_palette_get_name_id(face, palette_index)
Parameters:
Returns:

the Named ID found for the palette. If the requested palette has no name the result is #HB_OT_NAME_ID_INVALID.

Return type:

int

Fetches the name table Name ID that provides display names for a CPAL color palette.

Palette display names can be generic (e.g., “Default”) or provide specific, themed names (e.g., “Spring”, “Summer”, “Fall”, and “Winter”).

New in version 2.1.0.

HarfBuzz.ot_font_set_funcs(font)
Parameters:font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon

Sets the font functions to use when working with font.

New in version 0.9.28.

HarfBuzz.ot_layout_collect_features(face, table_tag, scripts, languages, features)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • scripts (int) – The array of scripts to collect features for
  • languages (int) – The array of languages to collect features for
  • features (int) – The array of features to collect
Returns:

The array of feature indexes found for the query

Return type:

feature_indexes: HarfBuzz.set_t

Fetches a list of all feature indexes in the specified face’s GSUB table or GPOS table, underneath the specified scripts, languages, and features. If no list of scripts is provided, all scripts will be queried. If no list of languages is provided, all languages will be queried. If no list of features is provided, all features will be queried.

New in version 1.8.5.

HarfBuzz.ot_layout_collect_lookups(face, table_tag, scripts, languages, features)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • scripts (int) – The array of scripts to collect lookups for
  • languages (int) – The array of languages to collect lookups for
  • features (int) – The array of features to collect lookups for
Returns:

The array of lookup indexes found for the query

Return type:

lookup_indexes: HarfBuzz.set_t

Fetches a list of all feature-lookup indexes in the specified face’s GSUB table or GPOS table, underneath the specified scripts, languages, and features. If no list of scripts is provided, all scripts will be queried. If no list of languages is provided, all languages will be queried. If no list of features is provided, all features will be queried.

New in version 0.9.8.

HarfBuzz.ot_layout_feature_get_characters(face, table_tag, feature_index, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – table tag to query, “GSUB” or “GPOS”.
  • feature_index (int) – index of feature to query.
  • start_offset (int) – offset of the first character to retrieve
Returns:

Number of total sample characters in the cvXX feature.

characters:A buffer pointer. The Unicode codepoints of the characters for which this feature provides glyph variants.

Return type:

(int, characters: [int])

Fetches a list of the characters defined as having a variant under the specified “Character Variant” (“cvXX”) feature tag.

New in version 2.0.0.

HarfBuzz.ot_layout_feature_get_lookups(face, table_tag, feature_index, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • feature_index (int) – The index of the requested feature
  • start_offset (int) – offset of the first lookup to retrieve
Returns:

lookup_indexes:The array of lookup indexes found for the query

Return type:

(int, lookup_indexes: [int])

Fetches a list of all lookups enumerated for the specified feature, in the specified face’s GSUB table or GPOS table. The list returned will begin at the offset provided.

New in version 0.9.7.

HarfBuzz.ot_layout_feature_get_name_ids(face, table_tag, feature_index)
Parameters:
Returns:

%true if data found, false otherwise

label_id:The ‘name’ table name ID that specifies a string for a user-interface label for this feature. (May be None.)
tooltip_id:The ‘name’ table name ID that specifies a string that an application can use for tooltip text for this feature. (May be None.)
sample_id:The ‘name’ table name ID that specifies sample text that illustrates the effect of this feature. (May be None.)
num_named_parameters:
 Number of named parameters. (May be zero.)
first_param_id:The first ‘name’ table name ID used to specify strings for user-interface labels for the feature parameters. (Must be zero if numParameters is zero.)

Return type:

(int, label_id: int, tooltip_id: int, sample_id: int, num_named_parameters: int, first_param_id: int)

Fetches name indices from feature parameters for “Stylistic Set” (‘ssXX’) or “Character Variant” (‘cvXX’) features.

New in version 2.0.0.

HarfBuzz.ot_layout_feature_with_variations_get_lookups(face, table_tag, feature_index, variations_index, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • feature_index (int) – The index of the feature to query
  • variations_index (int) – The index of the feature variation to query
  • start_offset (int) – offset of the first lookup to retrieve
Returns:

lookup_indexes:The array of lookups found for the query

Return type:

(int, lookup_indexes: [int])

Fetches a list of all lookups enumerated for the specified feature, in the specified face’s GSUB table or GPOS table, enabled at the specified variations index. The list returned will begin at the offset provided.

HarfBuzz.ot_layout_get_attach_points(face, glyph, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – The HarfBuzz.face_t to work on
  • glyph (int) – The #hb_codepoint_t code point to query
  • start_offset (int) – offset of the first attachment point to retrieve
Returns:

point_array:The array of attachment points found for the query

Return type:

(int, point_array: [int])

Fetches a list of all attachment points for the specified glyph in the GDEF table of the face. The list returned will begin at the offset provided.

Useful if the client program wishes to cache the list.

HarfBuzz.ot_layout_get_baseline(font, baseline_tag, direction, script_tag, language_tag)
Parameters:
Returns:

if found baseline value in the font.

coord:baseline value if found.

Return type:

(int, coord: int)

Fetches a baseline value from the face.

New in version 2.6.0.

HarfBuzz.ot_layout_get_glyph_class(face, glyph)
Parameters:
Returns:

The HarfBuzz.ot_layout_glyph_class_t glyph class of the given code point in the GDEF table of the face.

Return type:

HarfBuzz.ot_layout_glyph_class_t

Fetches the GDEF class of the requested glyph in the specified face.

New in version 0.9.7.

HarfBuzz.ot_layout_get_glyphs_in_class(face, klass)
Parameters:
Returns:

The HarfBuzz.set_t set of all glyphs belonging to the requested class.

Return type:

glyphs: HarfBuzz.set_t

Retrieves the set of all glyphs from the face that belong to the requested glyph class in the face’s GDEF table.

New in version 0.9.7.

HarfBuzz.ot_layout_get_ligature_carets(font, direction, glyph, start_offset)
Parameters:
Returns:

caret_array:The array of caret positions found for the query

Return type:

(int, caret_array: [int])

Fetches a list of the caret positions defined for a ligature glyph in the GDEF table of the font. The list returned will begin at the offset provided.

HarfBuzz.ot_layout_get_size_params(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
Returns:%true if data found, false otherwise
design_size:The design size of the face
subfamily_id:The identifier of the face within the font subfamily
subfamily_name_id:
 The ‘name’ table name ID of the face within the font subfamily
range_start:The minimum size of the recommended size range for the face
range_end:The maximum size of the recommended size range for the face
Return type:(int, design_size: int, subfamily_id: int, subfamily_name_id: int, range_start: int, range_end: int)

Fetches optical-size feature data (i.e., the size feature from GPOS). Note that the subfamily_id and the subfamily name string (accessible via the subfamily_name_id) as used here are defined as pertaining only to fonts within a font family that differ specifically in their respective size ranges; other ways to differentiate fonts within a subfamily are not covered by the size feature.

For more information on this distinction, see the `size feature documentation < https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-size>`__.

New in version 0.9.10.

HarfBuzz.ot_layout_has_glyph_classes(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
Returns:%true if data found, false otherwise
Return type:int

Tests whether a face has any glyph classes defined in its GDEF table.

HarfBuzz.ot_layout_has_positioning(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
Returns:%true if the face has GPOS data, false otherwise
Return type:int
HarfBuzz.ot_layout_has_substitution(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
Returns:%true if data found, false otherwise
Return type:int

Tests whether the specified face includes any GSUB substitutions.

HarfBuzz.ot_layout_language_find_feature(face, table_tag, script_index, language_index, feature_tag)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_index (int) – The index of the requested script tag
  • language_index (int) – The index of the requested language tag
  • feature_tag (int) – #hb_tag_t of the feature tag requested
Returns:

%true if the feature is found, false otherwise

feature_index:The index of the requested feature

Return type:

(int, feature_index: int)

Fetches the index of a given feature tag in the specified face’s GSUB table or GPOS table, underneath the specified script and language.

HarfBuzz.ot_layout_language_get_feature_indexes(face, table_tag, script_index, language_index, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_index (int) – The index of the requested script tag
  • language_index (int) – The index of the requested language tag
  • start_offset (int) – offset of the first feature tag to retrieve
Returns:

feature_indexes:
 The array of feature indexes found for the query

Return type:

(int, feature_indexes: [int])

Fetches a list of all features in the specified face’s GSUB table or GPOS table, underneath the specified script and language. The list returned will begin at the offset provided.

HarfBuzz.ot_layout_language_get_feature_tags(face, table_tag, script_index, language_index, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_index (int) – The index of the requested script tag
  • language_index (int) – The index of the requested language tag
  • start_offset (int) – offset of the first feature tag to retrieve
Returns:

feature_tags:The array of #hb_tag_t feature tags found for the query

Return type:

(int, feature_tags: [int])

Fetches a list of all features in the specified face’s GSUB table or GPOS table, underneath the specified script and language. The list returned will begin at the offset provided.

HarfBuzz.ot_layout_language_get_required_feature(face, table_tag, script_index, language_index)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_index (int) – The index of the requested script tag
  • language_index (int) – The index of the requested language tag
Returns:

%true if the feature is found, false otherwise

feature_index:The index of the requested feature
feature_tag:The #hb_tag_t of the requested feature

Return type:

(int, feature_index: int, feature_tag: int)

Fetches the tag of a requested feature index in the given face’s GSUB or GPOS table, underneath the specified script and language.

New in version 0.9.30.

HarfBuzz.ot_layout_language_get_required_feature_index(face, table_tag, script_index, language_index)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_index (int) – The index of the requested script tag
  • language_index (int) – The index of the requested language tag
Returns:

%true if the feature is found, false otherwise

feature_index:The index of the requested feature

Return type:

(int, feature_index: int)

Fetches the index of a requested feature in the given face’s GSUB or GPOS table, underneath the specified script and language.

HarfBuzz.ot_layout_lookup_collect_glyphs(face, table_tag, lookup_index)
Parameters:
Returns:

glyphs_before:Array of glyphs preceding the substitution range
glyphs_input:Array of input glyphs that would be substituted by the lookup
glyphs_after:Array of glyphs following the substitution range
glyphs_output:Array of glyphs that would be the substituted output of the lookup

Return type:

(glyphs_before: HarfBuzz.set_t, glyphs_input: HarfBuzz.set_t, glyphs_after: HarfBuzz.set_t, glyphs_output: HarfBuzz.set_t)

Fetches a list of all glyphs affected by the specified lookup in the specified face’s GSUB table or GPOS table.

New in version 0.9.7.

HarfBuzz.ot_layout_lookup_get_glyph_alternates(face, lookup_index, glyph, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – a face.
  • lookup_index (int) – index of the feature lookup to query.
  • glyph (int) – a glyph id.
  • start_offset (int) – starting offset.
Returns:

total number of alternates found in the specific lookup index for the given glyph id.

alternate_glyphs:
 A glyphs buffer. Alternate glyphs associated with the glyph id.

Return type:

(int, alternate_glyphs: [int])

Fetches alternates of a glyph from a given GSUB lookup index.

New in version 2.6.8.

HarfBuzz.ot_layout_lookup_substitute_closure(face, lookup_index)
Parameters:
Returns:

Array of glyphs comprising the transitive closure of the lookup

Return type:

glyphs: HarfBuzz.set_t

Compute the transitive closure of glyphs needed for a specified lookup.

New in version 0.9.7.

HarfBuzz.ot_layout_lookup_would_substitute(face, lookup_index, glyphs, glyphs_length, zero_context)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • lookup_index (int) – The index of the lookup to query
  • glyphs (int) – The sequence of glyphs to query for substitution
  • glyphs_length (int) – The length of the glyph sequence
  • zero_context (int) – #hb_bool_t indicating whether substitutions should be context-free
Returns:

%true if a substitution would be triggered, false otherwise

Return type:

int

Tests whether a specified lookup in the specified face would trigger a substitution on the given glyph sequence.

New in version 0.9.7.

HarfBuzz.ot_layout_lookups_substitute_closure(face, lookups)
Parameters:
Returns:

Array of glyphs comprising the transitive closure of the lookups

Return type:

glyphs: HarfBuzz.set_t

Compute the transitive closure of glyphs needed for all of the provided lookups.

New in version 1.8.1.

HarfBuzz.ot_layout_script_find_language(face, table_tag, script_index, language_tag, language_index)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_index (int) – The index of the requested script tag
  • language_tag (int) – The #hb_tag_t of the requested language
  • language_index (int) – The index of the requested language
Returns:

%true if the language tag is found, false otherwise

Return type:

int

Fetches the index of a given language tag in the specified face’s GSUB table or GPOS table, underneath the specified script tag.

Deprecated since version ???: ??

HarfBuzz.ot_layout_script_get_language_tags(face, table_tag, script_index, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_index (int) – The index of the requested script tag
  • start_offset (int) – offset of the first language tag to retrieve
Returns:

language_tags:Array of language tags found in the table

Return type:

(int, language_tags: [int])

Fetches a list of language tags in the given face’s GSUB or GPOS table, underneath the specified script index. The list returned will begin at the offset provided.

HarfBuzz.ot_layout_script_select_language(face, table_tag, script_index, language_count, language_tags)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_index (int) – The index of the requested script tag
  • language_count (int) – The number of languages in the specified script
  • language_tags (int) – The array of language tags
Returns:

%true if the language tag is found, false otherwise

language_index:The index of the requested language

Return type:

(int, language_index: int)

Fetches the index of a given language tag in the specified face’s GSUB table or GPOS table, underneath the specified script index.

New in version 2.0.0.

HarfBuzz.ot_layout_table_choose_script(face, table_tag, script_tags)
Parameters:
Returns:

script_index:The index of the requested script tag
chosen_script:#hb_tag_t of the script tag requested

Return type:

(int, script_index: int, chosen_script: int)

Deprecated since 2.0.0

HarfBuzz.ot_layout_table_find_feature_variations(face, table_tag, coords, num_coords)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • coords (int) – The variation coordinates to query
  • num_coords (int) – The number of variation coordinates
Returns:

variations_index:
 The array of feature variations found for the query

Return type:

(int, variations_index: int)

Fetches a list of feature variations in the specified face’s GSUB table or GPOS table, at the specified variation coordinates.

HarfBuzz.ot_layout_table_find_script(face, table_tag, script_tag)
Parameters:
Returns:

%true if the script is found, false otherwise

script_index:The index of the requested script tag

Return type:

(int, script_index: int)

Fetches the index if a given script tag in the specified face’s GSUB table or GPOS table.

HarfBuzz.ot_layout_table_get_feature_tags(face, table_tag, start_offset)
Parameters:
Returns:

feature_tags:Array of feature tags found in the table

Return type:

(int, feature_tags: [int])

Fetches a list of all feature tags in the given face’s GSUB or GPOS table.

HarfBuzz.ot_layout_table_get_lookup_count(face, table_tag)
Parameters:
Return type:

int

Fetches the total number of lookups enumerated in the specified face’s GSUB table or GPOS table.

New in version 0.9.22.

HarfBuzz.ot_layout_table_get_script_tags(face, table_tag, start_offset)
Parameters:
Returns:

script_tags:The array of #hb_tag_t script tags found for the query

Return type:

(int, script_tags: [int])

Fetches a list of all scripts enumerated in the specified face’s GSUB table or GPOS table. The list returned will begin at the offset provided.

HarfBuzz.ot_layout_table_select_script(face, table_tag, script_count, script_tags)
Parameters:
  • face (HarfBuzz.face_t) – HarfBuzz.face_t to work upon
  • table_tag (int) – HB_OT_TAG_GSUB or HB_OT_TAG_GPOS
  • script_count (int) – Number of script tags in the array
  • script_tags (int) – Array of #hb_tag_t script tags
Returns:

script_index:The index of the requested script
chosen_script:#hb_tag_t of the requested script

Return type:

(int, script_index: int, chosen_script: int)

New in version 2.0.0.

HarfBuzz.ot_math_get_constant(font, constant)
Parameters:
Returns:

the requested constant or zero

Return type:

int

Fetches the specified math constant. For most constants, the value returned is an #hb_position_t.

However, if the requested constant is HarfBuzz.ot_math_constant_t.SCRIPT_PERCENT_SCALE_DOWN, HarfBuzz.ot_math_constant_t.SCRIPT_SCRIPT_PERCENT_SCALE_DOWN or HarfBuzz.ot_math_constant_t.SCRIPT_PERCENT_SCALE_DOWN, then the return value is an integer between 0 and 100 representing that percentage.

New in version 1.3.3.

HarfBuzz.ot_math_get_glyph_assembly(font, glyph, direction, start_offset)
Parameters:
Returns:

the total number of parts in the glyph assembly

parts:the glyph parts returned
italics_correction:
 italics correction of the glyph assembly

Return type:

(int, parts: [HarfBuzz.ot_math_glyph_part_t], italics_correction: int)

Fetches the GlyphAssembly for the specified font, glyph index, and direction. Returned are a list of HarfBuzz.ot_math_glyph_part_t glyph parts that can be used to draw the glyph and an italics-correction value (if one is defined in the font).

The direction parameter is only used to select between horizontal or vertical directions for the construction. Even though all HarfBuzz.direction_t values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is considered.

New in version 1.3.3.

HarfBuzz.ot_math_get_glyph_italics_correction(font, glyph)
Parameters:
Returns:

the italics correction of the glyph or zero

Return type:

int

Fetches an italics-correction value (if one exists) for the specified glyph index.

New in version 1.3.3.

HarfBuzz.ot_math_get_glyph_kerning(font, glyph, kern, correction_height)
Parameters:
Returns:

requested kerning value or zero

Return type:

int

Fetches the math kerning (cut-ins) value for the specified font, glyph index, and kern.

If the MathKern table is found, the function examines it to find a height value that is greater or equal to correction_height. If such a height value is found, corresponding kerning value from the table is returned. If no such height value is found, the last kerning value is returned.

New in version 1.3.3.

HarfBuzz.ot_math_get_glyph_top_accent_attachment(font, glyph)
Parameters:
Returns:

the top accent attachment of the glyph or 0.5 * the advance width of glyph

Return type:

int

Fetches a top-accent-attachment value (if one exists) for the specified glyph index.

For any glyph that does not have a top-accent-attachment value - that is, a glyph not covered by the MathTopAccentAttachment table (or, when font has no MathTopAccentAttachment table or no MATH table, any glyph) - the function synthesizes a value, returning the position at one-half the glyph’s advance width.

New in version 1.3.3.

HarfBuzz.ot_math_get_glyph_variants(font, glyph, direction, start_offset)
Parameters:
Returns:

the total number of size variants available or zero

variants:array of variants returned

Return type:

(int, variants: [HarfBuzz.ot_math_glyph_variant_t])

Fetches the MathGlyphConstruction for the specified font, glyph index, and direction. The corresponding list of size variants is returned as a list of HarfBuzz.ot_math_glyph_variant_t structs.

The direction parameter is only used to select between horizontal or vertical directions for the construction. Even though all HarfBuzz.direction_t values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is considered.

New in version 1.3.3.

HarfBuzz.ot_math_get_min_connector_overlap(font, direction)
Parameters:
Returns:

requested minimum connector overlap or zero

Return type:

int

Fetches the MathVariants table for the specified font and returns the minimum overlap of connecting glyphs that are required to draw a glyph assembly in the specified direction.

The direction parameter is only used to select between horizontal or vertical directions for the construction. Even though all HarfBuzz.direction_t values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is considered.

New in version 1.3.3.

HarfBuzz.ot_math_has_data(face)
Parameters:face (HarfBuzz.face_t) – HarfBuzz.face_t to test
Returns:true if the table is found, false otherwise
Return type:int

Tests whether a face has a MATH table.

New in version 1.3.3.

HarfBuzz.ot_math_is_glyph_extended_shape(face, glyph)
Parameters:
Returns:

true if the glyph is an extended shape, false otherwise

Return type:

int

Tests whether the given glyph index is an extended shape in the face.

New in version 1.3.3.

HarfBuzz.ot_meta_get_entry_tags(face, start_offset)
Parameters:
  • face (HarfBuzz.face_t) – a face object
  • start_offset (int) – iteration’s start offset
Returns:

Number of all available feature types.

entries:entries tags buffer

Return type:

(int, entries: [HarfBuzz.ot_meta_tag_t])

New in version 2.6.0.

HarfBuzz.ot_meta_reference_entry(face, meta_tag)
Parameters:
Returns:

A blob containing the blob.

Return type:

HarfBuzz.blob_t

It fetches metadata entry of a given tag from a font.

New in version 2.6.0.

HarfBuzz.ot_metrics_get_position(font, metrics_tag)
Parameters:
Returns:

Whether found the requested metrics in the font.

position:result of metrics value from the font.

Return type:

(int, position: int)

It fetches metrics value corresponding to a given tag from a font.

New in version 2.6.0.

HarfBuzz.ot_metrics_get_variation(font, metrics_tag)
Parameters:
Return type:

float

New in version 2.6.0.

HarfBuzz.ot_metrics_get_x_variation(font, metrics_tag)
Parameters:
Return type:

int

New in version 2.6.0.

HarfBuzz.ot_metrics_get_y_variation(font, metrics_tag)
Parameters:
Return type:

int

New in version 2.6.0.

HarfBuzz.ot_name_get_utf16(face, name_id, language)
Parameters:
Returns:

full length of the requested string, or 0 if not found.

text:buffer to write fetched name into.

Return type:

(int, text: [int])

Fetches a font name from the OpenType ‘name’ table. If language is HarfBuzz.LANGUAGE_INVALID, English (“en”) is assumed. Returns string in UTF-16 encoding.

New in version 2.1.0.

HarfBuzz.ot_name_get_utf32(face, name_id, language)
Parameters:
Returns:

full length of the requested string, or 0 if not found.

text:buffer to write fetched name into.

Return type:

(int, text: [int])

Fetches a font name from the OpenType ‘name’ table. If language is HarfBuzz.LANGUAGE_INVALID, English (“en”) is assumed. Returns string in UTF-32 encoding.

New in version 2.1.0.

HarfBuzz.ot_name_get_utf8(face, name_id, language)
Parameters:
Returns:

full length of the requested string, or 0 if not found.

text:buffer to write fetched name into.

Return type:

(int, text: [str])

Fetches a font name from the OpenType ‘name’ table. If language is HarfBuzz.LANGUAGE_INVALID, English (“en”) is assumed. Returns string in UTF-8 encoding.

New in version 2.1.0.

HarfBuzz.ot_name_list_names(face)
Parameters:face (HarfBuzz.face_t) – font face.
Returns:Array of available name entries.
Return type:[HarfBuzz.ot_name_entry_t]

Enumerates all available name IDs and language combinations. Returned array is owned by the face and should not be modified. It can be used as long as face is alive.

New in version 2.1.0.

HarfBuzz.ot_shape_glyphs_closure(font, buffer, features)
Parameters:
Returns:

The HarfBuzz.set_t set of glyphs comprising the transitive closure of the query

Return type:

glyphs: HarfBuzz.set_t

Computes the transitive closure of glyphs needed for a specified input buffer under the given font and feature list. The closure is computed as a set, not as a list.

New in version 0.9.2.

HarfBuzz.ot_tag_from_language(language)
Parameters:language (HarfBuzz.language_t) –
Return type:int
HarfBuzz.ot_tag_to_language(tag)
Parameters:tag (int) –
Return type:HarfBuzz.language_t

New in version 0.9.2.

HarfBuzz.ot_tag_to_script(tag)
Parameters:tag (int) –
Return type:HarfBuzz.script_t
HarfBuzz.ot_tags_from_script(script, script_tag_1, script_tag_2)
Parameters:
HarfBuzz.ot_tags_from_script_and_language(script, language, script_count, language_count)
Parameters:
Returns:

script_tags:array of size at least script_count to store the script tag results
language_tags:array of size at least language_count to store the language tag results

Return type:

(script_tags: int, language_tags: int)

Converts an HarfBuzz.script_t and an HarfBuzz.language_t to script and language tags.

New in version 2.0.0.

HarfBuzz.ot_tags_to_script_and_language(script_tag, language_tag, script, language)
Parameters:

Converts a script tag and a language tag to an HarfBuzz.script_t and an HarfBuzz.language_t.

New in version 2.0.0.

HarfBuzz.ot_var_find_axis(face, axis_tag, axis_index)
Parameters:
Returns:

axis_info:The HarfBuzz.ot_var_axis_info_t of the axis tag queried

Return type:

(int, axis_info: HarfBuzz.ot_var_axis_t)

Fetches the variation-axis information corresponding to the specified axis tag in the specified face.

New in version 1.4.2.

Deprecated since version 2.2.0: * use HarfBuzz.ot_var_find_axis_info() instead

HarfBuzz.ot_var_find_axis_info(face, axis_tag)
Parameters:
Returns:

true if data found, false otherwise

axis_info:The HarfBuzz.ot_var_axis_info_t of the axis tag queried

Return type:

(int, axis_info: HarfBuzz.ot_var_axis_info_t)

Fetches the variation-axis information corresponding to the specified axis tag in the specified face.

New in version 2.2.0.

HarfBuzz.ot_var_get_axes(face, start_offset)
Parameters:
Returns:

axes_array:The array of variation axes found

Return type:

(int, axes_array: [HarfBuzz.ot_var_axis_t])

Fetches a list of all variation axes in the specified face. The list returned will begin at the offset provided.

New in version 1.4.2.

Deprecated since version 2.2.0: use HarfBuzz.ot_var_get_axis_infos() instead

HarfBuzz.ot_var_get_axis_count(face)
Parameters:face (HarfBuzz.face_t) – The HarfBuzz.face_t to work on
Returns:the number of variation axes defined
Return type:int

Fetches the number of OpenType variation axes included in the face.

New in version 1.4.2.

HarfBuzz.ot_var_get_axis_infos(face, start_offset)
Parameters:
Returns:

the number of variation axes in the face

axes_array:The array of variation axes found

Return type:

(int, axes_array: [HarfBuzz.ot_var_axis_info_t])

Fetches a list of all variation axes in the specified face. The list returned will begin at the offset provided.

New in version 2.2.0.

HarfBuzz.ot_var_get_named_instance_count(face)
Parameters:face (HarfBuzz.face_t) – The HarfBuzz.face_t to work on
Returns:the number of named instances defined
Return type:int

Fetches the number of named instances included in the face.

New in version 2.2.0.

HarfBuzz.ot_var_has_data(face)
Parameters:face (HarfBuzz.face_t) – The HarfBuzz.face_t to work on
Returns:true if data found, false otherwise
Return type:int

Tests whether a face includes any OpenType variation data in the fvar table.

New in version 1.4.2.

HarfBuzz.ot_var_named_instance_get_design_coords(face, instance_index)
Parameters:
Returns:

the number of variation axes in the face

coords:The array of coordinates found for the query

Return type:

(int, coords: [float])

Fetches the design-space coordinates corresponding to the given named instance in the face.

New in version 2.2.0.

HarfBuzz.ot_var_named_instance_get_postscript_name_id(face, instance_index)
Parameters:
Returns:

the Name ID found for the PostScript name

Return type:

int

Fetches the name table Name ID that provides display names for the “PostScript name” defined for the given named instance in the face.

New in version 2.2.0.

HarfBuzz.ot_var_named_instance_get_subfamily_name_id(face, instance_index)
Parameters:
Returns:

the Name ID found for the Subfamily name

Return type:

int

Fetches the name table Name ID that provides display names for the “Subfamily name” defined for the given named instance in the face.

New in version 2.2.0.

HarfBuzz.ot_var_normalize_coords(face, coords_length, design_coords)
Parameters:
Returns:

The normalized coordinates

Return type:

normalized_coords: int

Normalizes the given design-space coordinates. The minimum and maximum values for the axis are mapped to the interval [-1,1], with the default axis value mapped to 0.

Any additional scaling defined in the face’s avar table is also applied, as described at https://docs.microsoft.com/en-us/typography/opentype/spec/avar

New in version 1.4.2.

HarfBuzz.ot_var_normalize_variations(face, variations, variations_length)
Parameters:
Returns:

The array of normalized coordinates

Return type:

coords: [int]

Normalizes all of the coordinates in the given list of variation axes.

New in version 1.4.2.

HarfBuzz.script_from_iso15924_tag(tag)
Parameters:tag (int) – an #hb_tag_t representing an ISO 15924 tag.
Returns:An HarfBuzz.script_t corresponding to the ISO 15924 tag.
Return type:HarfBuzz.script_t

Converts an ISO 15924 script tag to a corresponding HarfBuzz.script_t.

New in version 0.9.2.

HarfBuzz.script_from_string(str)
Parameters:str (bytes) – a string representing an ISO 15924 tag.
Returns:An HarfBuzz.script_t corresponding to the ISO 15924 tag.
Return type:HarfBuzz.script_t

Converts a string str representing an ISO 15924 script tag to a corresponding HarfBuzz.script_t. Shorthand for HarfBuzz.tag_from_string() then HarfBuzz.script_from_iso15924_tag().

New in version 0.9.2.

HarfBuzz.script_get_horizontal_direction(script)
Parameters:script (HarfBuzz.script_t) – The HarfBuzz.script_t to query
Returns:The horizontal HarfBuzz.direction_t of script
Return type:HarfBuzz.direction_t

Fetches the HarfBuzz.direction_t of a script when it is set horizontally. All right-to-left scripts will return HarfBuzz.direction_t.RTL. All left-to-right scripts will return HarfBuzz.direction_t.LTR. Scripts that can be written either horizontally or vertically will return HarfBuzz.direction_t.INVALID. Unknown scripts will return HarfBuzz.direction_t.LTR.

New in version 0.9.2.

HarfBuzz.script_to_iso15924_tag(script)
Parameters:script (HarfBuzz.script_t) – an HarfBuzz.script_t to convert.
Returns:An #hb_tag_t representing an ISO 15924 script tag.
Return type:int

Converts an HarfBuzz.script_t to a corresponding ISO 15924 script tag.

New in version 0.9.2.

HarfBuzz.segment_properties_equal(a, b)
Parameters:
Returns:

%true if all properties of a equal those of b, %false otherwise.

Return type:

int

Checks the equality of two HarfBuzz.segment_properties_t’s.

New in version 0.9.7.

HarfBuzz.segment_properties_hash(p)
Parameters:p (HarfBuzz.segment_properties_t) – HarfBuzz.segment_properties_t to hash.
Returns:A hash of p.
Return type:int

Creates a hash representing p.

New in version 0.9.7.

HarfBuzz.set_add(set, codepoint)
Parameters:

Adds codepoint to set.

New in version 0.9.2.

HarfBuzz.set_add_range(set, first, last)
Parameters:
  • set (HarfBuzz.set_t) – A set
  • first (int) – The first element to add to set
  • last (int) – The final element to add to set

Adds all of the elements from first to last (inclusive) to set.

New in version 0.9.7.

HarfBuzz.set_allocation_successful(set)
Parameters:set (HarfBuzz.set_t) – A set
Returns:%true if allocation succeeded, false otherwise
Return type:int

Tests whether memory allocation for a set was successful.

New in version 0.9.2.

HarfBuzz.set_clear(set)
Parameters:set (HarfBuzz.set_t) – A set

Clears out the contents of a set.

New in version 0.9.2.

HarfBuzz.set_create()
Returns:The new HarfBuzz.set_t
Return type:HarfBuzz.set_t

Creates a new, initially empty set.

New in version 0.9.2.

HarfBuzz.set_del(set, codepoint)
Parameters:

Removes codepoint from set.

New in version 0.9.2.

HarfBuzz.set_del_range(set, first, last)
Parameters:
  • set (HarfBuzz.set_t) – A set
  • first (int) – The first element to remove from set
  • last (int) – The final element to remove from set

Removes all of the elements from first to last (inclusive) from set.

New in version 0.9.7.

HarfBuzz.set_get_empty()
Returns:The empty HarfBuzz.set_t
Return type:HarfBuzz.set_t

Fetches the singleton empty HarfBuzz.set_t.

New in version 0.9.2.

HarfBuzz.set_get_max(set)
Parameters:set (HarfBuzz.set_t) – A set
Returns:maximum of set, or HarfBuzz.SET_VALUE_INVALID if set is empty.
Return type:int

Finds the largest element in the set.

New in version 0.9.7.

HarfBuzz.set_get_min(set)
Parameters:set (HarfBuzz.set_t) – A set
Returns:minimum of set, or HarfBuzz.SET_VALUE_INVALID if set is empty.
Return type:int

Finds the smallest element in the set.

New in version 0.9.7.

HarfBuzz.set_get_population(set)
Parameters:set (HarfBuzz.set_t) – A set
Returns:The population of set
Return type:int

Returns the number of elements in the set.

New in version 0.9.7.

HarfBuzz.set_has(set, codepoint)
Parameters:
Returns:

%true if codepoint is in set, false otherwise

Return type:

int

Tests whether codepoint belongs to set.

New in version 0.9.2.

HarfBuzz.set_intersect(set, other)
Parameters:

Makes set the intersection of set and other.

New in version 0.9.2.

HarfBuzz.set_invert(set)
Parameters:set (HarfBuzz.set_t) – A set

Inverts the contents of set.

New in version 0.9.10.

Deprecated since version 1.6.1.

HarfBuzz.set_is_empty(set)
Parameters:set (HarfBuzz.set_t) – a set.
Returns:%true if set is empty
Return type:int

Tests whether a set is empty (contains no elements).

New in version 0.9.7.

HarfBuzz.set_is_equal(set, other)
Parameters:
Returns:

True if the two sets are equal, False otherwise.

Return type:

int

Tests whether set and other are equal (contain the same elements).

New in version 0.9.7.

HarfBuzz.set_is_subset(set, larger_set)
Parameters:
Returns:

True if the set is a subset of (or equal to) larger_set, False otherwise.

Return type:

int

Tests whether set is a subset of larger_set.

New in version 1.8.1.

HarfBuzz.set_next(set, codepoint)
Parameters:
  • set (HarfBuzz.set_t) – A set
  • codepoint (int) – Input = Code point to query Output = Code point retrieved
Returns:

%true if there was a next value, false otherwise

codepoint:Input = Code point to query Output = Code point retrieved

Return type:

(int, codepoint: int)

Fetches the next element in set that is greater than current value of codepoint.

Set codepoint to HarfBuzz.SET_VALUE_INVALID to get started.

New in version 0.9.2.

HarfBuzz.set_next_range(set, last)
Parameters:
  • set (HarfBuzz.set_t) – A set
  • last (int) – Input = The current last code point in the range Output = The last code point in the range
Returns:

%true if there was a next range, false otherwise

first:The first code point in the range
last:Input = The current last code point in the range Output = The last code point in the range

Return type:

(int, first: int, last: int)

Fetches the next consecutive range of elements in set that are greater than current value of last.

Set last to HarfBuzz.SET_VALUE_INVALID to get started.

New in version 0.9.7.

HarfBuzz.set_previous(set, codepoint)
Parameters:
  • set (HarfBuzz.set_t) – A set
  • codepoint (int) – Input = Code point to query Output = Code point retrieved
Returns:

%true if there was a previous value, false otherwise

codepoint:Input = Code point to query Output = Code point retrieved

Return type:

(int, codepoint: int)

Fetches the previous element in set that is lower than current value of codepoint.

Set codepoint to HarfBuzz.SET_VALUE_INVALID to get started.

New in version 1.8.0.

HarfBuzz.set_previous_range(set, first)
Parameters:
  • set (HarfBuzz.set_t) – A set
  • first (int) – Input = The current first code point in the range Output = The first code point in the range
Returns:

%true if there was a previous range, false otherwise

first:Input = The current first code point in the range Output = The first code point in the range
last:The last code point in the range

Return type:

(int, first: int, last: int)

Fetches the previous consecutive range of elements in set that are greater than current value of last.

Set first to HarfBuzz.SET_VALUE_INVALID to get started.

New in version 1.8.0.

HarfBuzz.set_set(set, other)
Parameters:

Makes the contents of set equal to the contents of other.

New in version 0.9.2.

HarfBuzz.set_subtract(set, other)
Parameters:

Subtracts the contents of other from set.

New in version 0.9.2.

HarfBuzz.set_symmetric_difference(set, other)
Parameters:

Makes set the symmetric difference of set and other.

New in version 0.9.2.

HarfBuzz.set_union(set, other)
Parameters:

Makes set the union of set and other.

New in version 0.9.2.

HarfBuzz.shape(font, buffer, features)
Parameters:

Shapes buffer using font turning its Unicode characters content to positioned glyphs. If features is not None, it will be used to control the features applied during shaping. If two features have the same tag but overlapping ranges the value of the feature with the higher index takes precedence.

New in version 0.9.2.

HarfBuzz.shape_full(font, buffer, features, shaper_list)
Parameters:
Returns:

false if all shapers failed, true otherwise

Return type:

int

See HarfBuzz.shape() for details. If shaper_list is not None, the specified shapers will be used in the given order, otherwise the default shapers list will be used.

New in version 0.9.2.

HarfBuzz.shape_list_shapers()
Returns:an array of constant strings
Return type:[str]

Retrieves the list of shapers supported by HarfBuzz.

New in version 0.9.2.

HarfBuzz.shape_plan_create(face, props, user_features, shaper_list)
Parameters:
Returns:

The shaping plan

Return type:

HarfBuzz.shape_plan_t

Constructs a shaping plan for a combination of face, user_features, props, and shaper_list.

New in version 0.9.7.

HarfBuzz.shape_plan_create2(face, props, user_features, coords, shaper_list)
Parameters:
Returns:

The shaping plan

Return type:

HarfBuzz.shape_plan_t

The variable-font version of HarfBuzz.shape_plan_create. Constructs a shaping plan for a combination of face, user_features, props, and shaper_list, plus the variation-space coordinates coords.

New in version 1.4.0.

HarfBuzz.shape_plan_create_cached(face, props, user_features, shaper_list)
Parameters:
Returns:

The shaping plan

Return type:

HarfBuzz.shape_plan_t

Creates a cached shaping plan suitable for reuse, for a combination of face, user_features, props, and shaper_list.

New in version 0.9.7.

HarfBuzz.shape_plan_create_cached2(face, props, user_features, coords, shaper_list)
Parameters:
Returns:

The shaping plan

Return type:

HarfBuzz.shape_plan_t

The variable-font version of HarfBuzz.shape_plan_create_cached. Creates a cached shaping plan suitable for reuse, for a combination of face, user_features, props, and shaper_list, plus the variation-space coordinates coords.

New in version 1.4.0.

HarfBuzz.shape_plan_execute(shape_plan, font, buffer, features)
Parameters:
Return type:

int

Executes the given shaping plan on the specified buffer, using the given font and features.

New in version 0.9.7.

HarfBuzz.shape_plan_get_empty()
Returns:The empty shaping plan
Return type:HarfBuzz.shape_plan_t

Fetches the singleton empty shaping plan.

New in version 0.9.7.

HarfBuzz.shape_plan_get_shaper(shape_plan)
Parameters:shape_plan (HarfBuzz.shape_plan_t) – A shaping plan
Returns:The shaper
Return type:str

Fetches the shaper from a given shaping plan.

New in version 0.9.7.

HarfBuzz.tag_from_string(str)
Parameters:str (bytes) – String to convert
Returns:The #hb_tag_t corresponding to str
Return type:int

Converts a string into an #hb_tag_t. Valid tags are four characters. Shorter input strings will be padded with spaces. Longer input strings will be truncated.

New in version 0.9.2.

HarfBuzz.tag_to_string(tag)
Parameters:tag (int) – #hb_tag_t to convert
Returns:Converted string
Return type:buf: bytes

Converts an #hb_tag_t to a string and returns it in buf. Strings will be four characters long.

New in version 0.9.5.

HarfBuzz.unicode_combining_class(ufuncs, unicode)
Parameters:
Returns:

The HarfBuzz.unicode_combining_class_t of unicode

Return type:

HarfBuzz.unicode_combining_class_t

Retrieves the Canonical Combining Class (ccc) property of code point unicode.

New in version 0.9.2.

HarfBuzz.unicode_compose(ufuncs, a, b)
Parameters:
  • ufuncs (HarfBuzz.unicode_funcs_t) – The Unicode-functions structure
  • a (int) – The first code point to compose
  • b (int) – The second code point to compose
Returns:

True is a,`b` composed, false otherwise

ab:The composed code point

Return type:

(int, ab: int)

Composes the code point sequence a,`b` by canonical equivalence into code point ab.

New in version 0.9.2.

HarfBuzz.unicode_decompose(ufuncs, ab)
Parameters:
Returns:

True if ab decomposed, false otherwise

a:The first decomposed code point
b:The second decomposed code point

Return type:

(int, a: int, b: int)

Decomposes code point ab by canonical equivalence, into code points a and b.

New in version 0.9.2.

HarfBuzz.unicode_decompose_compatibility(ufuncs, u)
Parameters:
Returns:

decomposed:Compatibility decomposition of u

Return type:

(int, decomposed: int)

Fetches the compatibility decomposition of a Unicode code point. Deprecated.

New in version 0.9.2.

Deprecated since version 2.0.0.

HarfBuzz.unicode_eastasian_width(ufuncs, unicode)
Parameters:
Return type:

int

New in version 0.9.2.

Deprecated since version 2.0.0.

HarfBuzz.unicode_funcs_create(parent)
Parameters:parent (HarfBuzz.unicode_funcs_t or None) – Parent Unicode-functions structure
Returns:The Unicode-functions structure
Return type:HarfBuzz.unicode_funcs_t

Creates a new HarfBuzz.unicode_funcs_t structure of Unicode functions.

New in version 0.9.2.

HarfBuzz.unicode_funcs_get_default()
Returns:a pointer to the HarfBuzz.unicode_funcs_t Unicode-functions structure
Return type:HarfBuzz.unicode_funcs_t

Fetches a pointer to the default Unicode-functions structure that is used when no functions are explicitly set on HarfBuzz.buffer_t.

New in version 0.9.2.

HarfBuzz.unicode_funcs_get_empty()
Returns:The empty Unicode-functions structure
Return type:HarfBuzz.unicode_funcs_t

Fetches the singleton empty Unicode-functions structure.

New in version 0.9.2.

HarfBuzz.unicode_funcs_get_parent(ufuncs)
Parameters:ufuncs (HarfBuzz.unicode_funcs_t) – The Unicode-functions structure
Returns:The parent Unicode-functions structure
Return type:HarfBuzz.unicode_funcs_t

Fetches the parent of the Unicode-functions structure ufuncs.

New in version 0.9.2.

HarfBuzz.unicode_funcs_is_immutable(ufuncs)
Parameters:ufuncs (HarfBuzz.unicode_funcs_t) – The Unicode-functions structure
Returns:%true if ufuncs is immutable, false otherwise
Return type:int

Tests whether the specified Unicode-functions structure is immutable.

New in version 0.9.2.

HarfBuzz.unicode_funcs_make_immutable(ufuncs)
Parameters:ufuncs (HarfBuzz.unicode_funcs_t) – The Unicode-functions structure

Makes the specified Unicode-functions structure immutable.

New in version 0.9.2.

HarfBuzz.unicode_funcs_set_combining_class_func(ufuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.unicode_combining_class_func_t.

New in version 0.9.2.

HarfBuzz.unicode_funcs_set_compose_func(ufuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.unicode_compose_func_t.

New in version 0.9.2.

HarfBuzz.unicode_funcs_set_decompose_compatibility_func(ufuncs, func, *user_data)
Parameters:

New in version 0.9.2.

Deprecated since version 2.0.0.

HarfBuzz.unicode_funcs_set_decompose_func(ufuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.unicode_decompose_func_t.

New in version 0.9.2.

HarfBuzz.unicode_funcs_set_eastasian_width_func(ufuncs, func, *user_data)
Parameters:

New in version 0.9.2.

Deprecated since version 2.0.0.

HarfBuzz.unicode_funcs_set_general_category_func(ufuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.unicode_general_category_func_t.

New in version 0.9.2.

HarfBuzz.unicode_funcs_set_mirroring_func(ufuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.unicode_mirroring_func_t.

New in version 0.9.2.

HarfBuzz.unicode_funcs_set_script_func(ufuncs, func, *user_data)
Parameters:

Sets the implementation function for HarfBuzz.unicode_script_func_t.

New in version 0.9.2.

HarfBuzz.unicode_general_category(ufuncs, unicode)
Parameters:
Returns:

The HarfBuzz.unicode_general_category_t of unicode

Return type:

HarfBuzz.unicode_general_category_t

Retrieves the General Category (gc) property of code point unicode.

New in version 0.9.2.

HarfBuzz.unicode_mirroring(ufuncs, unicode)
Parameters:
Returns:

The #hb_codepoint_t of the Mirroring Glyph for unicode

Return type:

int

Retrieves the Bi-directional Mirroring Glyph code point defined for code point unicode.

New in version 0.9.2.

HarfBuzz.unicode_script(ufuncs, unicode)
Parameters:
Returns:

The HarfBuzz.script_t of unicode

Return type:

HarfBuzz.script_t

Retrieves the HarfBuzz.script_t script to which code point unicode belongs.

New in version 0.9.2.

HarfBuzz.variation_from_string(str, len, variation)
Parameters:
Return type:

int

New in version 1.4.2.

HarfBuzz.variation_to_string(variation, buf, size)
Parameters:

New in version 1.4.2.

HarfBuzz.version()
Returns:
major:Library major version component
minor:Library minor version component
micro:Library micro version component
Return type:(major: int, minor: int, micro: int)

Returns library version as three integer components.

New in version 0.9.2.

HarfBuzz.version_atleast(major, minor, micro)
Parameters:
  • major (int) – Library major version component
  • minor (int) – Library minor version component
  • micro (int) – Library micro version component
Returns:

True if the library is equal to or greater than the test value, false otherwise

Return type:

int

Tests the library version against a minimum value, as three integer components.

New in version 0.9.30.

HarfBuzz.version_string()
Returns:Library version string
Return type:str

Returns library version as a string with three components.

New in version 0.9.2.