Callbacks

buffer_message_func_t (buffer, font, message, *user_data)

color_line_get_color_stops_func_t (color_line, color_line_data, start, *user_data)

color_line_get_extend_func_t (color_line, color_line_data, *user_data)

destroy_func_t (*user_data)

draw_close_path_func_t (dfuncs, draw_data, st, *user_data)

draw_cubic_to_func_t (dfuncs, draw_data, st, control1_x, control1_y, control2_x, control2_y, to_x, to_y, *user_data)

draw_line_to_func_t (dfuncs, draw_data, st, to_x, to_y, *user_data)

draw_move_to_func_t (dfuncs, draw_data, st, to_x, to_y, *user_data)

draw_quadratic_to_func_t (dfuncs, draw_data, st, control_x, control_y, to_x, to_y, *user_data)

font_draw_glyph_func_t (font, font_data, glyph, draw_funcs, draw_data, *user_data)

font_get_font_extents_func_t (font, font_data, *user_data)

font_get_glyph_advance_func_t (font, font_data, glyph, *user_data)

font_get_glyph_advances_func_t (font, font_data, count, first_glyph, glyph_stride, advance_stride, *user_data)

font_get_glyph_contour_point_func_t (font, font_data, glyph, point_index, *user_data)

font_get_glyph_extents_func_t (font, font_data, glyph, *user_data)

font_get_glyph_from_name_func_t (font, font_data, name, *user_data)

font_get_glyph_func_t (font, font_data, unicode, variation_selector, *user_data)

font_get_glyph_kerning_func_t (font, font_data, first_glyph, second_glyph, *user_data)

font_get_glyph_name_func_t (font, font_data, glyph, *user_data)

font_get_glyph_origin_func_t (font, font_data, glyph, *user_data)

font_get_glyph_shape_func_t (font, font_data, glyph, draw_funcs, draw_data, *user_data)

font_get_nominal_glyph_func_t (font, font_data, unicode, *user_data)

font_get_nominal_glyphs_func_t (font, font_data, count, first_unicode, unicode_stride, glyph_stride, *user_data)

font_get_variation_glyph_func_t (font, font_data, unicode, variation_selector, *user_data)

font_paint_glyph_func_t (font, font_data, glyph, paint_funcs, paint_data, palette_index, foreground, *user_data)

paint_color_func_t (funcs, paint_data, is_foreground, color, *user_data)

paint_color_glyph_func_t (funcs, paint_data, glyph, font, *user_data)

paint_custom_palette_color_func_t (funcs, paint_data, color_index, *user_data)

paint_image_func_t (funcs, paint_data, image, width, height, format, slant, extents, *user_data)

paint_linear_gradient_func_t (funcs, paint_data, color_line, x0, y0, x1, y1, x2, y2, *user_data)

paint_pop_clip_func_t (funcs, paint_data, *user_data)

paint_pop_group_func_t (funcs, paint_data, mode, *user_data)

paint_pop_transform_func_t (funcs, paint_data, *user_data)

paint_push_clip_glyph_func_t (funcs, paint_data, glyph, font, *user_data)

paint_push_clip_rectangle_func_t (funcs, paint_data, xmin, ymin, xmax, ymax, *user_data)

paint_push_group_func_t (funcs, paint_data, *user_data)

paint_push_transform_func_t (funcs, paint_data, xx, yx, xy, yy, dx, dy, *user_data)

paint_radial_gradient_func_t (funcs, paint_data, color_line, x0, y0, r0, x1, y1, r1, *user_data)

paint_sweep_gradient_func_t (funcs, paint_data, color_line, x0, y0, start_angle, end_angle, *user_data)

reference_table_func_t (face, tag, *user_data)

unicode_combining_class_func_t (ufuncs, unicode, *user_data)

unicode_compose_func_t (ufuncs, a, b, *user_data)

unicode_decompose_compatibility_func_t (ufuncs, u, decomposed, *user_data)

unicode_decompose_func_t (ufuncs, ab, *user_data)

unicode_eastasian_width_func_t (ufuncs, unicode, *user_data)

unicode_general_category_func_t (ufuncs, unicode, *user_data)

unicode_mirroring_func_t (ufuncs, unicode, *user_data)

unicode_script_func_t (ufuncs, unicode, *user_data)

Details

HarfBuzz.buffer_message_func_t(buffer, font, message, *user_data)
Parameters:
Returns:

true to perform the shaping step, false to skip it.

Return type:

int

A callback method for HarfBuzz.buffer_t. The method gets called with the HarfBuzz.buffer_t it was set on, the HarfBuzz.font_t the buffer is shaped with and a message describing what step of the shaping process will be performed. Returning false from this method will skip this shaping step and move to the next one.

New in version 1.1.3.

HarfBuzz.color_line_get_color_stops_func_t(color_line, color_line_data, start, *user_data)
Parameters:
Returns:

the total number of color stops in color_line

color_stops:

Array of HarfBuzz.color_stop_t to populate

Return type:

(int, color_stops: [HarfBuzz.color_stop_t])

A virtual method for the HarfBuzz.color_line_t to fetch color stops.

New in version 7.0.0.

HarfBuzz.color_line_get_extend_func_t(color_line, color_line_data, *user_data)
Parameters:
Returns:

the extend mode of color_line

Return type:

HarfBuzz.paint_extend_t

A virtual method for the hb_color_line_t to fetches the extend mode.

New in version 7.0.0.

HarfBuzz.destroy_func_t(*user_data)
Parameters:

user_data (object or None) – the data to be destroyed

A virtual method for destroy user-data callbacks.

HarfBuzz.draw_close_path_func_t(dfuncs, draw_data, st, *user_data)
Parameters:

A virtual method for the HarfBuzz.draw_funcs_t to perform a “close-path” draw operation.

New in version 4.0.0.

HarfBuzz.draw_cubic_to_func_t(dfuncs, draw_data, st, control1_x, control1_y, control2_x, control2_y, to_x, to_y, *user_data)
Parameters:

A virtual method for the HarfBuzz.draw_funcs_t to perform a “cubic-to” draw operation.

New in version 4.0.0.

HarfBuzz.draw_line_to_func_t(dfuncs, draw_data, st, to_x, to_y, *user_data)
Parameters:

A virtual method for the HarfBuzz.draw_funcs_t to perform a “line-to” draw operation.

New in version 4.0.0.

HarfBuzz.draw_move_to_func_t(dfuncs, draw_data, st, to_x, to_y, *user_data)
Parameters:

A virtual method for the HarfBuzz.draw_funcs_t to perform a “move-to” draw operation.

New in version 4.0.0.

HarfBuzz.draw_quadratic_to_func_t(dfuncs, draw_data, st, control_x, control_y, to_x, to_y, *user_data)
Parameters:

A virtual method for the HarfBuzz.draw_funcs_t to perform a “quadratic-to” draw operation.

New in version 4.0.0.

HarfBuzz.font_draw_glyph_func_t(font, font_data, glyph, draw_funcs, draw_data, *user_data)
Parameters:

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

New in version 7.0.0.

HarfBuzz.font_get_font_extents_func_t(font, font_data, *user_data)
Parameters:
Returns:

extents:

The font extents retrieved

Return type:

(int, extents: HarfBuzz.font_extents_t)

This method should retrieve the extents for a font.

HarfBuzz.font_get_glyph_advance_func_t(font, font_data, glyph, *user_data)
Parameters:
Returns:

The advance of glyph within font

Return type:

int

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the advance for a specified glyph. The method must return an #hb_position_t.

HarfBuzz.font_get_glyph_advances_func_t(font, font_data, count, first_glyph, glyph_stride, advance_stride, *user_data)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon

  • font_data (object or None) – font user data pointer

  • 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

  • advance_stride (int) – The stride between successive advances

  • user_data (object or None) – User data pointer passed by the caller

Returns:

The first advance retrieved

Return type:

first_advance: int

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the advances for a sequence of glyphs.

HarfBuzz.font_get_glyph_contour_point_func_t(font, font_data, glyph, point_index, *user_data)
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)

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the (X,Y) coordinates (in font units) for a specified contour point in a glyph. Each coordinate must be returned as an #hb_position_t output parameter.

HarfBuzz.font_get_glyph_extents_func_t(font, font_data, glyph, *user_data)
Parameters:
Returns:

true if data found, false otherwise

extents:

The HarfBuzz.glyph_extents_t retrieved

Return type:

(int, extents: HarfBuzz.glyph_extents_t)

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the extents for a specified glyph. Extents must be returned in an #hb_glyph_extents output parameter.

HarfBuzz.font_get_glyph_from_name_func_t(font, font_data, name, *user_data)
Parameters:
Returns:

true if data found, false otherwise

glyph:

The glyph ID retrieved

Return type:

(int, glyph: int)

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the glyph ID that corresponds to a glyph-name string.

HarfBuzz.font_get_glyph_func_t(font, font_data, unicode, variation_selector, *user_data)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon

  • font_data (object or None) – font user data pointer

  • unicode (int) – The Unicode code point to query

  • variation_selector (int) – The variation-selector code point to query

  • user_data (object or None) – User data pointer passed by the caller

Returns:

true if data found, false otherwise

glyph:

The glyph ID retrieved

Return type:

(int, glyph: int)

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the glyph ID for a specified Unicode code point font, with an optional variation selector.

Deprecated since version 1.2.3.

HarfBuzz.font_get_glyph_kerning_func_t(font, font_data, first_glyph, second_glyph, *user_data)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon

  • font_data (object or None) – font user data pointer

  • first_glyph (int) – The glyph ID of the first glyph in the glyph pair

  • second_glyph (int) – The glyph ID of the second glyph in the glyph pair

  • user_data (object or None) – User data pointer passed by the caller

Return type:

int

This method should retrieve the kerning-adjustment value for a glyph-pair in the specified font, for horizontal text segments.

HarfBuzz.font_get_glyph_name_func_t(font, font_data, glyph, *user_data)
Parameters:
Returns:

true if data found, false otherwise

name:

Name string retrieved for the glyph ID

Return type:

(int, name: [str])

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the glyph name that corresponds to a glyph ID. The name should be returned in a string output parameter.

HarfBuzz.font_get_glyph_origin_func_t(font, font_data, glyph, *user_data)
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)

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the (X,Y) coordinates (in font units) of the origin for a glyph. Each coordinate must be returned in an #hb_position_t output parameter.

HarfBuzz.font_get_glyph_shape_func_t(font, font_data, glyph, draw_funcs, draw_data, *user_data)
Parameters:

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

New in version 4.0.0.

Deprecated since version 7.0.0: Use HarfBuzz.font_draw_glyph_func_t instead

HarfBuzz.font_get_nominal_glyph_func_t(font, font_data, unicode, *user_data)
Parameters:
Returns:

true if data found, false otherwise

glyph:

The glyph ID retrieved

Return type:

(int, glyph: int)

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the nominal glyph ID for a specified Unicode code point. Glyph IDs must be returned in a #hb_codepoint_t output parameter.

HarfBuzz.font_get_nominal_glyphs_func_t(font, font_data, count, first_unicode, unicode_stride, glyph_stride, *user_data)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon

  • font_data (object or None) – font user data pointer

  • count (int) – number of code points to query

  • first_unicode (int) – The first Unicode code point to query

  • unicode_stride (int) – The stride between successive code points

  • glyph_stride (int) – The stride between successive glyph IDs

  • user_data (object or None) – User data pointer passed by the caller

Returns:

the number of code points processed

first_glyph:

The first glyph ID retrieved

Return type:

(int, first_glyph: int)

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the nominal glyph IDs for a sequence of Unicode code points. Glyph IDs must be returned in a #hb_codepoint_t output parameter.

HarfBuzz.font_get_variation_glyph_func_t(font, font_data, unicode, variation_selector, *user_data)
Parameters:
  • font (HarfBuzz.font_t) – HarfBuzz.font_t to work upon

  • font_data (object or None) – font user data pointer

  • unicode (int) – The Unicode code point to query

  • variation_selector (int) – The variation-selector code point to query

  • user_data (object or None) – User data pointer passed by the caller

Returns:

true if data found, false otherwise

glyph:

The glyph ID retrieved

Return type:

(int, glyph: int)

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

This method should retrieve the glyph ID for a specified Unicode code point followed by a specified Variation Selector code point. Glyph IDs must be returned in a #hb_codepoint_t output parameter.

HarfBuzz.font_paint_glyph_func_t(font, font_data, glyph, paint_funcs, paint_data, palette_index, foreground, *user_data)
Parameters:

A virtual method for the HarfBuzz.font_funcs_t of an HarfBuzz.font_t object.

New in version 7.0.0.

HarfBuzz.paint_color_func_t(funcs, paint_data, is_foreground, color, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to paint a color everywhere within the current clip.

New in version 7.0.0.

HarfBuzz.paint_color_glyph_func_t(funcs, paint_data, glyph, font, *user_data)
Parameters:
Returns:

%true if the glyph was painted, %false otherwise.

Return type:

int

A virtual method for the HarfBuzz.paint_funcs_t to render a color glyph by glyph index.

New in version 8.2.0.

HarfBuzz.paint_custom_palette_color_func_t(funcs, paint_data, color_index, *user_data)
Parameters:
Returns:

true if found, false otherwise

color:

fetched color

Return type:

(int, color: int)

A virtual method for the HarfBuzz.paint_funcs_t to fetch a color from the custom color palette.

Custom palette colors override the colors from the fonts selected color palette. It is not necessary to override all palette entries; for entries that should be taken from the font palette, return false.

This function might get called multiple times, but the custom palette is expected to remain unchanged for duration of a HarfBuzz.font_paint_glyph() call.

New in version 7.0.0.

HarfBuzz.paint_image_func_t(funcs, paint_data, image, width, height, format, slant, extents, *user_data)
Parameters:
Returns:

Whether the operation was successful.

Return type:

int

A virtual method for the HarfBuzz.paint_funcs_t to paint a glyph image.

This method is called for glyphs with image blobs in the CBDT, sbix or SVG tables. The format identifies the kind of data that is contained in image. Possible values include #HB_PAINT_IMAGE_FORMAT_PNG, #HB_PAINT_IMAGE_FORMAT_SVG and #HB_PAINT_IMAGE_FORMAT_BGRA.

The image dimensions and glyph extents are provided if available, and should be used to size and position the image.

New in version 7.0.0.

HarfBuzz.paint_linear_gradient_func_t(funcs, paint_data, color_line, x0, y0, x1, y1, x2, y2, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to paint a linear gradient everywhere within the current clip.

The color_line object contains information about the colors of the gradients. It is only valid for the duration of the callback, you cannot keep it around.

The coordinates of the points are interpreted according to the current transform.

See the OpenType spec COLR section for details on how the points define the direction of the gradient, and how to interpret the color_line.

New in version 7.0.0.

HarfBuzz.paint_pop_clip_func_t(funcs, paint_data, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to undo the effect of a prior call to the #hb_paint_funcs_push_clip_glyph_func_t or #hb_paint_funcs_push_clip_rectangle_func_t vfuncs.

New in version 7.0.0.

HarfBuzz.paint_pop_group_func_t(funcs, paint_data, mode, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to undo the effect of a prior call to the #hb_paint_funcs_push_group_func_t vfunc.

This call stops the redirection to the intermediate surface, and then composites it on the previous surface, using the compositing mode passed to this call.

New in version 7.0.0.

HarfBuzz.paint_pop_transform_func_t(funcs, paint_data, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to undo the effect of a prior call to the #hb_paint_funcs_push_transform_func_t vfunc.

New in version 7.0.0.

HarfBuzz.paint_push_clip_glyph_func_t(funcs, paint_data, glyph, font, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to clip subsequent paint calls to the outline of a glyph.

The coordinates of the glyph outline are interpreted according to the current transform.

This clip is applied in addition to the current clip, and remains in effect until a matching call to the #hb_paint_funcs_pop_clip_func_t vfunc.

New in version 7.0.0.

HarfBuzz.paint_push_clip_rectangle_func_t(funcs, paint_data, xmin, ymin, xmax, ymax, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to clip subsequent paint calls to a rectangle.

The coordinates of the rectangle are interpreted according to the current transform.

This clip is applied in addition to the current clip, and remains in effect until a matching call to the #hb_paint_funcs_pop_clip_func_t vfunc.

New in version 7.0.0.

HarfBuzz.paint_push_group_func_t(funcs, paint_data, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to use an intermediate surface for subsequent paint calls.

The drawing will be redirected to an intermediate surface until a matching call to the #hb_paint_funcs_pop_group_func_t vfunc.

New in version 7.0.0.

HarfBuzz.paint_push_transform_func_t(funcs, paint_data, xx, yx, xy, yy, dx, dy, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to apply a transform to subsequent paint calls.

This transform is applied after the current transform, and remains in effect until a matching call to the #hb_paint_funcs_pop_transform_func_t vfunc.

New in version 7.0.0.

HarfBuzz.paint_radial_gradient_func_t(funcs, paint_data, color_line, x0, y0, r0, x1, y1, r1, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to paint a radial gradient everywhere within the current clip.

The color_line object contains information about the colors of the gradients. It is only valid for the duration of the callback, you cannot keep it around.

The coordinates of the points are interpreted according to the current transform.

See the OpenType spec COLR section for details on how the points define the direction of the gradient, and how to interpret the color_line.

New in version 7.0.0.

HarfBuzz.paint_sweep_gradient_func_t(funcs, paint_data, color_line, x0, y0, start_angle, end_angle, *user_data)
Parameters:

A virtual method for the HarfBuzz.paint_funcs_t to paint a sweep gradient everywhere within the current clip.

The color_line object contains information about the colors of the gradients. It is only valid for the duration of the callback, you cannot keep it around.

The coordinates of the points are interpreted according to the current transform.

See the OpenType spec COLR section for details on how the points define the direction of the gradient, and how to interpret the color_line.

New in version 7.0.0.

HarfBuzz.reference_table_func_t(face, tag, *user_data)
Parameters:
Returns:

A pointer to the tag table within face

Return type:

HarfBuzz.blob_t

Callback function for HarfBuzz.face_create_for_tables().

New in version 0.9.2.

HarfBuzz.unicode_combining_class_func_t(ufuncs, unicode, *user_data)
Parameters:
Returns:

The HarfBuzz.unicode_combining_class_t of unicode

Return type:

HarfBuzz.unicode_combining_class_t

A virtual method for the HarfBuzz.unicode_funcs_t structure.

This method should retrieve the Canonical Combining Class (ccc) property for a specified Unicode code point.

HarfBuzz.unicode_compose_func_t(ufuncs, a, b, *user_data)
Parameters:
  • ufuncs (HarfBuzz.unicode_funcs_t) – A Unicode-functions structure

  • a (int) – The first code point to compose

  • b (int) – The second code point to compose

  • user_data (object or None) – user data pointer passed by the caller

Returns:

true is a,`b` composed, false otherwise

ab:

The composed code point

Return type:

(int, ab: int)

A virtual method for the HarfBuzz.unicode_funcs_t structure.

This method should compose a sequence of two input Unicode code points by canonical equivalence, returning the composed code point in a #hb_codepoint_t output parameter (if successful). The method must return an #hb_bool_t indicating the success of the composition.

HarfBuzz.unicode_decompose_compatibility_func_t(ufuncs, u, decomposed, *user_data)
Parameters:
Returns:

number of codepoints in the full compatibility decomposition of u, or 0 if no decomposition available.

Return type:

int

Fully decompose u to its Unicode compatibility decomposition. The codepoints of the decomposition will be written to decomposed. The complete length of the decomposition will be returned.

If u has no compatibility decomposition, zero should be returned.

The Unicode standard guarantees that a buffer of length HarfBuzz.UNICODE_MAX_DECOMPOSITION_LEN codepoints will always be sufficient for any compatibility decomposition plus an terminating value of 0. Consequently, decompose must be allocated by the caller to be at least this length. Implementations of this function type must ensure that they do not write past the provided array.

Deprecated since version 2.0.0.

HarfBuzz.unicode_decompose_func_t(ufuncs, ab, *user_data)
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)

A virtual method for the HarfBuzz.unicode_funcs_t structure.

This method should decompose an input Unicode code point, returning the two decomposed code points in #hb_codepoint_t output parameters (if successful). The method must return an #hb_bool_t indicating the success of the composition.

HarfBuzz.unicode_eastasian_width_func_t(ufuncs, unicode, *user_data)
Parameters:
Return type:

int

A virtual method for the HarfBuzz.unicode_funcs_t structure.

Deprecated since version 2.0.0.

HarfBuzz.unicode_general_category_func_t(ufuncs, unicode, *user_data)
Parameters:
Returns:

The HarfBuzz.unicode_general_category_t of unicode

Return type:

HarfBuzz.unicode_general_category_t

A virtual method for the HarfBuzz.unicode_funcs_t structure.

This method should retrieve the General Category property for a specified Unicode code point.

HarfBuzz.unicode_mirroring_func_t(ufuncs, unicode, *user_data)
Parameters:
Returns:

The #hb_codepoint_t of the Mirroring Glyph for unicode

Return type:

int

A virtual method for the HarfBuzz.unicode_funcs_t structure.

This method should retrieve the Bi-Directional Mirroring Glyph code point for a specified Unicode code point.

Note: If a code point does not have a specified Bi-Directional Mirroring Glyph defined, the method should return the original code point.

HarfBuzz.unicode_script_func_t(ufuncs, unicode, *user_data)
Parameters:
Returns:

The HarfBuzz.script_t of unicode

Return type:

HarfBuzz.script_t

A virtual method for the HarfBuzz.unicode_funcs_t structure.

This method should retrieve the Script property for a specified Unicode code point.