Functions
=========
.. currentmodule:: gi.repository.HarfBuzz
.. function:: aat_layout_feature_type_get_name_id(face: ~gi.repository.HarfBuzz.face_t, feature_type: ~gi.repository.HarfBuzz.aat_layout_feature_type_t) -> int
Fetches the name identifier of the specified feature type in the face's ``name`` table.
.. versionadded:: 2.2.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param feature_type: The :obj:`~gi.repository.HarfBuzz.aat_layout_feature_type_t` of the requested feature type
:return: Name identifier of the requested feature type
.. function:: aat_layout_feature_type_get_selector_infos(face: ~gi.repository.HarfBuzz.face_t, feature_type: ~gi.repository.HarfBuzz.aat_layout_feature_type_t, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.HarfBuzz.aat_layout_feature_selector_info_t], int]
Fetches a list of the selectors available for the specified feature in the given face.
If upon return, ``default_index`` is set to ``HB_AAT_LAYOUT_NO_SELECTOR_INDEX``, then
the feature type is non-exclusive. Otherwise, ``default_index`` is the index of
the selector that is selected by default.
.. versionadded:: 2.2.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param feature_type: The :obj:`~gi.repository.HarfBuzz.aat_layout_feature_type_t` of the requested feature type
:param start_offset: offset of the first feature type to retrieve
:return: Number of all available feature selectors
.. function:: aat_layout_get_feature_types(face: ~gi.repository.HarfBuzz.face_t, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.HarfBuzz.aat_layout_feature_type_t]]
Fetches a list of the AAT feature types included in the specified face.
.. versionadded:: 2.2.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param start_offset: offset of the first feature type to retrieve
:return: Number of all available feature types.
.. function:: aat_layout_has_positioning(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether the specified face includes any positioning information
in the ``kerx`` table.
Note: does not examine the ``GPOS`` table.
.. versionadded:: 2.3.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: aat_layout_has_substitution(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether the specified face includes any substitutions in the
``morx`` or ``mort`` tables.
Note: does not examine the ``GSUB`` table.
.. versionadded:: 2.3.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: aat_layout_has_tracking(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether the specified face includes any tracking information
in the ``trak`` table.
.. versionadded:: 2.3.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: blob_create_from_file(file_name: str) -> ~gi.repository.HarfBuzz.blob_t
Creates a new blob containing the data from the
specified binary font file.
The filename is passed directly to the system on all platforms,
except on Windows, where the filename is interpreted as UTF-8.
Only if the filename is not valid UTF-8, it will be interpreted
according to the system codepage.
.. versionadded:: 1.7.7
:param file_name: A font filename
:return: An :obj:`~gi.repository.HarfBuzz.blob_t` pointer with the content of the file,
or :func:`~gi.repository.HarfBuzz.blob_get_empty` if failed.
.. function:: blob_create_from_file_or_fail(file_name: str) -> ~gi.repository.HarfBuzz.blob_t
Creates a new blob containing the data from the
specified binary font file.
The filename is passed directly to the system on all platforms,
except on Windows, where the filename is interpreted as UTF-8.
Only if the filename is not valid UTF-8, it will be interpreted
according to the system codepage.
.. versionadded:: 2.8.2
:param file_name: A font filename
:return: An :obj:`~gi.repository.HarfBuzz.blob_t` pointer with the content of the file,
or ``NULL`` if failed.
.. function:: blob_create_sub_blob(parent: ~gi.repository.HarfBuzz.blob_t, offset: int, length: int) -> ~gi.repository.HarfBuzz.blob_t
Returns a blob that represents a range of bytes in ``parent``\. The new
blob is always created with ``HB_MEMORY_MODE_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.
.. versionadded:: 0.9.2
:param parent: Parent blob.
:param offset: Start offset of sub-blob within ``parent``\, in bytes.
:param length: Length of sub-blob.
:return: 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 :func:`~gi.repository.HarfBuzz.blob_destroy`.
.. function:: blob_get_data(blob: ~gi.repository.HarfBuzz.blob_t) -> list[str] | None
Fetches the data from a blob.
.. versionadded:: 0.9.2
:param blob: a blob.
:return: the byte data of ``blob``\.
.. function:: blob_get_data_writable(blob: ~gi.repository.HarfBuzz.blob_t) -> list[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.
.. versionadded:: 0.9.2
:param blob: a blob.
:return: Writable blob data,
or ``NULL`` if failed.
.. function:: blob_get_empty() -> ~gi.repository.HarfBuzz.blob_t
Returns the singleton empty blob.
See TODO:link object types for more information.
.. versionadded:: 0.9.2
:return: The empty blob.
.. function:: blob_get_length(blob: ~gi.repository.HarfBuzz.blob_t) -> int
Fetches the length of a blob's data.
.. versionadded:: 0.9.2
:param blob: a blob.
:return: the length of ``blob`` data in bytes.
.. function:: blob_is_immutable(blob: ~gi.repository.HarfBuzz.blob_t) -> int
Tests whether a blob is immutable.
.. versionadded:: 0.9.2
:param blob: a blob.
:return: ``true`` if ``blob`` is immutable, ``false`` otherwise
.. function:: blob_make_immutable(blob: ~gi.repository.HarfBuzz.blob_t) -> None
Makes a blob immutable.
.. versionadded:: 0.9.2
:param blob: a blob
.. function:: buffer_add(buffer: ~gi.repository.HarfBuzz.buffer_t, codepoint: int, cluster: int) -> None
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
:obj:`~gi.repository.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.
.. versionadded:: 0.9.7
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param codepoint: A Unicode code point.
:param cluster: The cluster value of ``codepoint``\.
.. function:: buffer_add_codepoints(buffer: ~gi.repository.HarfBuzz.buffer_t, text: list[int], item_offset: int, item_length: int) -> None
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 scalar values. In contrast,
:func:`~gi.repository.HarfBuzz.buffer_add_utf32` can be used that takes similar input but performs
sanity-check on the input.
.. versionadded:: 0.9.31
:param buffer: a :obj:`~gi.repository.HarfBuzz.buffer_t` to append characters to.
:param text: an array of Unicode code points to append.
:param item_offset: the offset of the first code point to add to the ``buffer``\.
:param item_length: the number of code points to add to the ``buffer``\, or -1 for the
end of ``text`` (assuming it is ``NULL`` terminated).
.. function:: buffer_add_latin1(buffer: ~gi.repository.HarfBuzz.buffer_t, text: list[int], item_offset: int, item_length: int) -> None
Similar to :func:`~gi.repository.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.
.. versionadded:: 0.9.39
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param text: an array of UTF-8
characters to append
:param item_offset: the offset of the first character to add to the ``buffer``
:param item_length: the number of characters to add to the ``buffer``\, or -1 for the
end of ``text`` (assuming it is ``NULL`` terminated)
.. function:: buffer_add_utf16(buffer: ~gi.repository.HarfBuzz.buffer_t, text: list[int], item_offset: int, item_length: int) -> None
See :func:`~gi.repository.HarfBuzz.buffer_add_codepoints`.
Replaces invalid UTF-16 characters with the ``buffer`` replacement code point,
see :func:`~gi.repository.HarfBuzz.buffer_set_replacement_codepoint`.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param text: An array of UTF-16 characters to append
:param item_offset: The offset of the first character to add to the ``buffer``
:param item_length: The number of characters to add to the ``buffer``\, or -1 for the
end of ``text`` (assuming it is ``NULL`` terminated)
.. function:: buffer_add_utf32(buffer: ~gi.repository.HarfBuzz.buffer_t, text: list[int], item_offset: int, item_length: int) -> None
See :func:`~gi.repository.HarfBuzz.buffer_add_codepoints`.
Replaces invalid UTF-32 characters with the ``buffer`` replacement code point,
see :func:`~gi.repository.HarfBuzz.buffer_set_replacement_codepoint`.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param text: An array of UTF-32 characters to append
:param item_offset: The offset of the first character to add to the ``buffer``
:param item_length: The number of characters to add to the ``buffer``\, or -1 for the
end of ``text`` (assuming it is ``NULL`` terminated)
.. function:: buffer_add_utf8(buffer: ~gi.repository.HarfBuzz.buffer_t, text: list[int], item_offset: int, item_length: int) -> None
See :func:`~gi.repository.HarfBuzz.buffer_add_codepoints`.
Replaces invalid UTF-8 characters with the ``buffer`` replacement code point,
see :func:`~gi.repository.HarfBuzz.buffer_set_replacement_codepoint`.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param text: An array of UTF-8
characters to append.
:param item_offset: The offset of the first character to add to the ``buffer``\.
:param item_length: The number of characters to add to the ``buffer``\, or -1 for the
end of ``text`` (assuming it is ``NULL`` terminated).
.. function:: buffer_allocation_successful(buffer: ~gi.repository.HarfBuzz.buffer_t) -> int
Check if allocating memory for the buffer succeeded.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: ``true`` if ``buffer`` memory allocation succeeded, ``false`` otherwise.
.. function:: buffer_append(buffer: ~gi.repository.HarfBuzz.buffer_t, source: ~gi.repository.HarfBuzz.buffer_t, start: int, end: int) -> None
Append (part of) contents of another buffer to this buffer.
.. versionadded:: 1.5.0
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param source: source :obj:`~gi.repository.HarfBuzz.buffer_t`
:param start: start index into source buffer to copy. Use 0 to copy from start of buffer.
:param end: end index into source buffer to copy. Use ``HB_FEATURE_GLOBAL_END`` to copy to end of buffer.
.. function:: buffer_clear_contents(buffer: ~gi.repository.HarfBuzz.buffer_t) -> None
Similar to :func:`~gi.repository.HarfBuzz.buffer_reset`, but does not clear the Unicode functions and
the replacement code point.
.. versionadded:: 0.9.11
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
.. function:: buffer_create() -> ~gi.repository.HarfBuzz.buffer_t
Creates a new :obj:`~gi.repository.HarfBuzz.buffer_t` with all properties to defaults.
.. versionadded:: 0.9.2
:return: A newly allocated :obj:`~gi.repository.HarfBuzz.buffer_t` with a reference count of 1. The initial
reference count should be released with :func:`~gi.repository.HarfBuzz.buffer_destroy` when you are done
using the :obj:`~gi.repository.HarfBuzz.buffer_t`\. This function never returns ``NULL``\. If memory cannot
be allocated, a special :obj:`~gi.repository.HarfBuzz.buffer_t` object will be returned on which
:func:`~gi.repository.HarfBuzz.buffer_allocation_successful` returns ``false``\.
.. function:: buffer_create_similar(src: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.HarfBuzz.buffer_t
Creates a new :obj:`~gi.repository.HarfBuzz.buffer_t`\, similar to :func:`~gi.repository.HarfBuzz.buffer_create`. The only
difference is that the buffer is configured similarly to ``src``\.
.. versionadded:: 3.3.0
:param src: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: A newly allocated :obj:`~gi.repository.HarfBuzz.buffer_t`\, similar to :func:`~gi.repository.HarfBuzz.buffer_create`.
.. function:: buffer_deserialize_glyphs(buffer: ~gi.repository.HarfBuzz.buffer_t, buf: list[str], font: ~gi.repository.HarfBuzz.font_t | None, format: ~gi.repository.HarfBuzz.buffer_serialize_format_t) -> ~typing.Tuple[int, str]
Deserializes glyphs ``buffer`` from textual representation in the format
produced by :func:`~gi.repository.HarfBuzz.buffer_serialize_glyphs`.
.. versionadded:: 0.9.7
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t` buffer.
:param buf: string to deserialize
:param font: font for getting glyph IDs
:param format: the :obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t` of the input ``buf``
:return: ``true`` if parse was successful, ``false`` if an error
occurred.
.. function:: buffer_deserialize_unicode(buffer: ~gi.repository.HarfBuzz.buffer_t, buf: list[str], format: ~gi.repository.HarfBuzz.buffer_serialize_format_t) -> ~typing.Tuple[int, str]
Deserializes Unicode ``buffer`` from textual representation in the format
produced by :func:`~gi.repository.HarfBuzz.buffer_serialize_unicode`.
.. versionadded:: 2.7.3
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t` buffer.
:param buf: string to deserialize
:param format: the :obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t` of the input ``buf``
:return: ``true`` if parse was successful, ``false`` if an error
occurred.
.. function:: buffer_diff(buffer: ~gi.repository.HarfBuzz.buffer_t, reference: ~gi.repository.HarfBuzz.buffer_t, dottedcircle_glyph: int, position_fuzz: int) -> ~gi.repository.HarfBuzz.buffer_diff_flags_t
If dottedcircle_glyph is (hb_codepoint_t) -1 then ``HB_BUFFER_DIFF_FLAG_DOTTED_CIRCLE_PRESENT``
and ``HB_BUFFER_DIFF_FLAG_NOTDEF_PRESENT`` are never returned. This should be used by most
callers if just comparing two buffers is needed.
.. versionadded:: 1.5.0
:param buffer: a buffer.
:param reference: other buffer to compare to.
:param dottedcircle_glyph: glyph id of U+25CC DOTTED CIRCLE, or (hb_codepoint_t) -1.
:param position_fuzz: allowed absolute difference in position values.
.. function:: buffer_get_cluster_level(buffer: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.HarfBuzz.buffer_cluster_level_t
Fetches the cluster level of a buffer. The :obj:`~gi.repository.HarfBuzz.buffer_cluster_level_t`
dictates one aspect of how HarfBuzz will treat non-base characters
during shaping.
.. versionadded:: 0.9.42
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The cluster level of ``buffer``
.. function:: buffer_get_content_type(buffer: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.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).
.. versionadded:: 0.9.5
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The type of ``buffer`` contents
.. function:: buffer_get_direction(buffer: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.HarfBuzz.direction_t
See :func:`~gi.repository.HarfBuzz.buffer_set_direction`
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The direction of the ``buffer``\.
.. function:: buffer_get_empty() -> ~gi.repository.HarfBuzz.buffer_t
Fetches an empty :obj:`~gi.repository.HarfBuzz.buffer_t`\.
.. versionadded:: 0.9.2
:return: The empty buffer
.. function:: buffer_get_flags(buffer: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.HarfBuzz.buffer_flags_t
Fetches the :obj:`~gi.repository.HarfBuzz.buffer_flags_t` of ``buffer``\.
.. versionadded:: 0.9.7
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The ``buffer`` flags
.. function:: buffer_get_glyph_infos(buffer: ~gi.repository.HarfBuzz.buffer_t) -> list[~gi.repository.HarfBuzz.glyph_info_t]
Returns ``buffer`` glyph information array. Returned pointer
is valid as long as ``buffer`` contents are not modified.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The ``buffer`` glyph information array.
The value valid as long as buffer has not been modified.
.. function:: buffer_get_glyph_positions(buffer: ~gi.repository.HarfBuzz.buffer_t) -> list[~gi.repository.HarfBuzz.glyph_position_t]
Returns ``buffer`` glyph position array. Returned pointer
is valid as long as ``buffer`` contents are not modified.
If buffer did not have positions before, the positions will be
initialized to zeros, unless this function is called from
within a buffer message callback (see :func:`~gi.repository.HarfBuzz.buffer_set_message_func`),
in which case ``NULL`` is returned.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The ``buffer`` glyph position array.
The value valid as long as buffer has not been modified.
.. function:: buffer_get_invisible_glyph(buffer: ~gi.repository.HarfBuzz.buffer_t) -> int
See :func:`~gi.repository.HarfBuzz.buffer_set_invisible_glyph`.
.. versionadded:: 2.0.0
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The ``buffer`` invisible :obj:`~gi.repository.HarfBuzz.codepoint_t`
.. function:: buffer_get_language(buffer: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.HarfBuzz.language_t
See :func:`~gi.repository.HarfBuzz.buffer_set_language`.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The :obj:`~gi.repository.HarfBuzz.language_t` of the buffer. Must not be freed by the caller.
.. function:: buffer_get_length(buffer: ~gi.repository.HarfBuzz.buffer_t) -> int
Returns the number of items in the buffer.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The ``buffer`` length.
The value valid as long as buffer has not been modified.
.. function:: buffer_get_not_found_glyph(buffer: ~gi.repository.HarfBuzz.buffer_t) -> int
See :func:`~gi.repository.HarfBuzz.buffer_set_not_found_glyph`.
.. versionadded:: 3.1.0
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The ``buffer`` not-found :obj:`~gi.repository.HarfBuzz.codepoint_t`
.. function:: buffer_get_random_state(buffer: ~gi.repository.HarfBuzz.buffer_t) -> int
See :func:`~gi.repository.HarfBuzz.buffer_set_random_state`.
.. versionadded:: 8.4.0
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The ``buffer`` random state
.. function:: buffer_get_replacement_codepoint(buffer: ~gi.repository.HarfBuzz.buffer_t) -> int
Fetches the :obj:`~gi.repository.HarfBuzz.codepoint_t` that replaces invalid entries for a given encoding
when adding text to ``buffer``\.
.. versionadded:: 0.9.31
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The ``buffer`` replacement :obj:`~gi.repository.HarfBuzz.codepoint_t`
.. function:: buffer_get_script(buffer: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.HarfBuzz.script_t
Fetches the script of ``buffer``\.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The :obj:`~gi.repository.HarfBuzz.script_t` of the ``buffer``
.. function:: buffer_get_segment_properties(buffer: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.HarfBuzz.segment_properties_t
Sets ``props`` to the :obj:`~gi.repository.HarfBuzz.segment_properties_t` of ``buffer``\.
.. versionadded:: 0.9.7
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
.. function:: buffer_get_unicode_funcs(buffer: ~gi.repository.HarfBuzz.buffer_t) -> ~gi.repository.HarfBuzz.unicode_funcs_t
Fetches the Unicode-functions structure of a buffer.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:return: The Unicode-functions structure
.. function:: buffer_guess_segment_properties(buffer: ~gi.repository.HarfBuzz.buffer_t) -> None
Sets unset buffer segment properties based on buffer Unicode
contents. If buffer is not empty, it must have content type
``HB_BUFFER_CONTENT_TYPE_UNICODE``.
If buffer script is not set (ie. is ``HB_SCRIPT_INVALID``), it
will be set to the Unicode script of the first character in
the buffer that has a script other than ``HB_SCRIPT_COMMON``,
``HB_SCRIPT_INHERITED``, and ``HB_SCRIPT_UNKNOWN``.
Next, if buffer direction is not set (ie. is ``HB_DIRECTION_INVALID``),
it will be set to the natural horizontal direction of the
buffer script as returned by :func:`~gi.repository.HarfBuzz.script_get_horizontal_direction`.
If :func:`~gi.repository.HarfBuzz.script_get_horizontal_direction` returns ``HB_DIRECTION_INVALID``,
then ``HB_DIRECTION_LTR`` is used.
Finally, if buffer language is not set (ie. is ``HB_LANGUAGE_INVALID``),
it will be set to the process's default language as returned by
:func:`~gi.repository.HarfBuzz.language_get_default`. This may change in the future by
taking buffer script into consideration when choosing a language.
Note that :func:`~gi.repository.HarfBuzz.language_get_default` is NOT threadsafe the first time
it is called. See documentation for that function for details.
.. versionadded:: 0.9.7
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
.. function:: buffer_has_positions(buffer: ~gi.repository.HarfBuzz.buffer_t) -> int
Returns whether ``buffer`` has glyph position data.
A buffer gains position data when :func:`~gi.repository.HarfBuzz.buffer_get_glyph_positions` is called on it,
and cleared of position data when :func:`~gi.repository.HarfBuzz.buffer_clear_contents` is called.
.. versionadded:: 2.7.3
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t`\.
:return: ``true`` if the ``buffer`` has position array, ``false`` otherwise.
.. function:: buffer_normalize_glyphs(buffer: ~gi.repository.HarfBuzz.buffer_t) -> None
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.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
.. function:: buffer_pre_allocate(buffer: ~gi.repository.HarfBuzz.buffer_t, size: int) -> int
Pre allocates memory for ``buffer`` to fit at least ``size`` number of items.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param size: Number of items to pre allocate.
:return: ``true`` if ``buffer`` memory allocation succeeded, ``false`` otherwise
.. function:: buffer_reset(buffer: ~gi.repository.HarfBuzz.buffer_t) -> None
Resets the buffer to its initial status, as if it was just newly created
with :func:`~gi.repository.HarfBuzz.buffer_create`.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
.. function:: buffer_reverse(buffer: ~gi.repository.HarfBuzz.buffer_t) -> None
Reverses buffer contents.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
.. function:: buffer_reverse_clusters(buffer: ~gi.repository.HarfBuzz.buffer_t) -> None
Reverses buffer clusters. That is, the buffer contents are
reversed, then each cluster (consecutive items having the
same cluster number) are reversed again.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
.. function:: buffer_reverse_range(buffer: ~gi.repository.HarfBuzz.buffer_t, start: int, end: int) -> None
Reverses buffer contents between ``start`` and ``end``\.
.. versionadded:: 0.9.41
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param start: start index
:param end: end index
.. function:: buffer_serialize(buffer: ~gi.repository.HarfBuzz.buffer_t, start: int, end: int, font: ~gi.repository.HarfBuzz.font_t | None, format: ~gi.repository.HarfBuzz.buffer_serialize_format_t, flags: ~gi.repository.HarfBuzz.buffer_serialize_flags_t) -> ~typing.Tuple[int, list[int], 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 :func:`~gi.repository.HarfBuzz.buffer_serialize_unicode` and
:func:`~gi.repository.HarfBuzz.buffer_serialize_glyphs` for a description of the output format.
.. versionadded:: 2.7.3
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t` buffer.
:param start: the first item in ``buffer`` to serialize.
:param end: the last item in ``buffer`` to serialize.
:param font: the :obj:`~gi.repository.HarfBuzz.font_t` used to shape this buffer, needed to
read glyph names and extents. If ``NULL``\, an empty font will be used.
:param format: the :obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t` to use for formatting the output.
:param flags: the :obj:`~gi.repository.HarfBuzz.buffer_serialize_flags_t` that control what glyph properties
to serialize.
:return: The number of serialized items.
.. function:: buffer_serialize_format_from_string(str: list[int]) -> ~gi.repository.HarfBuzz.buffer_serialize_format_t
Parses a string into an :obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t`\. Does not check if
``str`` is a valid buffer serialization format, use
:func:`~gi.repository.HarfBuzz.buffer_serialize_list_formats` to get the list of supported formats.
.. versionadded:: 0.9.7
:param str: a string to parse
:return: The parsed :obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t`\.
.. function:: buffer_serialize_format_to_string(format: ~gi.repository.HarfBuzz.buffer_serialize_format_t) -> str
Converts ``format`` to the string corresponding it, or ``NULL`` if it is not a valid
:obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t`\.
.. versionadded:: 0.9.7
:param format: an :obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t` to convert.
:return: A ``NULL`` terminated string corresponding to ``format``\. Should not be freed.
.. function:: buffer_serialize_glyphs(buffer: ~gi.repository.HarfBuzz.buffer_t, start: int, end: int, font: ~gi.repository.HarfBuzz.font_t | None, format: ~gi.repository.HarfBuzz.buffer_serialize_format_t, flags: ~gi.repository.HarfBuzz.buffer_serialize_flags_t) -> ~typing.Tuple[int, list[int], 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:
.. code-block::
:dedent:
[uni0651=0@518,0+0|uni0628=0+1897]
- The serialized glyphs are delimited with ``[`` and ``]``\.
- Glyphs are separated with ``|``
- Each glyph starts with glyph name, or glyph index if
``HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES`` flag is set. Then,
- If ``HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS`` is not set, ``=`` then :obj:`~gi.repository.HarfBuzz.glyph_info_t`\.cluster.
- If is not set, the :obj:`~gi.repository.HarfBuzz.glyph_position_t` in the format:- If both :obj:`~gi.repository.HarfBuzz.glyph_position_t`\.x_offset and :obj:`~gi.repository.HarfBuzz.glyph_position_t`\.y_offset are not 0, ``@x_offset,y_offset``\. Then,
- ``+x_advance``\, then ``,y_advance`` if :obj:`~gi.repository.HarfBuzz.glyph_position_t`\.y_advance is not 0. Then,
- If ``HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS`` is set, the :obj:`~gi.repository.HarfBuzz.glyph_extents_t` in the format ````
json
--------------------------------------------------------------------------------
A machine-readable, structured format.
The serialized glyphs will look something like:
.. code-block::
:dedent:
[{"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:
- ``g``\: the glyph name or glyph index if
``HB_BUFFER_SERIALIZE_FLAG_NO_GLYPH_NAMES`` flag is set.
- ``cl``\: :obj:`~gi.repository.HarfBuzz.glyph_info_t`\.cluster if
``HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS`` is not set.
- ``dx``\,``dy``\,``ax``\,``ay``\: :obj:`~gi.repository.HarfBuzz.glyph_position_t`\.x_offset, :obj:`~gi.repository.HarfBuzz.glyph_position_t`\.y_offset,
:obj:`~gi.repository.HarfBuzz.glyph_position_t`\.x_advance and :obj:`~gi.repository.HarfBuzz.glyph_position_t`\.y_advance
respectively, if ``HB_BUFFER_SERIALIZE_FLAG_NO_POSITIONS`` is not set.
- ``xb``\,``yb``\,``w``\,``h``\: :obj:`~gi.repository.HarfBuzz.glyph_extents_t`\.x_bearing, :obj:`~gi.repository.HarfBuzz.glyph_extents_t`\.y_bearing,
:obj:`~gi.repository.HarfBuzz.glyph_extents_t`\.width and :obj:`~gi.repository.HarfBuzz.glyph_extents_t`\.height respectively if
``HB_BUFFER_SERIALIZE_FLAG_GLYPH_EXTENTS`` is set.
.. versionadded:: 0.9.7
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t` buffer.
:param start: the first item in ``buffer`` to serialize.
:param end: the last item in ``buffer`` to serialize.
:param font: the :obj:`~gi.repository.HarfBuzz.font_t` used to shape this buffer, needed to
read glyph names and extents. If ``NULL``\, an empty font will be used.
:param format: the :obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t` to use for formatting the output.
:param flags: the :obj:`~gi.repository.HarfBuzz.buffer_serialize_flags_t` that control what glyph properties
to serialize.
:return: The number of serialized items.
.. function:: buffer_serialize_list_formats() -> list[str]
Returns a list of supported buffer serialization formats.
.. versionadded:: 0.9.7
:return: A string array of buffer serialization formats. Should not be freed.
.. function:: buffer_serialize_unicode(buffer: ~gi.repository.HarfBuzz.buffer_t, start: int, end: int, format: ~gi.repository.HarfBuzz.buffer_serialize_format_t, flags: ~gi.repository.HarfBuzz.buffer_serialize_flags_t) -> ~typing.Tuple[int, list[int], 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:
.. code-block::
:dedent:
- Glyphs are separated with ``|``
- Unicode codepoints are expressed as zero-padded four (or more)
digit hexadecimal numbers preceded by ``U+``
- If ``HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS`` is not set, the cluster
will be indicated with a ``=`` then :obj:`~gi.repository.HarfBuzz.glyph_info_t`\.cluster.
json
--------------------------------------------------------------------------------
A machine-readable, structured format.
The serialized codepoints will be a list of objects with the following
properties:
- ``u``\: the Unicode codepoint as a decimal integer
- ``cl``\: :obj:`~gi.repository.HarfBuzz.glyph_info_t`\.cluster if
``HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS`` is not set.
For example:
.. code-block::
:dedent:
[{u:1617,cl:0},{u:1576,cl:1}]
.. versionadded:: 2.7.3
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t` buffer.
:param start: the first item in ``buffer`` to serialize.
:param end: the last item in ``buffer`` to serialize.
:param format: the :obj:`~gi.repository.HarfBuzz.buffer_serialize_format_t` to use for formatting the output.
:param flags: the :obj:`~gi.repository.HarfBuzz.buffer_serialize_flags_t` that control what glyph properties
to serialize.
:return: The number of serialized items.
.. function:: buffer_set_cluster_level(buffer: ~gi.repository.HarfBuzz.buffer_t, cluster_level: ~gi.repository.HarfBuzz.buffer_cluster_level_t) -> None
Sets the cluster level of a buffer. The :obj:`~gi.repository.HarfBuzz.buffer_cluster_level_t`
dictates one aspect of how HarfBuzz will treat non-base characters
during shaping.
.. versionadded:: 0.9.42
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param cluster_level: The cluster level to set on the buffer
.. function:: buffer_set_content_type(buffer: ~gi.repository.HarfBuzz.buffer_t, content_type: ~gi.repository.HarfBuzz.buffer_content_type_t) -> None
Sets the type of ``buffer`` contents. Buffers are either empty, contain
characters (before shaping), or contain glyphs (the result of shaping).
You rarely need to call this function, since a number of other
functions transition the content type for you. Namely:
- A newly created buffer starts with content type
:const:`~gi.repository.HarfBuzz.buffer_content_type_t.INVALID`. Calling :func:`~gi.repository.HarfBuzz.buffer_reset`,
:func:`~gi.repository.HarfBuzz.buffer_clear_contents`, as well as calling :func:`~gi.repository.HarfBuzz.buffer_set_length`
with an argument of zero all set the buffer content type to invalid
as well.
- Calling :func:`~gi.repository.HarfBuzz.buffer_add_utf8`, :func:`~gi.repository.HarfBuzz.buffer_add_utf16`,
:func:`~gi.repository.HarfBuzz.buffer_add_utf32`, :func:`~gi.repository.HarfBuzz.buffer_add_codepoints` and
:func:`~gi.repository.HarfBuzz.buffer_add_latin1` expect that buffer is either empty and
have a content type of invalid, or that buffer content type is
:const:`~gi.repository.HarfBuzz.buffer_content_type_t.UNICODE`, and they also set the content
type to Unicode if they added anything to an empty buffer.
- Finally :func:`~gi.repository.HarfBuzz.shape` and :func:`~gi.repository.HarfBuzz.shape_full` expect that the buffer
is either empty and have content type of invalid, or that buffer
content type is :const:`~gi.repository.HarfBuzz.buffer_content_type_t.UNICODE`, and upon
success they set the buffer content type to
:const:`~gi.repository.HarfBuzz.buffer_content_type_t.GLYPHS`.
The above transitions are designed such that one can use a buffer
in a loop of "reset : add-text : shape" without needing to ever
modify the content type manually.
.. versionadded:: 0.9.5
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param content_type: The type of buffer contents to set
.. function:: buffer_set_direction(buffer: ~gi.repository.HarfBuzz.buffer_t, direction: ~gi.repository.HarfBuzz.direction_t) -> None
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.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param direction: the :obj:`~gi.repository.HarfBuzz.direction_t` of the ``buffer``
.. function:: buffer_set_flags(buffer: ~gi.repository.HarfBuzz.buffer_t, flags: ~gi.repository.HarfBuzz.buffer_flags_t) -> None
Sets ``buffer`` flags to ``flags``\. See :obj:`~gi.repository.HarfBuzz.buffer_flags_t`\.
.. versionadded:: 0.9.7
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param flags: The buffer flags to set
.. function:: buffer_set_invisible_glyph(buffer: ~gi.repository.HarfBuzz.buffer_t, invisible: int) -> None
Sets the :obj:`~gi.repository.HarfBuzz.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.
.. versionadded:: 2.0.0
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param invisible: the invisible :obj:`~gi.repository.HarfBuzz.codepoint_t`
.. function:: buffer_set_language(buffer: ~gi.repository.HarfBuzz.buffer_t, language: ~gi.repository.HarfBuzz.language_t) -> None
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 :func:`~gi.repository.HarfBuzz.language_from_string` to convert from BCP 47 language tags to
:obj:`~gi.repository.HarfBuzz.language_t`\.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param language: An hb_language_t to set
.. function:: buffer_set_length(buffer: ~gi.repository.HarfBuzz.buffer_t, length: int) -> int
Similar to :func:`~gi.repository.HarfBuzz.buffer_pre_allocate`, but clears any new items added at the
end.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param length: The new length of ``buffer``
:return: ``true`` if ``buffer`` memory allocation succeeded, ``false`` otherwise.
.. function:: buffer_set_message_func(buffer: ~gi.repository.HarfBuzz.buffer_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.buffer_t, ~gi.repository.HarfBuzz.font_t, str, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.buffer_message_func_t`\.
.. versionadded:: 1.1.3
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param func: Callback function
:param user_data: Data to pass to ``func``
.. function:: buffer_set_not_found_glyph(buffer: ~gi.repository.HarfBuzz.buffer_t, not_found: int) -> None
Sets the :obj:`~gi.repository.HarfBuzz.codepoint_t` that replaces characters not found in
the font during shaping.
The not-found glyph defaults to zero, sometimes known as the
".notdef" glyph. This API allows for differentiating the two.
.. versionadded:: 3.1.0
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param not_found: the not-found :obj:`~gi.repository.HarfBuzz.codepoint_t`
.. function:: buffer_set_random_state(buffer: ~gi.repository.HarfBuzz.buffer_t, state: int) -> None
Sets the random state of the buffer. The state changes
every time a glyph uses randomness (eg. the ``rand``
OpenType feature). This function together with
:func:`~gi.repository.HarfBuzz.buffer_get_random_state` allow for transferring
the current random state to a subsequent buffer, to
get better randomness distribution.
Defaults to 1 and when buffer contents are cleared.
A value of 0 disables randomness during shaping.
.. versionadded:: 8.4.0
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param state: the new random state
.. function:: buffer_set_replacement_codepoint(buffer: ~gi.repository.HarfBuzz.buffer_t, replacement: int) -> None
Sets the :obj:`~gi.repository.HarfBuzz.codepoint_t` that replaces invalid entries for a given encoding
when adding text to ``buffer``\.
Default is ``HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT``.
.. versionadded:: 0.9.31
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param replacement: the replacement :obj:`~gi.repository.HarfBuzz.codepoint_t`
.. function:: buffer_set_script(buffer: ~gi.repository.HarfBuzz.buffer_t, script: ~gi.repository.HarfBuzz.script_t) -> None
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 :obj:`~gi.repository.HarfBuzz.script_t` values, or use
:func:`~gi.repository.HarfBuzz.script_from_string` or :func:`~gi.repository.HarfBuzz.script_from_iso15924_tag` to get the
corresponding script from an ISO 15924 script tag.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param script: An :obj:`~gi.repository.HarfBuzz.script_t` to set.
.. function:: buffer_set_segment_properties(buffer: ~gi.repository.HarfBuzz.buffer_t, props: ~gi.repository.HarfBuzz.segment_properties_t) -> None
Sets the segment properties of the buffer, a shortcut for calling
:func:`~gi.repository.HarfBuzz.buffer_set_direction`, :func:`~gi.repository.HarfBuzz.buffer_set_script` and
:func:`~gi.repository.HarfBuzz.buffer_set_language` individually.
.. versionadded:: 0.9.7
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param props: An :obj:`~gi.repository.HarfBuzz.segment_properties_t` to use
.. function:: buffer_set_unicode_funcs(buffer: ~gi.repository.HarfBuzz.buffer_t, unicode_funcs: ~gi.repository.HarfBuzz.unicode_funcs_t) -> None
Sets the Unicode-functions structure of a buffer to
``unicode_funcs``\.
.. versionadded:: 0.9.2
:param buffer: An :obj:`~gi.repository.HarfBuzz.buffer_t`
:param unicode_funcs: The Unicode-functions structure
.. function:: color_get_alpha(color: int) -> int
Fetches the alpha channel of the given ``color``\.
.. versionadded:: 2.1.0
:param color: an :obj:`~gi.repository.HarfBuzz.color_t` we are interested in its channels.
:return: Alpha channel value
.. function:: color_get_blue(color: int) -> int
Fetches the blue channel of the given ``color``\.
.. versionadded:: 2.1.0
:param color: an :obj:`~gi.repository.HarfBuzz.color_t` we are interested in its channels.
:return: Blue channel value
.. function:: color_get_green(color: int) -> int
Fetches the green channel of the given ``color``\.
.. versionadded:: 2.1.0
:param color: an :obj:`~gi.repository.HarfBuzz.color_t` we are interested in its channels.
:return: Green channel value
.. function:: color_get_red(color: int) -> int
Fetches the red channel of the given ``color``\.
.. versionadded:: 2.1.0
:param color: an :obj:`~gi.repository.HarfBuzz.color_t` we are interested in its channels.
:return: Red channel value
.. function:: color_line_get_color_stops(color_line: ~gi.repository.HarfBuzz.color_line_t, start: int) -> ~typing.Tuple[int, list[~gi.repository.HarfBuzz.color_stop_t]]
Fetches a list of color stops from the given color line object.
Note that due to variations being applied, the returned color stops
may be out of order. It is the callers responsibility to ensure that
color stops are sorted by their offset before they are used.
.. versionadded:: 7.0.0
:param color_line: a :obj:`~gi.repository.HarfBuzz.color_line_t` object
:param start: the index of the first color stop to return
:return: the total number of color stops in ``color_line``
.. function:: color_line_get_extend(color_line: ~gi.repository.HarfBuzz.color_line_t) -> ~gi.repository.HarfBuzz.paint_extend_t
Fetches the extend mode of the color line object.
.. versionadded:: 7.0.0
:param color_line: a :obj:`~gi.repository.HarfBuzz.color_line_t` object
:return: the extend mode of ``color_line``
.. function:: direction_from_string(str: list[int]) -> ~gi.repository.HarfBuzz.direction_t
Converts a string to an :obj:`~gi.repository.HarfBuzz.direction_t`\.
Matching is loose and applies only to the first letter. For
examples, "LTR" and "left-to-right" will both return ``HB_DIRECTION_LTR``.
Unmatched strings will return ``HB_DIRECTION_INVALID``.
.. versionadded:: 0.9.2
:param str: String to convert
:return: The :obj:`~gi.repository.HarfBuzz.direction_t` matching ``str``
.. function:: direction_to_string(direction: ~gi.repository.HarfBuzz.direction_t) -> str
Converts an :obj:`~gi.repository.HarfBuzz.direction_t` to a string.
.. versionadded:: 0.9.2
:param direction: The :obj:`~gi.repository.HarfBuzz.direction_t` to convert
:return: The string corresponding to ``direction``
.. function:: draw_close_path(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, draw_data: ~typing.Any, st: ~gi.repository.HarfBuzz.draw_state_t) -> None
Perform a "close-path" draw operation.
.. versionadded:: 4.0.0
:param dfuncs: draw functions
:param draw_data: associated draw data passed by the caller
:param st: current draw state
.. function:: draw_cubic_to(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, draw_data: ~typing.Any, st: ~gi.repository.HarfBuzz.draw_state_t, control1_x: float, control1_y: float, control2_x: float, control2_y: float, to_x: float, to_y: float) -> None
Perform a "cubic-to" draw operation.
.. versionadded:: 4.0.0
:param dfuncs: draw functions
:param draw_data: associated draw data passed by the caller
:param st: current draw state
:param control1_x: X component of first control point
:param control1_y: Y component of first control point
:param control2_x: X component of second control point
:param control2_y: Y component of second control point
:param to_x: X component of target point
:param to_y: Y component of target point
.. function:: draw_funcs_create() -> ~gi.repository.HarfBuzz.draw_funcs_t
Creates a new draw callbacks object.
.. versionadded:: 4.0.0
:return: A newly allocated :obj:`~gi.repository.HarfBuzz.draw_funcs_t` with a reference count of 1. The initial
reference count should be released with hb_draw_funcs_destroy when you are
done using the :obj:`~gi.repository.HarfBuzz.draw_funcs_t`\. This function never returns ``NULL``\. If
memory cannot be allocated, a special singleton :obj:`~gi.repository.HarfBuzz.draw_funcs_t` object will
be returned.
.. function:: draw_funcs_get_empty() -> ~gi.repository.HarfBuzz.draw_funcs_t
Fetches the singleton empty draw-functions structure.
.. versionadded:: 7.0.0
:return: The empty draw-functions structure
.. function:: draw_funcs_is_immutable(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t) -> int
Checks whether ``dfuncs`` is immutable.
.. versionadded:: 4.0.0
:param dfuncs: draw functions
:return: ``true`` if ``dfuncs`` is immutable, ``false`` otherwise
.. function:: draw_funcs_make_immutable(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t) -> None
Makes ``dfuncs`` object immutable.
.. versionadded:: 4.0.0
:param dfuncs: draw functions
.. function:: draw_funcs_set_close_path_func(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.draw_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.draw_state_t, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets close-path callback to the draw functions object.
.. versionadded:: 4.0.0
:param dfuncs: draw functions object
:param func: close-path callback
:param user_data: Data to pass to ``func``
.. function:: draw_funcs_set_cubic_to_func(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.draw_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.draw_state_t, float, float, float, float, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets cubic-to callback to the draw functions object.
.. versionadded:: 4.0.0
:param dfuncs: draw functions
:param func: cubic-to callback
:param user_data: Data to pass to ``func``
.. function:: draw_funcs_set_line_to_func(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.draw_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.draw_state_t, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets line-to callback to the draw functions object.
.. versionadded:: 4.0.0
:param dfuncs: draw functions object
:param func: line-to callback
:param user_data: Data to pass to ``func``
.. function:: draw_funcs_set_move_to_func(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.draw_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.draw_state_t, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets move-to callback to the draw functions object.
.. versionadded:: 4.0.0
:param dfuncs: draw functions object
:param func: move-to callback
:param user_data: Data to pass to ``func``
.. function:: draw_funcs_set_quadratic_to_func(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.draw_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.draw_state_t, float, float, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets quadratic-to callback to the draw functions object.
.. versionadded:: 4.0.0
:param dfuncs: draw functions object
:param func: quadratic-to callback
:param user_data: Data to pass to ``func``
.. function:: draw_line_to(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, draw_data: ~typing.Any, st: ~gi.repository.HarfBuzz.draw_state_t, to_x: float, to_y: float) -> None
Perform a "line-to" draw operation.
.. versionadded:: 4.0.0
:param dfuncs: draw functions
:param draw_data: associated draw data passed by the caller
:param st: current draw state
:param to_x: X component of target point
:param to_y: Y component of target point
.. function:: draw_move_to(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, draw_data: ~typing.Any, st: ~gi.repository.HarfBuzz.draw_state_t, to_x: float, to_y: float) -> None
Perform a "move-to" draw operation.
.. versionadded:: 4.0.0
:param dfuncs: draw functions
:param draw_data: associated draw data passed by the caller
:param st: current draw state
:param to_x: X component of target point
:param to_y: Y component of target point
.. function:: draw_quadratic_to(dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, draw_data: ~typing.Any, st: ~gi.repository.HarfBuzz.draw_state_t, control_x: float, control_y: float, to_x: float, to_y: float) -> None
Perform a "quadratic-to" draw operation.
.. versionadded:: 4.0.0
:param dfuncs: draw functions
:param draw_data: associated draw data passed by the caller
:param st: current draw state
:param control_x: X component of control point
:param control_y: Y component of control point
:param to_x: X component of target point
:param to_y: Y component of target point
.. function:: face_builder_add_table(face: ~gi.repository.HarfBuzz.face_t, tag: int, blob: ~gi.repository.HarfBuzz.blob_t) -> int
Add table for ``tag`` with data provided by ``blob`` to the face. ``face`` must
be created using :func:`~gi.repository.HarfBuzz.face_builder_create`.
.. versionadded:: 1.9.0
:param face: A face object created with :func:`~gi.repository.HarfBuzz.face_builder_create`
:param tag: The :obj:`~gi.repository.HarfBuzz.tag_t` of the table to add
:param blob: The blob containing the table data to add
.. function:: face_builder_create() -> ~gi.repository.HarfBuzz.face_t
Creates a :obj:`~gi.repository.HarfBuzz.face_t` that can be used with :func:`~gi.repository.HarfBuzz.face_builder_add_table`.
After tables are added to the face, it can be compiled to a binary
font file by calling :func:`~gi.repository.HarfBuzz.face_reference_blob`.
.. versionadded:: 1.9.0
:return: New face.
.. function:: face_builder_sort_tables(face: ~gi.repository.HarfBuzz.face_t, tags: list[int]) -> None
Set the ordering of tables for serialization. Any tables not
specified in the tags list will be ordered after the tables in
tags, ordered by the default sort ordering.
.. versionadded:: 5.3.0
:param face: A face object created with :func:`~gi.repository.HarfBuzz.face_builder_create`
:param tags: ordered list of table tags terminated by
%HB_TAG_NONE
.. function:: face_collect_nominal_glyph_mapping(face: ~gi.repository.HarfBuzz.face_t) -> ~typing.Tuple[~gi.repository.HarfBuzz.map_t, ~gi.repository.HarfBuzz.set_t | None]
Collects the mapping from Unicode characters to nominal glyphs of the ``face``\,
and optionally all of the Unicode characters covered by ``face``\.
.. versionadded:: 7.0.0
:param face: A face object
.. function:: face_collect_unicodes(face: ~gi.repository.HarfBuzz.face_t) -> ~gi.repository.HarfBuzz.set_t
Collects all of the Unicode characters covered by ``face`` and adds
them to the :obj:`~gi.repository.HarfBuzz.set_t` set ``out``\.
.. versionadded:: 1.9.0
:param face: A face object
.. function:: face_collect_variation_selectors(face: ~gi.repository.HarfBuzz.face_t) -> ~gi.repository.HarfBuzz.set_t
Collects all Unicode "Variation Selector" characters covered by ``face`` and adds
them to the :obj:`~gi.repository.HarfBuzz.set_t` set ``out``\.
.. versionadded:: 1.9.0
:param face: A face object
.. function:: face_collect_variation_unicodes(face: ~gi.repository.HarfBuzz.face_t, variation_selector: int) -> ~gi.repository.HarfBuzz.set_t
Collects all Unicode characters for ``variation_selector`` covered by ``face`` and adds
them to the :obj:`~gi.repository.HarfBuzz.set_t` set ``out``\.
.. versionadded:: 1.9.0
:param face: A face object
:param variation_selector: The Variation Selector to query
.. function:: face_count(blob: ~gi.repository.HarfBuzz.blob_t) -> int
Fetches the number of faces in a blob.
.. versionadded:: 1.7.7
:param blob: a blob.
:return: Number of faces in ``blob``
.. function:: face_create(blob: ~gi.repository.HarfBuzz.blob_t, index: int) -> ~gi.repository.HarfBuzz.face_t
Constructs a new face object from the specified blob and
a face index into that blob.
The face index is used for blobs of file formats such as TTC and
DFont that can contain more than one face. Face indices within
such collections are zero-based.
Note: If the blob font format is not a collection, ``index``
is ignored. Otherwise, only the lower 16-bits of ``index`` are used.
The unmodified ``index`` can be accessed via :func:`~gi.repository.HarfBuzz.face_get_index`.
Note: The high 16-bits of ``index``\, if non-zero, are used by
:func:`~gi.repository.HarfBuzz.font_create` to load named-instances in variable fonts. See
:func:`~gi.repository.HarfBuzz.font_create` for details.
.. versionadded:: 0.9.2
:param blob: :obj:`~gi.repository.HarfBuzz.blob_t` to work upon
:param index: The index of the face within ``blob``
:return: The new face object
.. function:: face_create_for_tables(reference_table_func: ~typing.Callable[[~gi.repository.HarfBuzz.face_t, int, ~typing.Any], ~gi.repository.HarfBuzz.blob_t], user_data: ~typing.Any = None) -> ~gi.repository.HarfBuzz.face_t
Variant of :func:`~gi.repository.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 :func:`~gi.repository.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.
.. versionadded:: 0.9.2
:param reference_table_func: Table-referencing function
:param user_data: A pointer to the user data
:return: The new face object
.. function:: face_get_empty() -> ~gi.repository.HarfBuzz.face_t
Fetches the singleton empty face object.
.. versionadded:: 0.9.2
:return: The empty face object
.. function:: face_get_glyph_count(face: ~gi.repository.HarfBuzz.face_t) -> int
Fetches the glyph-count value of the specified face object.
.. versionadded:: 0.9.7
:param face: A face object
:return: The glyph-count value of ``face``
.. function:: face_get_index(face: ~gi.repository.HarfBuzz.face_t) -> int
Fetches the face-index corresponding to the given face.
Note: face indices within a collection are zero-based.
.. versionadded:: 0.9.2
:param face: A face object
:return: The index of ``face``\.
.. function:: face_get_table_tags(face: ~gi.repository.HarfBuzz.face_t, start_offset: int) -> ~typing.Tuple[int, list[int]]
Fetches a list of all table tags for a face, if possible. The list returned will
begin at the offset provided
.. versionadded:: 1.6.0
:param face: A face object
:param start_offset: The index of first table tag to retrieve
:return: Total number of tables, or zero if it is not possible to list
.. function:: face_get_upem(face: ~gi.repository.HarfBuzz.face_t) -> int
Fetches the units-per-em (UPEM) value of the specified face object.
Typical UPEM values for fonts are 1000, or 2048, but any value
in between 16 and 16,384 is allowed for OpenType fonts.
.. versionadded:: 0.9.2
:param face: A face object
:return: The upem value of ``face``
.. function:: face_is_immutable(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether the given face object is immutable.
.. versionadded:: 0.9.2
:param face: A face object
:return: ``true`` is ``face`` is immutable, ``false`` otherwise
.. function:: face_make_immutable(face: ~gi.repository.HarfBuzz.face_t) -> None
Makes the given face object immutable.
.. versionadded:: 0.9.2
:param face: A face object
.. function:: face_reference_blob(face: ~gi.repository.HarfBuzz.face_t) -> ~gi.repository.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.
.. versionadded:: 0.9.2
:param face: A face object
:return: A pointer to the blob for ``face``
.. function:: face_reference_table(face: ~gi.repository.HarfBuzz.face_t, tag: int) -> ~gi.repository.HarfBuzz.blob_t
Fetches a reference to the specified table within
the specified face.
.. versionadded:: 0.9.2
:param face: A face object
:param tag: The :obj:`~gi.repository.HarfBuzz.tag_t` of the table to query
:return: A pointer to the ``tag`` table within ``face``
.. function:: face_set_glyph_count(face: ~gi.repository.HarfBuzz.face_t, glyph_count: int) -> None
Sets the glyph count for a face object to the specified value.
This API is used in rare circumstances.
.. versionadded:: 0.9.7
:param face: A face object
:param glyph_count: The glyph-count value to assign
.. function:: face_set_index(face: ~gi.repository.HarfBuzz.face_t, index: int) -> None
Assigns the specified face-index to ``face``\. Fails if the
face is immutable.
Note: changing the index has no effect on the face itself
This only changes the value returned by :func:`~gi.repository.HarfBuzz.face_get_index`.
.. versionadded:: 0.9.2
:param face: A face object
:param index: The index to assign
.. function:: face_set_upem(face: ~gi.repository.HarfBuzz.face_t, upem: int) -> None
Sets the units-per-em (upem) for a face object to the specified value.
This API is used in rare circumstances.
.. versionadded:: 0.9.2
:param face: A face object
:param upem: The units-per-em value to assign
.. function:: feature_from_string(str: list[int]) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.feature_t]
Parses a string into a :obj:`~gi.repository.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 char
Mixing it all:
aalt[3:5]=2 2 3 5 Turn 2nd alternate on for range
.. versionadded:: 0.9.5
:param str: a string to parse
:return: ``true`` if ``str`` is successfully parsed, ``false`` otherwise
.. function:: feature_to_string(feature: ~gi.repository.HarfBuzz.feature_t) -> list[str]
Converts a :obj:`~gi.repository.HarfBuzz.feature_t` into a ``NULL``\-terminated string in the format
understood by :func:`~gi.repository.HarfBuzz.feature_from_string`. The client in responsible for
allocating big enough size for ``buf``\, 128 bytes is more than enough.
.. versionadded:: 0.9.5
:param feature: an :obj:`~gi.repository.HarfBuzz.feature_t` to convert
.. function:: font_add_glyph_origin_for_direction(font: ~gi.repository.HarfBuzz.font_t, glyph: int, direction: ~gi.repository.HarfBuzz.direction_t, x: int, y: int) -> ~typing.Tuple[int, 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``\.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:param direction: The direction of the text segment
:param x: Input = The original X coordinate
Output = The X coordinate plus the X-coordinate of the origin
:param y: Input = The original Y coordinate
Output = The Y coordinate plus the Y-coordinate of the origin
.. function:: font_changed(font: ~gi.repository.HarfBuzz.font_t) -> None
Notifies the ``font`` that underlying font data has changed.
This has the effect of increasing the serial as returned
by :func:`~gi.repository.HarfBuzz.font_get_serial`, which invalidates internal caches.
.. versionadded:: 4.4.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
.. function:: font_create(face: ~gi.repository.HarfBuzz.face_t) -> ~gi.repository.HarfBuzz.font_t
Constructs a new font object from the specified face.
Note: If ``face``\'s index value (as passed to :func:`~gi.repository.HarfBuzz.face_create`
has non-zero top 16-bits, those bits minus one are passed to
:func:`~gi.repository.HarfBuzz.font_set_var_named_instance`, effectively loading a named-instance
of a variable font, instead of the default-instance. This allows
specifying which named-instance to load by default when creating the
face.
.. versionadded:: 0.9.2
:param face: a face.
:return: The new font object
.. function:: font_create_sub_font(parent: ~gi.repository.HarfBuzz.font_t) -> ~gi.repository.HarfBuzz.font_t
Constructs a sub-font font object from the specified ``parent`` font,
replicating the parent's properties.
.. versionadded:: 0.9.2
:param parent: The parent font object
:return: The new sub-font font object
.. function:: font_draw_glyph(font: ~gi.repository.HarfBuzz.font_t, glyph: int, dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, draw_data: ~typing.Any = None) -> None
Draws the outline that corresponds to a glyph in the specified ``font``\.
The outline is returned by way of calls to the callbacks of the ``dfuncs``
objects, with ``draw_data`` passed to them.
.. versionadded:: 7.0.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID
:param dfuncs: :obj:`~gi.repository.HarfBuzz.draw_funcs_t` to draw to
:param draw_data: User data to pass to draw callbacks
.. function:: font_funcs_create() -> ~gi.repository.HarfBuzz.font_funcs_t
Creates a new :obj:`~gi.repository.HarfBuzz.font_funcs_t` structure of font functions.
.. versionadded:: 0.9.2
:return: The font-functions structure
.. function:: font_funcs_get_empty() -> ~gi.repository.HarfBuzz.font_funcs_t
Fetches an empty font-functions structure.
.. versionadded:: 0.9.2
:return: The font-functions structure
.. function:: font_funcs_is_immutable(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t) -> int
Tests whether a font-functions structure is immutable.
.. versionadded:: 0.9.2
:param ffuncs: The font-functions structure
:return: ``true`` if ``ffuncs`` is immutable, ``false`` otherwise
.. function:: font_funcs_make_immutable(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t) -> None
Makes a font-functions structure immutable.
.. versionadded:: 0.9.2
:param ffuncs: The font-functions structure
.. function:: font_funcs_set_draw_glyph_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~gi.repository.HarfBuzz.draw_funcs_t, ~typing.Any, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_draw_glyph_func_t`\.
.. versionadded:: 7.0.0
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_font_h_extents_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, ~typing.Any], ~typing.Tuple[int, ~gi.repository.HarfBuzz.font_extents_t]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_font_h_extents_func_t`\.
.. versionadded:: 1.1.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_font_v_extents_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, ~typing.Any], ~typing.Tuple[int, ~gi.repository.HarfBuzz.font_extents_t]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_font_v_extents_func_t`\.
.. versionadded:: 1.1.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_contour_point_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, int, ~typing.Any], ~typing.Tuple[int, int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_contour_point_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_extents_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~typing.Any], ~typing.Tuple[int, ~gi.repository.HarfBuzz.glyph_extents_t]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_extents_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_from_name_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, list[str], ~typing.Any], ~typing.Tuple[int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_from_name_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, int, ~typing.Any], ~typing.Tuple[int, int]], user_data: ~typing.Any = None) -> None
Deprecated. Use :func:`~gi.repository.HarfBuzz.font_funcs_set_nominal_glyph_func` and
:func:`~gi.repository.HarfBuzz.font_funcs_set_variation_glyph_func` instead.
.. versionadded:: 0.9.2
.. deprecated:: 1.2.3
Please do not use it in newly written code
:param ffuncs: The font-functions structure
:param func: callback function
:param user_data: data to pass to ``func``
.. function:: font_funcs_set_glyph_h_advance_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_h_advance_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_h_advances_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, int, int, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_h_advances_func_t`\.
.. versionadded:: 1.8.6
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_h_kerning_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_h_kerning_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_h_origin_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~typing.Any], ~typing.Tuple[int, int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_h_origin_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_name_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~typing.Any], ~typing.Tuple[int, list[str]]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_name_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_shape_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~gi.repository.HarfBuzz.draw_funcs_t, ~typing.Any, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_shape_func_t`\,
which is the same as :obj:`~gi.repository.HarfBuzz.font_draw_glyph_func_t`\.
.. versionadded:: 4.0.0
.. deprecated:: 7.0.0
Use :func:`~gi.repository.HarfBuzz.font_funcs_set_draw_glyph_func` instead
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_v_advance_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_v_advance_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_v_advances_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, int, int, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_v_advances_func_t`\.
.. versionadded:: 1.8.6
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_v_kerning_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_v_kerning_func_t`\.
.. versionadded:: 0.9.2
.. deprecated:: 2.0.0
Please do not use it in newly written code
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_glyph_v_origin_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~typing.Any], ~typing.Tuple[int, int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_glyph_v_origin_func_t`\.
.. versionadded:: 0.9.2
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_nominal_glyph_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~typing.Any], ~typing.Tuple[int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_nominal_glyph_func_t`\.
.. versionadded:: 1.2.3
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_nominal_glyphs_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, int, int, int, ~typing.Any], ~typing.Tuple[int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_nominal_glyphs_func_t`\.
.. versionadded:: 2.0.0
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_paint_glyph_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, ~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, int, int, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_paint_glyph_func_t`\.
.. versionadded:: 7.0.0
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_funcs_set_variation_glyph_func(ffuncs: ~gi.repository.HarfBuzz.font_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.font_t, ~typing.Any, int, int, ~typing.Any], ~typing.Tuple[int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.font_get_variation_glyph_func_t`\.
.. versionadded:: 1.2.3
:param ffuncs: A font-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: font_get_empty() -> ~gi.repository.HarfBuzz.font_t
Fetches the empty font object.
.. versionadded:: 0.9.2
:return: The empty font object
.. function:: font_get_extents_for_direction(font: ~gi.repository.HarfBuzz.font_t, direction: ~gi.repository.HarfBuzz.direction_t) -> ~gi.repository.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``\.
.. versionadded:: 1.1.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param direction: The direction of the text segment
.. function:: font_get_face(font: ~gi.repository.HarfBuzz.font_t) -> ~gi.repository.HarfBuzz.face_t
Fetches the face associated with the specified font object.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: The :obj:`~gi.repository.HarfBuzz.face_t` value
.. function:: font_get_glyph(font: ~gi.repository.HarfBuzz.font_t, unicode: int, variation_selector: int) -> ~typing.Tuple[int, 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 :func:`~gi.repository.HarfBuzz.font_get_nominal_glyph`;
otherwise calls :func:`~gi.repository.HarfBuzz.font_get_variation_glyph`.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param unicode: The Unicode code point to query
:param variation_selector: A variation-selector code point
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_glyph_advance_for_direction(font: ~gi.repository.HarfBuzz.font_t, glyph: int, direction: ~gi.repository.HarfBuzz.direction_t) -> ~typing.Tuple[int, 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``\.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:param direction: The direction of the text segment
.. function:: font_get_glyph_advances_for_direction(font: ~gi.repository.HarfBuzz.font_t, direction: ~gi.repository.HarfBuzz.direction_t, count: int, first_glyph: int, glyph_stride: int) -> ~typing.Tuple[int, 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``\.
.. versionadded:: 1.8.6
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param direction: The direction of the text segment
:param count: The number of glyph IDs in the sequence queried
:param first_glyph: The first glyph ID to query
:param glyph_stride: The stride between successive glyph IDs
.. function:: font_get_glyph_contour_point(font: ~gi.repository.HarfBuzz.font_t, glyph: int, point_index: int) -> ~typing.Tuple[int, int, int]
Fetches the (x,y) coordinates of a specified contour-point index
in the specified glyph, within the specified font.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:param point_index: The contour-point index to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_glyph_contour_point_for_origin(font: ~gi.repository.HarfBuzz.font_t, glyph: int, point_index: int, direction: ~gi.repository.HarfBuzz.direction_t) -> ~typing.Tuple[int, int, 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``\.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:param point_index: The contour-point index to query
:param direction: The direction of the text segment
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_glyph_extents(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.glyph_extents_t]
Fetches the :obj:`~gi.repository.HarfBuzz.glyph_extents_t` data for a glyph ID
in the specified font.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_glyph_extents_for_origin(font: ~gi.repository.HarfBuzz.font_t, glyph: int, direction: ~gi.repository.HarfBuzz.direction_t) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.glyph_extents_t]
Fetches the :obj:`~gi.repository.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``\.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:param direction: The direction of the text segment
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_glyph_from_name(font: ~gi.repository.HarfBuzz.font_t, name: list[str]) -> ~typing.Tuple[int, 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.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param name: The name string to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_glyph_h_advance(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> int
Fetches the advance for a glyph ID in the specified font,
for horizontal text segments.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:return: The advance of ``glyph`` within ``font``
.. function:: font_get_glyph_h_advances(font: ~gi.repository.HarfBuzz.font_t, count: int, first_glyph: int, glyph_stride: int, advance_stride: int) -> int
Fetches the advances for a sequence of glyph IDs in the specified
font, for horizontal text segments.
.. versionadded:: 1.8.6
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param count: The number of glyph IDs in the sequence queried
:param first_glyph: The first glyph ID to query
:param glyph_stride: The stride between successive glyph IDs
:param advance_stride: The stride between successive advances
.. function:: font_get_glyph_h_kerning(font: ~gi.repository.HarfBuzz.font_t, left_glyph: int, right_glyph: int) -> int
Fetches the kerning-adjustment value for a glyph-pair in
the specified font, for horizontal text segments.
It handles legacy kerning only (as returned by the corresponding
:obj:`~gi.repository.HarfBuzz.font_funcs_t` function).
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param left_glyph: The glyph ID of the left glyph in the glyph pair
:param right_glyph: The glyph ID of the right glyph in the glyph pair
:return: The kerning adjustment value
.. function:: font_get_glyph_h_origin(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> ~typing.Tuple[int, int, int]
Fetches the (X,Y) coordinates of the origin for a glyph ID
in the specified font, for horizontal text segments.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_glyph_kerning_for_direction(font: ~gi.repository.HarfBuzz.font_t, first_glyph: int, second_glyph: int, direction: ~gi.repository.HarfBuzz.direction_t) -> ~typing.Tuple[int, 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``\.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param first_glyph: The glyph ID of the first glyph in the glyph pair to query
:param second_glyph: The glyph ID of the second glyph in the glyph pair to query
:param direction: The direction of the text segment
.. function:: font_get_glyph_name(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> ~typing.Tuple[int, list[str]]
Fetches the glyph-name string for a glyph ID in the specified ``font``\.
According to the OpenType specification, glyph names are limited to 63
characters and can only contain (a subset of) ASCII.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_glyph_origin_for_direction(font: ~gi.repository.HarfBuzz.font_t, glyph: int, direction: ~gi.repository.HarfBuzz.direction_t) -> ~typing.Tuple[int, 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``\.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:param direction: The direction of the text segment
.. function:: font_get_glyph_shape(font: ~gi.repository.HarfBuzz.font_t, glyph: int, dfuncs: ~gi.repository.HarfBuzz.draw_funcs_t, draw_data: ~typing.Any = None) -> None
Fetches the glyph shape that corresponds to a glyph in the specified ``font``\.
The shape is returned by way of calls to the callbacks of the ``dfuncs``
objects, with ``draw_data`` passed to them.
.. versionadded:: 4.0.0
.. deprecated:: 7.0.0
Use :func:`~gi.repository.HarfBuzz.font_draw_glyph` instead
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID
:param dfuncs: :obj:`~gi.repository.HarfBuzz.draw_funcs_t` to draw to
:param draw_data: User data to pass to draw callbacks
.. function:: font_get_glyph_v_advance(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> int
Fetches the advance for a glyph ID in the specified font,
for vertical text segments.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:return: The advance of ``glyph`` within ``font``
.. function:: font_get_glyph_v_advances(font: ~gi.repository.HarfBuzz.font_t, count: int, first_glyph: int, glyph_stride: int) -> ~typing.Tuple[int, int]
Fetches the advances for a sequence of glyph IDs in the specified
font, for vertical text segments.
.. versionadded:: 1.8.6
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param count: The number of glyph IDs in the sequence queried
:param first_glyph: The first glyph ID to query
:param glyph_stride: The stride between successive glyph IDs
.. function:: font_get_glyph_v_kerning(font: ~gi.repository.HarfBuzz.font_t, top_glyph: int, bottom_glyph: int) -> int
Fetches the kerning-adjustment value for a glyph-pair in
the specified font, for vertical text segments.
It handles legacy kerning only (as returned by the corresponding
:obj:`~gi.repository.HarfBuzz.font_funcs_t` function).
.. versionadded:: 0.9.2
.. deprecated:: 2.0.0
Please do not use it in newly written code
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param top_glyph: The glyph ID of the top glyph in the glyph pair
:param bottom_glyph: The glyph ID of the bottom glyph in the glyph pair
:return: The kerning adjustment value
.. function:: font_get_glyph_v_origin(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> ~typing.Tuple[int, int, int]
Fetches the (X,Y) coordinates of the origin for a glyph ID
in the specified font, for vertical text segments.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_h_extents(font: ~gi.repository.HarfBuzz.font_t) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.font_extents_t]
Fetches the extents for a specified font, for horizontal
text segments.
.. versionadded:: 1.1.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_nominal_glyph(font: ~gi.repository.HarfBuzz.font_t, unicode: int) -> ~typing.Tuple[int, 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 :func:`~gi.repository.HarfBuzz.font_get_variation_glyph` or use :func:`~gi.repository.HarfBuzz.font_get_glyph`.
.. versionadded:: 1.2.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param unicode: The Unicode code point to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_nominal_glyphs(font: ~gi.repository.HarfBuzz.font_t, count: int, first_unicode: int, unicode_stride: int, glyph_stride: int) -> ~typing.Tuple[int, int]
Fetches the nominal glyph IDs for a sequence of Unicode code points. Glyph
IDs must be returned in a :obj:`~gi.repository.HarfBuzz.codepoint_t` output parameter. Stops at the
first unsupported glyph ID.
.. versionadded:: 2.6.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param count: number of code points to query
:param first_unicode: The first Unicode code point to query
:param unicode_stride: The stride between successive code points
:param glyph_stride: The stride between successive glyph IDs
:return: the number of code points processed
.. function:: font_get_parent(font: ~gi.repository.HarfBuzz.font_t) -> ~gi.repository.HarfBuzz.font_t
Fetches the parent font of ``font``\.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: The parent font object
.. function:: font_get_ppem(font: ~gi.repository.HarfBuzz.font_t) -> ~typing.Tuple[int, int]
Fetches the horizontal and vertical points-per-em (ppem) of a font.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
.. function:: font_get_ptem(font: ~gi.repository.HarfBuzz.font_t) -> float
Fetches the "point size" of a font. Used in CoreText to
implement optical sizing.
.. versionadded:: 1.6.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: Point size. A value of zero means "not set."
.. function:: font_get_scale(font: ~gi.repository.HarfBuzz.font_t) -> ~typing.Tuple[int, int]
Fetches the horizontal and vertical scale of a font.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
.. function:: font_get_serial(font: ~gi.repository.HarfBuzz.font_t) -> int
Returns the internal serial number of the font. The serial
number is increased every time a setting on the font is
changed, using a setter function.
.. versionadded:: 4.4.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: serial number
.. function:: font_get_synthetic_bold(font: ~gi.repository.HarfBuzz.font_t) -> ~typing.Tuple[float, float, int]
Fetches the "synthetic boldness" parameters of a font.
.. versionadded:: 7.0.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
.. function:: font_get_synthetic_slant(font: ~gi.repository.HarfBuzz.font_t) -> float
Fetches the "synthetic slant" of a font.
.. versionadded:: 3.3.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: Synthetic slant. By default is zero.
.. function:: font_get_v_extents(font: ~gi.repository.HarfBuzz.font_t) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.font_extents_t]
Fetches the extents for a specified font, for vertical
text segments.
.. versionadded:: 1.1.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_get_var_coords_design(font: ~gi.repository.HarfBuzz.font_t) -> ~typing.Tuple[float, int]
Fetches the list of variation coordinates (in design-space units) currently
set on a font.
Note that this returned array may only contain values for some
(or none) of the axes; omitted axes effectively have their default
values.
Return value is valid as long as variation coordinates of the font
are not modified.
.. versionadded:: 3.3.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: coordinates array
.. function:: font_get_var_coords_normalized(font: ~gi.repository.HarfBuzz.font_t) -> ~typing.Tuple[int, int]
Fetches the list of normalized variation coordinates currently
set on a font.
Note that this returned array may only contain values for some
(or none) of the axes; omitted axes effectively have zero values.
Return value is valid as long as variation coordinates of the font
are not modified.
.. versionadded:: 1.4.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: coordinates array
.. function:: font_get_var_named_instance(font: ~gi.repository.HarfBuzz.font_t) -> int
Returns the currently-set named-instance index of the font.
.. versionadded:: 7.0.0
:param font: a font.
:return: Named-instance index or :const:`~gi.repository.HarfBuzz.FONT_NO_VAR_NAMED_INSTANCE`.
.. function:: font_get_variation_glyph(font: ~gi.repository.HarfBuzz.font_t, unicode: int, variation_selector: int) -> ~typing.Tuple[int, int]
Fetches the glyph ID for a Unicode code point when followed by
by the specified variation-selector code point, in the specified
font.
.. versionadded:: 1.2.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param unicode: The Unicode code point to query
:param variation_selector: The variation-selector code point to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_glyph_from_string(font: ~gi.repository.HarfBuzz.font_t, s: list[int]) -> ~typing.Tuple[int, 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.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param s: string to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: font_glyph_to_string(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> list[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.
According to the OpenType specification, glyph names are limited to 63
characters and can only contain (a subset of) ASCII.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
.. function:: font_is_immutable(font: ~gi.repository.HarfBuzz.font_t) -> int
Tests whether a font object is immutable.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: ``true`` if ``font`` is immutable, ``false`` otherwise
.. function:: font_make_immutable(font: ~gi.repository.HarfBuzz.font_t) -> None
Makes ``font`` immutable.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
.. function:: font_paint_glyph(font: ~gi.repository.HarfBuzz.font_t, glyph: int, pfuncs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, palette_index: int, foreground: int) -> None
Paints the glyph.
The painting instructions are returned by way of calls to
the callbacks of the ``funcs`` object, with ``paint_data`` passed
to them.
If the font has color palettes (see :func:`~gi.repository.HarfBuzz.ot_color_has_palettes`),
then ``palette_index`` selects the palette to use. If the font only
has one palette, this will be 0.
.. versionadded:: 7.0.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID
:param pfuncs: :obj:`~gi.repository.HarfBuzz.paint_funcs_t` to paint with
:param paint_data: User data to pass to paint callbacks
:param palette_index: The index of the font's color palette to use
:param foreground: The foreground color, unpremultipled
.. function:: font_set_face(font: ~gi.repository.HarfBuzz.font_t, face: ~gi.repository.HarfBuzz.face_t) -> None
Sets ``face`` as the font-face value of ``font``\.
.. versionadded:: 1.4.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to assign
.. function:: font_set_funcs(font: ~gi.repository.HarfBuzz.font_t, klass: ~gi.repository.HarfBuzz.font_funcs_t, font_data: ~typing.Any = None) -> None
Replaces the font-functions structure attached to a font, updating
the font's user-data with ``font``\-data and the ``destroy`` callback.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param klass: The font-functions structure.
:param font_data: Data to attach to ``font``
.. function:: font_set_funcs_data(font: ~gi.repository.HarfBuzz.font_t, font_data: ~typing.Any = None) -> None
Replaces the user data attached to a font, updating the font's
``destroy`` callback.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param font_data: Data to attach to ``font``
.. function:: font_set_parent(font: ~gi.repository.HarfBuzz.font_t, parent: ~gi.repository.HarfBuzz.font_t) -> None
Sets the parent font of ``font``\.
.. versionadded:: 1.0.5
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param parent: The parent font object to assign
.. function:: font_set_ppem(font: ~gi.repository.HarfBuzz.font_t, x_ppem: int, y_ppem: int) -> None
Sets the horizontal and vertical pixels-per-em (PPEM) of a font.
These values are used for pixel-size-specific adjustment to
shaping and draw results, though for the most part they are
unused and can be left unset.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param x_ppem: Horizontal ppem value to assign
:param y_ppem: Vertical ppem value to assign
.. function:: font_set_ptem(font: ~gi.repository.HarfBuzz.font_t, ptem: float) -> None
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.
.. versionadded:: 1.6.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param ptem: font size in points.
.. function:: font_set_scale(font: ~gi.repository.HarfBuzz.font_t, x_scale: int, y_scale: int) -> None
Sets the horizontal and vertical scale of a font.
The font scale is a number related to, but not the same as,
font size. Typically the client establishes a scale factor
to be used between the two. For example, 64, or 256, which
would be the fractional-precision part of the font scale.
This is necessary because :obj:`~gi.repository.HarfBuzz.position_t` values are integer
types and you need to leave room for fractional values
in there.
For example, to set the font size to 20, with 64
levels of fractional precision you would call
``hb_font_set_scale(font, 20 * 64, 20 * 64)``\.
In the example above, even what font size 20 means is up to
you. It might be 20 pixels, or 20 points, or 20 millimeters.
HarfBuzz does not care about that. You can set the point
size of the font using :func:`~gi.repository.HarfBuzz.font_set_ptem`, and the pixel
size using :func:`~gi.repository.HarfBuzz.font_set_ppem`.
The choice of scale is yours but needs to be consistent between
what you set here, and what you expect out of :obj:`~gi.repository.HarfBuzz.position_t`
as well has draw / paint API output values.
Fonts default to a scale equal to the UPEM value of their face.
A font with this setting is sometimes called an "unscaled" font.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param x_scale: Horizontal scale value to assign
:param y_scale: Vertical scale value to assign
.. function:: font_set_synthetic_bold(font: ~gi.repository.HarfBuzz.font_t, x_embolden: float, y_embolden: float, in_place: int) -> None
Sets the "synthetic boldness" of a font.
Positive values for ``x_embolden`` / ``y_embolden`` make a font
bolder, negative values thinner. Typical values are in the
0.01 to 0.05 range. The default value is zero.
Synthetic boldness is applied by offsetting the contour
points of the glyph shape.
Synthetic boldness is applied when rendering a glyph via
:func:`~gi.repository.HarfBuzz.font_draw_glyph`.
If ``in_place`` is ``false``\, then glyph advance-widths are also
adjusted, otherwise they are not. The in-place mode is
useful for simulating `font grading `__\.
.. versionadded:: 7.0.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param x_embolden: the amount to embolden horizontally
:param y_embolden: the amount to embolden vertically
:param in_place: whether to embolden glyphs in-place
.. function:: font_set_synthetic_slant(font: ~gi.repository.HarfBuzz.font_t, slant: float) -> None
Sets the "synthetic slant" of a font. By default is zero.
Synthetic slant is the graphical skew applied to the font
at rendering time.
HarfBuzz needs to know this value to adjust shaping results,
metrics, and style values to match the slanted rendering.
Note: The glyph shape fetched via the :func:`~gi.repository.HarfBuzz.font_draw_glyph`
function is slanted to reflect this value as well.
Note: The slant value is a ratio. For example, a
20% slant would be represented as a 0.2 value.
.. versionadded:: 3.3.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param slant: synthetic slant value.
.. function:: font_set_var_coords_design(font: ~gi.repository.HarfBuzz.font_t, coords: list[float]) -> None
Applies a list of variation coordinates (in design-space units)
to a font.
Note that this overrides all existing variations set on ``font``\.
Axes not included in ``coords`` will be effectively set to their
default values.
.. versionadded:: 1.4.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param coords: Array of variation coordinates to apply
.. function:: font_set_var_coords_normalized(font: ~gi.repository.HarfBuzz.font_t, coords: list[int]) -> None
Applies a list of variation coordinates (in normalized units)
to a font.
Note that this overrides all existing variations set on ``font``\.
Axes not included in ``coords`` will be effectively set to their
default values.
Note: Coordinates should be normalized to 2.14.
.. versionadded:: 1.4.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param coords: Array of variation coordinates to apply
.. function:: font_set_var_named_instance(font: ~gi.repository.HarfBuzz.font_t, instance_index: int) -> None
Sets design coords of a font from a named-instance index.
.. versionadded:: 2.6.0
:param font: a font.
:param instance_index: named instance index.
.. function:: font_set_variation(font: ~gi.repository.HarfBuzz.font_t, tag: int, value: float) -> None
Change the value of one variation axis on the font.
Note: This function is expensive to be called repeatedly.
If you want to set multiple variation axes at the same time,
use :func:`~gi.repository.HarfBuzz.font_set_variations` instead.
.. versionadded:: 7.1.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param tag: The :obj:`~gi.repository.HarfBuzz.tag_t` tag of the variation-axis name
:param value: The value of the variation axis
.. function:: font_set_variations(font: ~gi.repository.HarfBuzz.font_t, variations: list[~gi.repository.HarfBuzz.variation_t]) -> None
Applies a list of font-variation settings to a font.
Note that this overrides all existing variations set on ``font``\.
Axes not included in ``variations`` will be effectively set to their
default values.
.. versionadded:: 1.4.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param variations: Array of variation settings to apply
.. function:: font_subtract_glyph_origin_for_direction(font: ~gi.repository.HarfBuzz.font_t, glyph: int, direction: ~gi.repository.HarfBuzz.direction_t, x: int, y: int) -> ~typing.Tuple[int, 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``\.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph ID to query
:param direction: The direction of the text segment
:param x: Input = The original X coordinate
Output = The X coordinate minus the X-coordinate of the origin
:param y: Input = The original Y coordinate
Output = The Y coordinate minus the Y-coordinate of the origin
.. function:: ft_face_create(ft_face: ~gi.repository.freetype2.Face) -> ~gi.repository.HarfBuzz.face_t
Creates an :obj:`~gi.repository.HarfBuzz.face_t` face object from the specified FT_Face.
Note that this is using the FT_Face object just to get at the underlying
font data, and fonts created from the returned :obj:`~gi.repository.HarfBuzz.face_t` will use the native
HarfBuzz font implementation, unless you call :func:`~gi.repository.HarfBuzz.ft_font_set_funcs` on them.
This variant of the function does not provide any life-cycle management.
Most client programs should use :func:`~gi.repository.HarfBuzz.ft_face_create_referenced`
(or, perhaps, :func:`~gi.repository.HarfBuzz.ft_face_create_cached`) instead.
If you know you have valid reasons not to use :func:`~gi.repository.HarfBuzz.ft_face_create_referenced`,
then it is the client program's responsibility to destroy ``ft_face``
after the :obj:`~gi.repository.HarfBuzz.face_t` face object has been destroyed.
.. versionadded:: 0.9.2
:param ft_face: FT_Face to work upon
:return: the new :obj:`~gi.repository.HarfBuzz.face_t` face object
.. function:: ft_face_create_cached(ft_face: ~gi.repository.freetype2.Face) -> ~gi.repository.HarfBuzz.face_t
Creates an :obj:`~gi.repository.HarfBuzz.face_t` face object from the specified FT_Face.
Note that this is using the FT_Face object just to get at the underlying
font data, and fonts created from the returned :obj:`~gi.repository.HarfBuzz.face_t` will use the native
HarfBuzz font implementation, unless you call :func:`~gi.repository.HarfBuzz.ft_font_set_funcs` on them.
This variant of the function caches the newly created :obj:`~gi.repository.HarfBuzz.face_t`
face object, using the ``generic`` pointer of ``ft_face``\. Subsequent function
calls that are passed the same ``ft_face`` parameter will have the same
:obj:`~gi.repository.HarfBuzz.face_t` returned to them, and that :obj:`~gi.repository.HarfBuzz.face_t` will be correctly
reference counted.
However, client programs are still responsible for destroying
``ft_face`` after the last :obj:`~gi.repository.HarfBuzz.face_t` face object has been destroyed.
.. versionadded:: 0.9.2
:param ft_face: FT_Face to work upon
:return: the new :obj:`~gi.repository.HarfBuzz.face_t` face object
.. function:: ft_face_create_referenced(ft_face: ~gi.repository.freetype2.Face) -> ~gi.repository.HarfBuzz.face_t
Creates an :obj:`~gi.repository.HarfBuzz.face_t` face object from the specified FT_Face.
Note that this is using the FT_Face object just to get at the underlying
font data, and fonts created from the returned :obj:`~gi.repository.HarfBuzz.face_t` will use the native
HarfBuzz font implementation, unless you call :func:`~gi.repository.HarfBuzz.ft_font_set_funcs` on them.
This is the preferred variant of the hb_ft_face_create\*
function family, because it calls FT_Reference_Face() on ``ft_face``\,
ensuring that ``ft_face`` remains alive as long as the resulting
:obj:`~gi.repository.HarfBuzz.face_t` face object remains alive. Also calls FT_Done_Face()
when the :obj:`~gi.repository.HarfBuzz.face_t` face object is destroyed.
Use this version unless you know you have good reasons not to.
.. versionadded:: 0.9.38
:param ft_face: FT_Face to work upon
:return: the new :obj:`~gi.repository.HarfBuzz.face_t` face object
.. function:: ft_font_changed(font: ~gi.repository.HarfBuzz.font_t) -> None
Refreshes the state of ``font`` when the underlying FT_Face has changed.
This function should be called after changing the size or
variation-axis settings on the FT_Face.
.. versionadded:: 1.0.5
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
.. function:: ft_font_create(ft_face: ~gi.repository.freetype2.Face) -> ~gi.repository.HarfBuzz.font_t
Creates an :obj:`~gi.repository.HarfBuzz.font_t` font object from the specified FT_Face.
Note: You must set the face size on ``ft_face`` before calling
:func:`~gi.repository.HarfBuzz.ft_font_create` on it. HarfBuzz assumes size is always set and will
access ``size`` member of FT_Face unconditionally.
This variant of the function does not provide any life-cycle management.
Most client programs should use :func:`~gi.repository.HarfBuzz.ft_font_create_referenced`
instead.
If you know you have valid reasons not to use :func:`~gi.repository.HarfBuzz.ft_font_create_referenced`,
then it is the client program's responsibility to destroy ``ft_face``
after the :obj:`~gi.repository.HarfBuzz.font_t` font object has been destroyed.
HarfBuzz will use the ``destroy`` callback on the :obj:`~gi.repository.HarfBuzz.font_t` font object
if it is supplied when you use this function. However, even if ``destroy``
is provided, it is the client program's responsibility to destroy ``ft_face``\,
and it is the client program's responsibility to ensure that ``ft_face`` is
destroyed only after the :obj:`~gi.repository.HarfBuzz.font_t` font object has been destroyed.
.. versionadded:: 0.9.2
:param ft_face: FT_Face to work upon
:return: the new :obj:`~gi.repository.HarfBuzz.font_t` font object
.. function:: ft_font_create_referenced(ft_face: ~gi.repository.freetype2.Face) -> ~gi.repository.HarfBuzz.font_t
Creates an :obj:`~gi.repository.HarfBuzz.font_t` font object from the specified FT_Face.
Note: You must set the face size on ``ft_face`` before calling
:func:`~gi.repository.HarfBuzz.ft_font_create_referenced` on it. HarfBuzz assumes size is always set
and will access ``size`` member of FT_Face unconditionally.
This is the preferred variant of the hb_ft_font_create\*
function family, because it calls FT_Reference_Face() on ``ft_face``\,
ensuring that ``ft_face`` remains alive as long as the resulting
:obj:`~gi.repository.HarfBuzz.font_t` font object remains alive.
Use this version unless you know you have good reasons not to.
.. versionadded:: 0.9.38
:param ft_face: FT_Face to work upon
:return: the new :obj:`~gi.repository.HarfBuzz.font_t` font object
.. function:: ft_font_get_load_flags(font: ~gi.repository.HarfBuzz.font_t) -> int
Fetches the FT_Load_Glyph load flags of the specified :obj:`~gi.repository.HarfBuzz.font_t`\.
For more information, see
`https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx `__
This function works with :obj:`~gi.repository.HarfBuzz.font_t` objects created by
:func:`~gi.repository.HarfBuzz.ft_font_create` or :func:`~gi.repository.HarfBuzz.ft_font_create_referenced`.
.. versionadded:: 1.0.5
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: FT_Load_Glyph flags found, or 0
.. function:: ft_font_set_funcs(font: ~gi.repository.HarfBuzz.font_t) -> None
Configures the font-functions structure of the specified
:obj:`~gi.repository.HarfBuzz.font_t` font object to use FreeType font functions.
In particular, you can use this function to configure an
existing :obj:`~gi.repository.HarfBuzz.face_t` face object for use with FreeType font
functions even if that :obj:`~gi.repository.HarfBuzz.face_t` face object was initially
created with :func:`~gi.repository.HarfBuzz.face_create`, and therefore was not
initially configured to use FreeType font functions.
An :obj:`~gi.repository.HarfBuzz.font_t` object created with :func:`~gi.repository.HarfBuzz.ft_font_create`
is preconfigured for FreeType font functions and does not
require this function to be used.
Note that if you modify the underlying :obj:`~gi.repository.HarfBuzz.font_t` after
calling this function, you need to call :func:`~gi.repository.HarfBuzz.ft_hb_font_changed`
to update the underlying FT_Face.
Note: Internally, this function creates an FT_Face.
.. versionadded:: 1.0.5
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
.. function:: ft_font_set_load_flags(font: ~gi.repository.HarfBuzz.font_t, load_flags: int) -> None
Sets the FT_Load_Glyph load flags for the specified :obj:`~gi.repository.HarfBuzz.font_t`\.
For more information, see
`https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx `__
This function works with :obj:`~gi.repository.HarfBuzz.font_t` objects created by
:func:`~gi.repository.HarfBuzz.ft_font_create` or :func:`~gi.repository.HarfBuzz.ft_font_create_referenced`.
.. versionadded:: 1.0.5
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param load_flags: The FreeType load flags to set
.. function:: ft_hb_font_changed(font: ~gi.repository.HarfBuzz.font_t) -> int
Refreshes the state of the underlying FT_Face of ``font`` when the hb_font_t
``font`` has changed.
This function should be called after changing the size or
variation-axis settings on the ``font``\.
This call is fast if nothing has changed on ``font``\.
.. versionadded:: 4.4.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:return: true if changed, false otherwise
.. function:: glib_blob_create(gbytes: ~gi.repository.GLib.Bytes) -> ~gi.repository.HarfBuzz.blob_t
Creates an :obj:`~gi.repository.HarfBuzz.blob_t` blob from the specified
GBytes data structure.
.. versionadded:: 0.9.38
:param gbytes: the GBytes structure to work upon
:return: the new :obj:`~gi.repository.HarfBuzz.blob_t` blob object
.. function:: glib_get_unicode_funcs() -> ~gi.repository.HarfBuzz.unicode_funcs_t
Fetches a Unicode-functions structure that is populated
with the appropriate GLib function for each method.
.. versionadded:: 0.9.38
:return: a pointer to the :obj:`~gi.repository.HarfBuzz.unicode_funcs_t` Unicode-functions structure
.. function:: glib_script_from_script(script: ~gi.repository.HarfBuzz.script_t) -> ~gi.repository.GLib.UnicodeScript
Fetches the GUnicodeScript identifier that corresponds to the
specified :obj:`~gi.repository.HarfBuzz.script_t` script.
.. versionadded:: 0.9.38
:param script: The :obj:`~gi.repository.HarfBuzz.script_t` to query
:return: the GUnicodeScript identifier found
.. function:: glib_script_to_script(script: ~gi.repository.GLib.UnicodeScript) -> ~gi.repository.HarfBuzz.script_t
Fetches the :obj:`~gi.repository.HarfBuzz.script_t` script that corresponds to the
specified GUnicodeScript identifier.
.. versionadded:: 0.9.38
:param script: The GUnicodeScript identifier to query
:return: the :obj:`~gi.repository.HarfBuzz.script_t` script found
.. function:: glyph_info_get_glyph_flags(info: ~gi.repository.HarfBuzz.glyph_info_t) -> ~gi.repository.HarfBuzz.glyph_flags_t
Returns glyph flags encoded within a :obj:`~gi.repository.HarfBuzz.glyph_info_t`\.
.. versionadded:: 1.5.0
:param info: a :obj:`~gi.repository.HarfBuzz.glyph_info_t`
:return: The :obj:`~gi.repository.HarfBuzz.glyph_flags_t` encoded within ``info``
.. function:: language_from_string(str: list[int]) -> ~gi.repository.HarfBuzz.language_t
Converts ``str`` representing a BCP 47 language tag to the corresponding
:obj:`~gi.repository.HarfBuzz.language_t`\.
.. versionadded:: 0.9.2
:param str: a string representing
a BCP 47 language tag
:return: The :obj:`~gi.repository.HarfBuzz.language_t` corresponding to the BCP 47 language tag.
.. function:: language_get_default() -> ~gi.repository.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 :func:`~gi.repository.HarfBuzz.buffer_guess_segment_properties` by
HarfBuzz itself.
.. versionadded:: 0.9.2
:return: The default language of the locale as
an :obj:`~gi.repository.HarfBuzz.language_t`
.. function:: language_matches(language: ~gi.repository.HarfBuzz.language_t, specific: ~gi.repository.HarfBuzz.language_t) -> int
Check whether a second language tag is the same or a more
specific version of the provided language tag. For example,
"fa_IR.utf8" is a more specific tag for "fa" or for "fa_IR".
.. versionadded:: 5.0.0
:param language: The :obj:`~gi.repository.HarfBuzz.language_t` to work on
:param specific: Another :obj:`~gi.repository.HarfBuzz.language_t`
:return: ``true`` if languages match, ``false`` otherwise.
.. function:: language_to_string(language: ~gi.repository.HarfBuzz.language_t) -> str
Converts an :obj:`~gi.repository.HarfBuzz.language_t` to a string.
.. versionadded:: 0.9.2
:param language: The :obj:`~gi.repository.HarfBuzz.language_t` to convert
:return: A ``NULL``\-terminated string representing the ``language``\. Must not be freed by
the caller.
.. function:: map_allocation_successful(map: ~gi.repository.HarfBuzz.map_t) -> int
Tests whether memory allocation for a set was successful.
.. versionadded:: 1.7.7
:param map: A map
:return: ``true`` if allocation succeeded, ``false`` otherwise
.. function:: map_clear(map: ~gi.repository.HarfBuzz.map_t) -> None
Clears out the contents of ``map``\.
.. versionadded:: 1.7.7
:param map: A map
.. function:: map_create() -> ~gi.repository.HarfBuzz.map_t
Creates a new, initially empty map.
.. versionadded:: 1.7.7
:return: The new :obj:`~gi.repository.HarfBuzz.map_t`
.. function:: map_del(map: ~gi.repository.HarfBuzz.map_t, key: int) -> None
Removes ``key`` and its stored value from ``map``\.
.. versionadded:: 1.7.7
:param map: A map
:param key: The key to delete
.. function:: map_get(map: ~gi.repository.HarfBuzz.map_t, key: int) -> int
Fetches the value stored for ``key`` in ``map``\.
.. versionadded:: 1.7.7
:param map: A map
:param key: The key to query
.. function:: map_get_empty() -> ~gi.repository.HarfBuzz.map_t
Fetches the singleton empty :obj:`~gi.repository.HarfBuzz.map_t`\.
.. versionadded:: 1.7.7
:return: The empty :obj:`~gi.repository.HarfBuzz.map_t`
.. function:: map_get_population(map: ~gi.repository.HarfBuzz.map_t) -> int
Returns the number of key-value pairs in the map.
.. versionadded:: 1.7.7
:param map: A map
:return: The population of ``map``
.. function:: map_has(map: ~gi.repository.HarfBuzz.map_t, key: int) -> int
Tests whether ``key`` is an element of ``map``\.
.. versionadded:: 1.7.7
:param map: A map
:param key: The key to query
:return: ``true`` if ``key`` is found in ``map``\, ``false`` otherwise
.. function:: map_hash(map: ~gi.repository.HarfBuzz.map_t) -> int
Creates a hash representing ``map``\.
.. versionadded:: 4.4.0
:param map: A map
:return: A hash of ``map``\.
.. function:: map_is_empty(map: ~gi.repository.HarfBuzz.map_t) -> int
Tests whether ``map`` is empty (contains no elements).
.. versionadded:: 1.7.7
:param map: A map
:return: ``true`` if ``map`` is empty
.. function:: map_is_equal(map: ~gi.repository.HarfBuzz.map_t, other: ~gi.repository.HarfBuzz.map_t) -> int
Tests whether ``map`` and ``other`` are equal (contain the same
elements).
.. versionadded:: 4.3.0
:param map: A map
:param other: Another map
:return: ``true`` if the two maps are equal, ``false`` otherwise.
.. function:: map_keys(map: ~gi.repository.HarfBuzz.map_t, keys: ~gi.repository.HarfBuzz.set_t) -> None
Add the keys of ``map`` to ``keys``\.
.. versionadded:: 7.0.0
:param map: A map
:param keys: A set
.. function:: map_next(map: ~gi.repository.HarfBuzz.map_t, idx: int) -> ~typing.Tuple[int, int, int, int]
Fetches the next key/value pair in ``map``\.
Set ``idx`` to -1 to get started.
If the map is modified during iteration, the behavior is undefined.
The order in which the key/values are returned is undefined.
.. versionadded:: 7.0.0
:param map: A map
:param idx: Iterator internal state
:return: ``true`` if there was a next value, ``false`` otherwise
.. function:: map_set(map: ~gi.repository.HarfBuzz.map_t, key: int, value: int) -> None
Stores ``key``\:``value`` in the map.
.. versionadded:: 1.7.7
:param map: A map
:param key: The key to store in the map
:param value: The value to store for ``key``
.. function:: map_update(map: ~gi.repository.HarfBuzz.map_t, other: ~gi.repository.HarfBuzz.map_t) -> None
Add the contents of ``other`` to ``map``\.
.. versionadded:: 7.0.0
:param map: A map
:param other: Another map
.. function:: map_values(map: ~gi.repository.HarfBuzz.map_t, values: ~gi.repository.HarfBuzz.set_t) -> None
Add the values of ``map`` to ``values``\.
.. versionadded:: 7.0.0
:param map: A map
:param values: A set
.. function:: ot_color_glyph_get_layers(face: ~gi.repository.HarfBuzz.face_t, glyph: int, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.HarfBuzz.ot_color_layer_t] | None]
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.
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param glyph: The glyph index to query
:param start_offset: offset of the first layer to retrieve
:return: Total number of layers available for the glyph index queried
.. function:: ot_color_glyph_has_paint(face: ~gi.repository.HarfBuzz.face_t, glyph: int) -> int
Tests where a face includes COLRv1 paint
data for ``glyph``\.
.. versionadded:: 7.0.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param glyph: The glyph index to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_color_glyph_reference_png(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> ~gi.repository.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 PPEM values must be set on the ``font``
object. If PPEM is unset, the blob returned will be the largest PNG available.
If the glyph has no PNG image, the singleton empty blob is returned.
.. versionadded:: 2.1.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: a glyph index
:return: An :obj:`~gi.repository.HarfBuzz.blob_t` containing the PNG image for the glyph, if available
.. function:: ot_color_glyph_reference_svg(face: ~gi.repository.HarfBuzz.face_t, glyph: int) -> ~gi.repository.HarfBuzz.blob_t
Fetches the SVG document for a glyph. The blob may be either plain text or gzip-encoded.
If the glyph has no SVG document, the singleton empty blob is returned.
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param glyph: a svg glyph index
:return: An :obj:`~gi.repository.HarfBuzz.blob_t` containing the SVG document of the glyph, if available
.. function:: ot_color_has_layers(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether a face includes a ``COLR`` table
with data according to COLRv0.
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_color_has_paint(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests where a face includes a ``COLR`` table
with data according to COLRv1.
.. versionadded:: 7.0.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_color_has_palettes(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether a face includes a ``CPAL`` color-palette table.
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_color_has_png(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether a face has PNG glyph images (either in ``CBDT`` or ``sbix`` tables).
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_color_has_svg(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether a face includes any ``SVG`` glyph images.
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon.
:return: ``true`` if data found, ``false`` otherwise.
.. function:: ot_color_palette_color_get_name_id(face: ~gi.repository.HarfBuzz.face_t, color_index: int) -> int
Fetches the ``name`` table Name ID that provides display names for
the specified color in a face's ``CPAL`` color palette.
Display names can be generic (e.g., "Background") or specific
(e.g., "Eye color").
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param color_index: The index of the color
:return: the Name ID found for the color.
.. function:: ot_color_palette_get_colors(face: ~gi.repository.HarfBuzz.face_t, palette_index: int, start_offset: int) -> ~typing.Tuple[int, list[int] | None]
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 NULL, 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
:func:`~gi.repository.HarfBuzz.ot_color_palette_get_colors` a second time.
The RGBA values in the palette are unpremultiplied. See the
OpenType spec `CPAL `__
section for details.
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param palette_index: the index of the color palette to query
:param start_offset: offset of the first color to retrieve
:return: the total number of colors in the palette
.. function:: ot_color_palette_get_count(face: ~gi.repository.HarfBuzz.face_t) -> int
Fetches the number of color palettes in a face.
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: the number of palettes found
.. function:: ot_color_palette_get_flags(face: ~gi.repository.HarfBuzz.face_t, palette_index: int) -> ~gi.repository.HarfBuzz.ot_color_palette_flags_t
Fetches the flags defined for a color palette.
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param palette_index: The index of the color palette
:return: the :obj:`~gi.repository.HarfBuzz.ot_color_palette_flags_t` of the requested color palette
.. function:: ot_color_palette_get_name_id(face: ~gi.repository.HarfBuzz.face_t, palette_index: int) -> 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").
.. versionadded:: 2.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param palette_index: The index of the color palette
:return: the Named ID found for the palette.
If the requested palette has no name the result is ``HB_OT_NAME_ID_INVALID``.
.. function:: ot_font_set_funcs(font: ~gi.repository.HarfBuzz.font_t) -> None
Sets the font functions to use when working with ``font``\.
.. versionadded:: 0.9.28
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
.. function:: ot_layout_collect_features(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, scripts: list[int] | None = None, languages: list[int] | None = None, features: list[int] | None = None) -> ~gi.repository.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.
.. versionadded:: 1.8.5
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param scripts: The array of scripts to collect features for,
terminated by %HB_TAG_NONE
:param languages: The array of languages to collect features for,
terminated by %HB_TAG_NONE
:param features: The array of features to collect,
terminated by %HB_TAG_NONE
.. function:: ot_layout_collect_features_map(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_index: int) -> ~gi.repository.HarfBuzz.map_t
Fetches the mapping from feature tags to feature indexes for
the specified script and language.
.. versionadded:: 8.1.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_index: The index of the requested language tag
.. function:: ot_layout_collect_lookups(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, scripts: list[int] | None = None, languages: list[int] | None = None, features: list[int] | None = None) -> ~gi.repository.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.
.. versionadded:: 0.9.8
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param scripts: The array of scripts to collect lookups for,
terminated by %HB_TAG_NONE
:param languages: The array of languages to collect lookups for,
terminated by %HB_TAG_NONE
:param features: The array of features to collect lookups for,
terminated by %HB_TAG_NONE
.. function:: ot_layout_feature_get_characters(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, feature_index: int, start_offset: int) -> ~typing.Tuple[int, list[int]]
Fetches a list of the characters defined as having a variant under the specified
"Character Variant" ("cvXX") feature tag.
.. versionadded:: 2.0.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: table tag to query, "GSUB" or "GPOS".
:param feature_index: index of feature to query.
:param start_offset: offset of the first character to retrieve
:return: Number of total sample characters in the cvXX feature.
.. function:: ot_layout_feature_get_lookups(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, feature_index: int, start_offset: int) -> ~typing.Tuple[int, list[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.
.. versionadded:: 0.9.7
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param feature_index: The index of the requested feature
:param start_offset: offset of the first lookup to retrieve
:return: Total number of lookups.
.. function:: ot_layout_feature_get_name_ids(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, feature_index: int) -> ~typing.Tuple[int, int, int, int, int, int]
Fetches name indices from feature parameters for "Stylistic Set" ('ssXX') or
"Character Variant" ('cvXX') features.
.. versionadded:: 2.0.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: table tag to query, "GSUB" or "GPOS".
:param feature_index: index of feature to query.
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_layout_feature_with_variations_get_lookups(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, feature_index: int, variations_index: int, start_offset: int) -> ~typing.Tuple[int, list[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.
.. versionadded:: 1.4.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param feature_index: The index of the feature to query
:param variations_index: The index of the feature variation to query
:param start_offset: offset of the first lookup to retrieve
:return: Total number of lookups.
.. function:: ot_layout_get_attach_points(face: ~gi.repository.HarfBuzz.face_t, glyph: int, start_offset: int) -> ~typing.Tuple[int, list[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.
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:param glyph: The :obj:`~gi.repository.HarfBuzz.codepoint_t` code point to query
:param start_offset: offset of the first attachment point to retrieve
:return: Total number of attachment points for ``glyph``\.
.. function:: ot_layout_get_baseline(font: ~gi.repository.HarfBuzz.font_t, baseline_tag: ~gi.repository.HarfBuzz.ot_layout_baseline_tag_t, direction: ~gi.repository.HarfBuzz.direction_t, script_tag: int, language_tag: int) -> ~typing.Tuple[int, int | None]
Fetches a baseline value from the face.
.. versionadded:: 2.6.0
:param font: a font
:param baseline_tag: a baseline tag
:param direction: text direction.
:param script_tag: script tag.
:param language_tag: language tag, currently unused.
:return: ``true`` if found baseline value in the font.
.. function:: ot_layout_get_baseline2(font: ~gi.repository.HarfBuzz.font_t, baseline_tag: ~gi.repository.HarfBuzz.ot_layout_baseline_tag_t, direction: ~gi.repository.HarfBuzz.direction_t, script: ~gi.repository.HarfBuzz.script_t, language: ~gi.repository.HarfBuzz.language_t | None = None) -> ~typing.Tuple[int, int | None]
Fetches a baseline value from the face.
This function is like :func:`~gi.repository.HarfBuzz.ot_layout_get_baseline` but takes
:obj:`~gi.repository.HarfBuzz.script_t` and :obj:`~gi.repository.HarfBuzz.language_t` instead of OpenType :obj:`~gi.repository.HarfBuzz.tag_t`\.
.. versionadded:: 8.0.0
:param font: a font
:param baseline_tag: a baseline tag
:param direction: text direction.
:param script: script.
:param language: language, currently unused.
:return: ``true`` if found baseline value in the font.
.. function:: ot_layout_get_baseline_with_fallback(font: ~gi.repository.HarfBuzz.font_t, baseline_tag: ~gi.repository.HarfBuzz.ot_layout_baseline_tag_t, direction: ~gi.repository.HarfBuzz.direction_t, script_tag: int, language_tag: int) -> int
Fetches a baseline value from the face, and synthesizes
it if the font does not have it.
.. versionadded:: 4.0.0
:param font: a font
:param baseline_tag: a baseline tag
:param direction: text direction.
:param script_tag: script tag.
:param language_tag: language tag, currently unused.
.. function:: ot_layout_get_baseline_with_fallback2(font: ~gi.repository.HarfBuzz.font_t, baseline_tag: ~gi.repository.HarfBuzz.ot_layout_baseline_tag_t, direction: ~gi.repository.HarfBuzz.direction_t, script: ~gi.repository.HarfBuzz.script_t, language: ~gi.repository.HarfBuzz.language_t | None = None) -> int
Fetches a baseline value from the face, and synthesizes
it if the font does not have it.
This function is like :func:`~gi.repository.HarfBuzz.ot_layout_get_baseline_with_fallback` but takes
:obj:`~gi.repository.HarfBuzz.script_t` and :obj:`~gi.repository.HarfBuzz.language_t` instead of OpenType :obj:`~gi.repository.HarfBuzz.tag_t`\.
.. versionadded:: 8.0.0
:param font: a font
:param baseline_tag: a baseline tag
:param direction: text direction.
:param script: script.
:param language: language, currently unused.
.. function:: ot_layout_get_font_extents(font: ~gi.repository.HarfBuzz.font_t, direction: ~gi.repository.HarfBuzz.direction_t, script_tag: int, language_tag: int) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.font_extents_t | None]
Fetches script/language-specific font extents. These values are
looked up in the ``BASE`` table's ``MinMax`` records.
If no such extents are found, the default extents for the font are
fetched. As such, the return value of this function can for the
most part be ignored. Note that the per-script/language extents
do not have a line-gap value, and the line-gap is set to zero in
that case.
.. versionadded:: 8.0.0
:param font: a font
:param direction: text direction.
:param script_tag: script tag.
:param language_tag: language tag.
:return: ``true`` if found script/language-specific font extents.
.. function:: ot_layout_get_font_extents2(font: ~gi.repository.HarfBuzz.font_t, direction: ~gi.repository.HarfBuzz.direction_t, script: ~gi.repository.HarfBuzz.script_t, language: ~gi.repository.HarfBuzz.language_t | None = None) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.font_extents_t | None]
Fetches script/language-specific font extents. These values are
looked up in the ``BASE`` table's ``MinMax`` records.
If no such extents are found, the default extents for the font are
fetched. As such, the return value of this function can for the
most part be ignored. Note that the per-script/language extents
do not have a line-gap value, and the line-gap is set to zero in
that case.
This function is like :func:`~gi.repository.HarfBuzz.ot_layout_get_font_extents` but takes
:obj:`~gi.repository.HarfBuzz.script_t` and :obj:`~gi.repository.HarfBuzz.language_t` instead of OpenType :obj:`~gi.repository.HarfBuzz.tag_t`\.
.. versionadded:: 8.0.0
:param font: a font
:param direction: text direction.
:param script: script.
:param language: language.
:return: ``true`` if found script/language-specific font extents.
.. function:: ot_layout_get_glyph_class(face: ~gi.repository.HarfBuzz.face_t, glyph: int) -> ~gi.repository.HarfBuzz.ot_layout_glyph_class_t
Fetches the GDEF class of the requested glyph in the specified face.
.. versionadded:: 0.9.7
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:param glyph: The :obj:`~gi.repository.HarfBuzz.codepoint_t` code point to query
:return: The :obj:`~gi.repository.HarfBuzz.ot_layout_glyph_class_t` glyph class of the given code
point in the GDEF table of the face.
.. function:: ot_layout_get_glyphs_in_class(face: ~gi.repository.HarfBuzz.face_t, klass: ~gi.repository.HarfBuzz.ot_layout_glyph_class_t) -> ~gi.repository.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.
.. versionadded:: 0.9.7
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:param klass: The :obj:`~gi.repository.HarfBuzz.ot_layout_glyph_class_t` GDEF class to retrieve
.. function:: ot_layout_get_horizontal_baseline_tag_for_script(script: ~gi.repository.HarfBuzz.script_t) -> ~gi.repository.HarfBuzz.ot_layout_baseline_tag_t
Fetches the dominant horizontal baseline tag used by ``script``\.
.. versionadded:: 4.0.0
:param script: a script tag.
:return: dominant baseline tag for the ``script``\.
.. function:: ot_layout_get_ligature_carets(font: ~gi.repository.HarfBuzz.font_t, direction: ~gi.repository.HarfBuzz.direction_t, glyph: int, start_offset: int) -> ~typing.Tuple[int, list[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.
Note that a ligature that is formed from n characters will have n-1
caret positions. The first character is not represented in the array,
since its caret position is the glyph position.
The positions returned by this function are 'unshaped', and will have to
be fixed up for kerning that may be applied to the ligature glyph.
:param font: The :obj:`~gi.repository.HarfBuzz.font_t` to work on
:param direction: The :obj:`~gi.repository.HarfBuzz.direction_t` text direction to use
:param glyph: The :obj:`~gi.repository.HarfBuzz.codepoint_t` code point to query
:param start_offset: offset of the first caret position to retrieve
:return: Total number of ligature caret positions for ``glyph``\.
.. function:: ot_layout_get_size_params(face: ~gi.repository.HarfBuzz.face_t) -> ~typing.Tuple[int, int, int, int, int, 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 `__\.
.. versionadded:: 0.9.10
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_layout_has_glyph_classes(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether a face has any glyph classes defined in its GDEF table.
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_layout_has_positioning(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether the specified face includes any GPOS positioning.
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if the face has GPOS data, ``false`` otherwise
.. function:: ot_layout_has_substitution(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether the specified face includes any GSUB substitutions.
.. versionadded:: 0.6.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_layout_language_find_feature(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_index: int, feature_tag: int) -> ~typing.Tuple[int, 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.
.. versionadded:: 0.6.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_index: The index of the requested language tag
:param feature_tag: :obj:`~gi.repository.HarfBuzz.tag_t` of the feature tag requested
:return: ``true`` if the feature is found, ``false`` otherwise
.. function:: ot_layout_language_get_feature_indexes(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_index: int, start_offset: int) -> ~typing.Tuple[int, list[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.
.. versionadded:: 0.6.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_index: The index of the requested language tag
:param start_offset: offset of the first feature tag to retrieve
:return: Total number of features.
.. function:: ot_layout_language_get_feature_tags(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_index: int, start_offset: int) -> ~typing.Tuple[int, list[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.
.. versionadded:: 0.6.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_index: The index of the requested language tag
:param start_offset: offset of the first feature tag to retrieve
:return: Total number of feature tags.
.. function:: ot_layout_language_get_required_feature(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_index: int) -> ~typing.Tuple[int, int, int]
Fetches the tag of a requested feature index in the given face's GSUB or GPOS table,
underneath the specified script and language.
.. versionadded:: 0.9.30
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_index: The index of the requested language tag
:return: ``true`` if the feature is found, ``false`` otherwise
.. function:: ot_layout_language_get_required_feature_index(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_index: int) -> ~typing.Tuple[int, int]
Fetches the index of a requested feature in the given face's GSUB or GPOS table,
underneath the specified script and language.
.. versionadded:: 0.6.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_index: The index of the requested language tag
:return: ``true`` if the feature is found, ``false`` otherwise
.. function:: ot_layout_lookup_collect_glyphs(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, lookup_index: int) -> ~typing.Tuple[~gi.repository.HarfBuzz.set_t, ~gi.repository.HarfBuzz.set_t, ~gi.repository.HarfBuzz.set_t, ~gi.repository.HarfBuzz.set_t]
Fetches a list of all glyphs affected by the specified lookup in the
specified face's GSUB table or GPOS table.
.. versionadded:: 0.9.7
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param lookup_index: The index of the feature lookup to query
.. function:: ot_layout_lookup_get_glyph_alternates(face: ~gi.repository.HarfBuzz.face_t, lookup_index: int, glyph: int, start_offset: int) -> ~typing.Tuple[int, list[int]]
Fetches alternates of a glyph from a given GSUB lookup index.
.. versionadded:: 2.6.8
:param face: a face.
:param lookup_index: index of the feature lookup to query.
:param glyph: a glyph id.
:param start_offset: starting offset.
:return: Total number of alternates found in the specific lookup index for the given glyph id.
.. function:: ot_layout_lookup_get_optical_bound(font: ~gi.repository.HarfBuzz.font_t, lookup_index: int, direction: ~gi.repository.HarfBuzz.direction_t, glyph: int) -> int
Fetches the optical bound of a glyph positioned at the margin of text.
The direction identifies which edge of the glyph to query.
.. versionadded:: 5.3.0
:param font: a font.
:param lookup_index: index of the feature lookup to query.
:param direction: edge of the glyph to query.
:param glyph: a glyph id.
:return: Adjustment value. Negative values mean the glyph will stick out of the margin.
.. function:: ot_layout_lookup_substitute_closure(face: ~gi.repository.HarfBuzz.face_t, lookup_index: int) -> ~gi.repository.HarfBuzz.set_t
Compute the transitive closure of glyphs needed for a
specified lookup.
.. versionadded:: 0.9.7
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param lookup_index: index of the feature lookup to query
.. function:: ot_layout_lookup_would_substitute(face: ~gi.repository.HarfBuzz.face_t, lookup_index: int, glyphs: int, glyphs_length: int, zero_context: int) -> int
Tests whether a specified lookup in the specified face would
trigger a substitution on the given glyph sequence.
.. versionadded:: 0.9.7
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param lookup_index: The index of the lookup to query
:param glyphs: The sequence of glyphs to query for substitution
:param glyphs_length: The length of the glyph sequence
:param zero_context: :obj:`~gi.repository.HarfBuzz.bool_t` indicating whether pre-/post-context are disallowed
in substitutions
:return: ``true`` if a substitution would be triggered, ``false`` otherwise
.. function:: ot_layout_lookups_substitute_closure(face: ~gi.repository.HarfBuzz.face_t, lookups: ~gi.repository.HarfBuzz.set_t) -> ~gi.repository.HarfBuzz.set_t
Compute the transitive closure of glyphs needed for all of the
provided lookups.
.. versionadded:: 1.8.1
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param lookups: The set of lookups to query
.. function:: ot_layout_script_find_language(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_tag: int, language_index: int) -> int
Fetches the index of a given language tag in the specified face's GSUB table
or GPOS table, underneath the specified script tag.
.. versionadded:: 0.6.0
.. deprecated:: 2.0.0
Please do not use it in newly written code
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_tag: The :obj:`~gi.repository.HarfBuzz.tag_t` of the requested language
:param language_index: The index of the requested language
:return: ``true`` if the language tag is found, ``false`` otherwise
.. function:: ot_layout_script_get_language_tags(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, start_offset: int) -> ~typing.Tuple[int, list[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.
.. versionadded:: 0.6.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param start_offset: offset of the first language tag to retrieve
:return: Total number of language tags.
.. function:: ot_layout_script_select_language(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_count: int, language_tags: int) -> ~typing.Tuple[int, int]
Fetches the index of the first language tag fom ``language_tags`` that is present
in the specified face's GSUB or GPOS table, underneath the specified script
index.
If none of the given language tags is found, ``false`` is returned and
``language_index`` is set to the default language index.
.. versionadded:: 2.0.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_count: The number of languages in the specified script
:param language_tags: The array of language tags
:return: ``true`` if one of the given language tags is found, ``false`` otherwise
.. function:: ot_layout_script_select_language2(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_index: int, language_count: int, language_tags: int) -> ~typing.Tuple[int, int, int]
Fetches the index of the first language tag fom ``language_tags`` that is present
in the specified face's GSUB or GPOS table, underneath the specified script
index.
If none of the given language tags is found, ``false`` is returned and
``language_index`` is set to ``HB_OT_LAYOUT_DEFAULT_LANGUAGE_INDEX`` and
``chosen_language`` is set to ``HB_TAG_NONE``.
.. versionadded:: 7.0.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_index: The index of the requested script tag
:param language_count: The number of languages in the specified script
:param language_tags: The array of language tags
:return: ``true`` if one of the given language tags is found, ``false`` otherwise
.. function:: ot_layout_table_choose_script(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_tags: int) -> ~typing.Tuple[int, int, int]
Deprecated since 2.0.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_tags: Array of :obj:`~gi.repository.HarfBuzz.tag_t` script tags
.. function:: ot_layout_table_find_feature_variations(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, coords: int, num_coords: int) -> ~typing.Tuple[int, int]
Fetches a list of feature variations in the specified face's GSUB table
or GPOS table, at the specified variation coordinates.
.. versionadded:: 1.4.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param coords: The variation coordinates to query
:param num_coords: The number of variation coordinates
:return: ``true`` if feature variations were found, ``false`` otherwise.
.. function:: ot_layout_table_find_script(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_tag: int) -> ~typing.Tuple[int, int]
Fetches the index if a given script tag in the specified face's GSUB table
or GPOS table.
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_tag: :obj:`~gi.repository.HarfBuzz.tag_t` of the script tag requested
:return: ``true`` if the script is found, ``false`` otherwise
.. function:: ot_layout_table_get_feature_tags(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, start_offset: int) -> ~typing.Tuple[int, list[int]]
Fetches a list of all feature tags in the given face's GSUB or GPOS table.
Note that there might be duplicate feature tags, belonging to different
script/language-system pairs of the table.
.. versionadded:: 0.6.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param start_offset: offset of the first feature tag to retrieve
:return: Total number of feature tags.
.. function:: ot_layout_table_get_lookup_count(face: ~gi.repository.HarfBuzz.face_t, table_tag: int) -> int
Fetches the total number of lookups enumerated in the specified
face's GSUB table or GPOS table.
.. versionadded:: 0.9.22
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:return: Total number of lookups.
.. function:: ot_layout_table_get_script_tags(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, start_offset: int) -> ~typing.Tuple[int, list[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.
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param start_offset: offset of the first script tag to retrieve
:return: Total number of script tags.
.. function:: ot_layout_table_select_script(face: ~gi.repository.HarfBuzz.face_t, table_tag: int, script_count: int, script_tags: int) -> ~typing.Tuple[int, int, int]
Selects an OpenType script for ``table_tag`` from the ``script_tags`` array.
If the table does not have any of the requested scripts, then ``DFLT``\,
``dflt``\, and ``latn`` tags are tried in that order. If the table still does not
have any of these scripts, ``script_index`` is set to
``HB_OT_LAYOUT_NO_SCRIPT_INDEX`` and ``chosen_script`` is set to ``HB_TAG_NONE``.
.. versionadded:: 2.0.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param table_tag: ``HB_OT_TAG_GSUB`` or ``HB_OT_TAG_GPOS``
:param script_count: Number of script tags in the array
:param script_tags: Array of :obj:`~gi.repository.HarfBuzz.tag_t` script tags
:return: ``true`` if one of the requested scripts is selected, ``false`` if a fallback
script is selected or if no scripts are selected.
.. function:: ot_math_get_constant(font: ~gi.repository.HarfBuzz.font_t, constant: ~gi.repository.HarfBuzz.ot_math_constant_t) -> int
Fetches the specified math constant. For most constants, the value returned
is an :obj:`~gi.repository.HarfBuzz.position_t`\.
However, if the requested constant is ``HB_OT_MATH_CONSTANT_SCRIPT_PERCENT_SCALE_DOWN``,
``HB_OT_MATH_CONSTANT_SCRIPT_SCRIPT_PERCENT_SCALE_DOWN`` or
``HB_OT_MATH_CONSTANT_RADICAL_DEGREE_BOTTOM_RAISE_PERCENT``, then the return value is
an integer between 0 and 100 representing that percentage.
.. versionadded:: 1.3.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param constant: :obj:`~gi.repository.HarfBuzz.ot_math_constant_t` the constant to retrieve
:return: the requested constant or zero
.. function:: ot_math_get_glyph_assembly(font: ~gi.repository.HarfBuzz.font_t, glyph: int, direction: ~gi.repository.HarfBuzz.direction_t, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.HarfBuzz.ot_math_glyph_part_t], int]
Fetches the GlyphAssembly for the specified font, glyph index, and direction.
Returned are a list of :obj:`~gi.repository.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 :obj:`~gi.repository.HarfBuzz.direction_t`
values are accepted, only the result of ``HB_DIRECTION_IS_HORIZONTAL`` is
considered.
.. versionadded:: 1.3.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The index of the glyph to stretch
:param direction: direction of the stretching (horizontal or vertical)
:param start_offset: offset of the first glyph part to retrieve
:return: the total number of parts in the glyph assembly
.. function:: ot_math_get_glyph_italics_correction(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> int
Fetches an italics-correction value (if one exists) for the specified
glyph index.
.. versionadded:: 1.3.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph index from which to retrieve the value
:return: the italics correction of the glyph or zero
.. function:: ot_math_get_glyph_kerning(font: ~gi.repository.HarfBuzz.font_t, glyph: int, kern: ~gi.repository.HarfBuzz.ot_math_kern_t, correction_height: int) -> 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.
.. versionadded:: 1.3.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph index from which to retrieve the value
:param kern: The :obj:`~gi.repository.HarfBuzz.ot_math_kern_t` from which to retrieve the value
:param correction_height: the correction height to use to determine the kerning.
:return: requested kerning value or zero
.. function:: ot_math_get_glyph_kernings(font: ~gi.repository.HarfBuzz.font_t, glyph: int, kern: ~gi.repository.HarfBuzz.ot_math_kern_t, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.HarfBuzz.ot_math_kern_entry_t]]
Fetches the raw MathKern (cut-in) data for the specified font, glyph index,
and ``kern``\. The corresponding list of kern values and correction heights is
returned as a list of :obj:`~gi.repository.HarfBuzz.ot_math_kern_entry_t` structs.
See also ``hb_ot_math_get_glyph_kerning``, which handles selecting the
appropriate kern value for a given correction height.
For a glyph with ``n`` defined kern values (where ``n`` > 0), there are only
``n``\−1 defined correction heights, as each correction height defines a boundary
past which the next kern value should be selected. Therefore, only the
:obj:`~gi.repository.HarfBuzz.ot_math_kern_entry_t`\.kern_value of the uppermost :obj:`~gi.repository.HarfBuzz.ot_math_kern_entry_t`
actually comes from the font; its corresponding
:obj:`~gi.repository.HarfBuzz.ot_math_kern_entry_t`\.max_correction_height is always set to
INT32_MAX
.
.. versionadded:: 3.4.0
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph index from which to retrieve the kernings
:param kern: The :obj:`~gi.repository.HarfBuzz.ot_math_kern_t` from which to retrieve the kernings
:param start_offset: offset of the first kern entry to retrieve
:return: the total number of kern values available or zero
.. function:: ot_math_get_glyph_top_accent_attachment(font: ~gi.repository.HarfBuzz.font_t, glyph: int) -> 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.
.. versionadded:: 1.3.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The glyph index from which to retrieve the value
:return: the top accent attachment of the glyph or 0.5 \* the advance
width of ``glyph``
.. function:: ot_math_get_glyph_variants(font: ~gi.repository.HarfBuzz.font_t, glyph: int, direction: ~gi.repository.HarfBuzz.direction_t, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.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
:obj:`~gi.repository.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 :obj:`~gi.repository.HarfBuzz.direction_t`
values are accepted, only the result of ``HB_DIRECTION_IS_HORIZONTAL`` is
considered.
.. versionadded:: 1.3.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param glyph: The index of the glyph to stretch
:param direction: The direction of the stretching (horizontal or vertical)
:param start_offset: offset of the first variant to retrieve
:return: the total number of size variants available or zero
.. function:: ot_math_get_min_connector_overlap(font: ~gi.repository.HarfBuzz.font_t, direction: ~gi.repository.HarfBuzz.direction_t) -> 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 :obj:`~gi.repository.HarfBuzz.direction_t`
values are accepted, only the result of ``HB_DIRECTION_IS_HORIZONTAL`` is
considered.
.. versionadded:: 1.3.3
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param direction: direction of the stretching (horizontal or vertical)
:return: requested minimum connector overlap or zero
.. function:: ot_math_has_data(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether a face has a ``MATH`` table.
.. versionadded:: 1.3.3
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to test
:return: ``true`` if the table is found, ``false`` otherwise
.. function:: ot_math_is_glyph_extended_shape(face: ~gi.repository.HarfBuzz.face_t, glyph: int) -> int
Tests whether the given glyph index is an extended shape in the face.
.. versionadded:: 1.3.3
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param glyph: The glyph index to test
:return: ``true`` if the glyph is an extended shape, ``false`` otherwise
.. function:: ot_meta_get_entry_tags(face: ~gi.repository.HarfBuzz.face_t, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.HarfBuzz.ot_meta_tag_t]]
Fetches all available feature types.
.. versionadded:: 2.6.0
:param face: a face object
:param start_offset: iteration's start offset
:return: Number of all available feature types.
.. function:: ot_meta_reference_entry(face: ~gi.repository.HarfBuzz.face_t, meta_tag: ~gi.repository.HarfBuzz.ot_meta_tag_t) -> ~gi.repository.HarfBuzz.blob_t
It fetches metadata entry of a given tag from a font.
.. versionadded:: 2.6.0
:param face: a :obj:`~gi.repository.HarfBuzz.face_t` object.
:param meta_tag: tag of metadata you like to have.
:return: A blob containing the blob.
.. function:: ot_metrics_get_position(font: ~gi.repository.HarfBuzz.font_t, metrics_tag: ~gi.repository.HarfBuzz.ot_metrics_tag_t) -> ~typing.Tuple[int, int]
Fetches metrics value corresponding to ``metrics_tag`` from ``font``\.
.. versionadded:: 2.6.0
:param font: an :obj:`~gi.repository.HarfBuzz.font_t` object.
:param metrics_tag: tag of metrics value you like to fetch.
:return: Whether found the requested metrics in the font.
.. function:: ot_metrics_get_position_with_fallback(font: ~gi.repository.HarfBuzz.font_t, metrics_tag: ~gi.repository.HarfBuzz.ot_metrics_tag_t) -> int
Fetches metrics value corresponding to ``metrics_tag`` from ``font``\,
and synthesizes a value if it the value is missing in the font.
.. versionadded:: 4.0.0
:param font: an :obj:`~gi.repository.HarfBuzz.font_t` object.
:param metrics_tag: tag of metrics value you like to fetch.
.. function:: ot_metrics_get_variation(font: ~gi.repository.HarfBuzz.font_t, metrics_tag: ~gi.repository.HarfBuzz.ot_metrics_tag_t) -> float
Fetches metrics value corresponding to ``metrics_tag`` from ``font`` with the
current font variation settings applied.
.. versionadded:: 2.6.0
:param font: an :obj:`~gi.repository.HarfBuzz.font_t` object.
:param metrics_tag: tag of metrics value you like to fetch.
:return: The requested metric value.
.. function:: ot_metrics_get_x_variation(font: ~gi.repository.HarfBuzz.font_t, metrics_tag: ~gi.repository.HarfBuzz.ot_metrics_tag_t) -> int
Fetches horizontal metrics value corresponding to ``metrics_tag`` from ``font``
with the current font variation settings applied.
.. versionadded:: 2.6.0
:param font: an :obj:`~gi.repository.HarfBuzz.font_t` object.
:param metrics_tag: tag of metrics value you like to fetch.
:return: The requested metric value.
.. function:: ot_metrics_get_y_variation(font: ~gi.repository.HarfBuzz.font_t, metrics_tag: ~gi.repository.HarfBuzz.ot_metrics_tag_t) -> int
Fetches vertical metrics value corresponding to ``metrics_tag`` from ``font`` with
the current font variation settings applied.
.. versionadded:: 2.6.0
:param font: an :obj:`~gi.repository.HarfBuzz.font_t` object.
:param metrics_tag: tag of metrics value you like to fetch.
:return: The requested metric value.
.. function:: ot_name_get_utf16(face: ~gi.repository.HarfBuzz.face_t, name_id: int, language: ~gi.repository.HarfBuzz.language_t) -> ~typing.Tuple[int, list[int]]
Fetches a font name from the OpenType 'name' table.
If ``language`` is ``HB_LANGUAGE_INVALID``, English ("en") is assumed.
Returns string in UTF-16 encoding. A NUL terminator is always written
for convenience, and isn't included in the output ``text_size``\.
.. versionadded:: 2.1.0
:param face: font face.
:param name_id: OpenType name identifier to fetch.
:param language: language to fetch the name for.
:return: full length of the requested string, or 0 if not found.
.. function:: ot_name_get_utf32(face: ~gi.repository.HarfBuzz.face_t, name_id: int, language: ~gi.repository.HarfBuzz.language_t) -> ~typing.Tuple[int, list[int]]
Fetches a font name from the OpenType 'name' table.
If ``language`` is ``HB_LANGUAGE_INVALID``, English ("en") is assumed.
Returns string in UTF-32 encoding. A NUL terminator is always written
for convenience, and isn't included in the output ``text_size``\.
.. versionadded:: 2.1.0
:param face: font face.
:param name_id: OpenType name identifier to fetch.
:param language: language to fetch the name for.
:return: full length of the requested string, or 0 if not found.
.. function:: ot_name_get_utf8(face: ~gi.repository.HarfBuzz.face_t, name_id: int, language: ~gi.repository.HarfBuzz.language_t) -> ~typing.Tuple[int, list[str]]
Fetches a font name from the OpenType 'name' table.
If ``language`` is ``HB_LANGUAGE_INVALID``, English ("en") is assumed.
Returns string in UTF-8 encoding. A NUL terminator is always written
for convenience, and isn't included in the output ``text_size``\.
.. versionadded:: 2.1.0
:param face: font face.
:param name_id: OpenType name identifier to fetch.
:param language: language to fetch the name for.
:return: full length of the requested string, or 0 if not found.
.. function:: ot_name_list_names(face: ~gi.repository.HarfBuzz.face_t) -> list[~gi.repository.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.
.. versionadded:: 2.1.0
:param face: font face.
:return: Array of available name entries.
.. function:: ot_shape_glyphs_closure(font: ~gi.repository.HarfBuzz.font_t, buffer: ~gi.repository.HarfBuzz.buffer_t, features: list[~gi.repository.HarfBuzz.feature_t]) -> ~gi.repository.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.
.. versionadded:: 0.9.2
:param font: :obj:`~gi.repository.HarfBuzz.font_t` to work upon
:param buffer: The input buffer to compute from
:param features: The features enabled on the buffer
.. function:: ot_shape_plan_collect_lookups(shape_plan: ~gi.repository.HarfBuzz.shape_plan_t, table_tag: int) -> ~gi.repository.HarfBuzz.set_t
Computes the complete set of GSUB or GPOS lookups that are applicable
under a given ``shape_plan``\.
.. versionadded:: 0.9.7
:param shape_plan: :obj:`~gi.repository.HarfBuzz.shape_plan_t` to query
:param table_tag: GSUB or GPOS
.. function:: ot_tag_from_language(language: ~gi.repository.HarfBuzz.language_t) -> int
Converts an :obj:`~gi.repository.HarfBuzz.language_t` to an :obj:`~gi.repository.HarfBuzz.tag_t`\.
.. versionadded:: 0.6.0
.. deprecated:: 2.0.0
use :func:`~gi.repository.HarfBuzz.ot_tags_from_script_and_language` instead
:param language: an :obj:`~gi.repository.HarfBuzz.language_t` to convert.
.. function:: ot_tag_to_language(tag: int) -> ~gi.repository.HarfBuzz.language_t | None
Converts a language tag to an :obj:`~gi.repository.HarfBuzz.language_t`\.
.. versionadded:: 0.9.2
:param tag: an language tag
:return: The :obj:`~gi.repository.HarfBuzz.language_t` corresponding to ``tag``\.
.. function:: ot_tag_to_script(tag: int) -> ~gi.repository.HarfBuzz.script_t
Converts a script tag to an :obj:`~gi.repository.HarfBuzz.script_t`\.
:param tag: a script tag
:return: The :obj:`~gi.repository.HarfBuzz.script_t` corresponding to ``tag``\.
.. function:: ot_tags_from_script(script: ~gi.repository.HarfBuzz.script_t) -> ~typing.Tuple[int, int]
Converts an :obj:`~gi.repository.HarfBuzz.script_t` to script tags.
.. versionadded:: 0.6.0
.. deprecated:: 2.0.0
use :func:`~gi.repository.HarfBuzz.ot_tags_from_script_and_language` instead
:param script: an :obj:`~gi.repository.HarfBuzz.script_t` to convert.
.. function:: ot_tags_from_script_and_language(script: ~gi.repository.HarfBuzz.script_t, language: ~gi.repository.HarfBuzz.language_t | None = None, script_count: int = Ellipsis, language_count: int = Ellipsis) -> ~typing.Tuple[int, int, int, int]
Converts an :obj:`~gi.repository.HarfBuzz.script_t` and an :obj:`~gi.repository.HarfBuzz.language_t` to script and language tags.
.. versionadded:: 2.0.0
:param script: an :obj:`~gi.repository.HarfBuzz.script_t` to convert.
:param language: an :obj:`~gi.repository.HarfBuzz.language_t` to convert.
:param script_count: maximum number of script tags to retrieve (IN)
and actual number of script tags retrieved (OUT)
:param language_count: maximum number of language tags to retrieve
(IN) and actual number of language tags retrieved (OUT)
.. function:: ot_tags_to_script_and_language(script_tag: int, language_tag: int) -> ~typing.Tuple[~gi.repository.HarfBuzz.script_t, ~gi.repository.HarfBuzz.language_t]
Converts a script tag and a language tag to an :obj:`~gi.repository.HarfBuzz.script_t` and an
:obj:`~gi.repository.HarfBuzz.language_t`\.
.. versionadded:: 2.0.0
:param script_tag: a script tag
:param language_tag: a language tag
.. function:: ot_var_find_axis(face: ~gi.repository.HarfBuzz.face_t, axis_tag: int, axis_index: int) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.ot_var_axis_t]
Fetches the variation-axis information corresponding to the specified axis tag
in the specified face.
.. versionadded:: 1.4.2
.. deprecated:: 2.2.0
- use :func:`~gi.repository.HarfBuzz.ot_var_find_axis_info` instead
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param axis_tag: The :obj:`~gi.repository.HarfBuzz.tag_t` of the variation axis to query
:param axis_index: The index of the variation axis
.. function:: ot_var_find_axis_info(face: ~gi.repository.HarfBuzz.face_t, axis_tag: int) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.ot_var_axis_info_t]
Fetches the variation-axis information corresponding to the specified axis tag
in the specified face.
.. versionadded:: 2.2.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param axis_tag: The :obj:`~gi.repository.HarfBuzz.tag_t` of the variation axis to query
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_var_get_axes(face: ~gi.repository.HarfBuzz.face_t, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.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.
.. versionadded:: 1.4.2
.. deprecated:: 2.2.0
use :func:`~gi.repository.HarfBuzz.ot_var_get_axis_infos` instead
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param start_offset: offset of the first lookup to retrieve
.. function:: ot_var_get_axis_count(face: ~gi.repository.HarfBuzz.face_t) -> int
Fetches the number of OpenType variation axes included in the face.
.. versionadded:: 1.4.2
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:return: the number of variation axes defined
.. function:: ot_var_get_axis_infos(face: ~gi.repository.HarfBuzz.face_t, start_offset: int) -> ~typing.Tuple[int, list[~gi.repository.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.
.. versionadded:: 2.2.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to work upon
:param start_offset: offset of the first lookup to retrieve
:return: the number of variation axes in the face
.. function:: ot_var_get_named_instance_count(face: ~gi.repository.HarfBuzz.face_t) -> int
Fetches the number of named instances included in the face.
.. versionadded:: 2.2.0
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:return: the number of named instances defined
.. function:: ot_var_has_data(face: ~gi.repository.HarfBuzz.face_t) -> int
Tests whether a face includes any OpenType variation data in the ``fvar`` table.
.. versionadded:: 1.4.2
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:return: ``true`` if data found, ``false`` otherwise
.. function:: ot_var_named_instance_get_design_coords(face: ~gi.repository.HarfBuzz.face_t, instance_index: int) -> ~typing.Tuple[int, list[float]]
Fetches the design-space coordinates corresponding to the given
named instance in the face.
.. versionadded:: 2.2.0
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:param instance_index: The index of the named instance to query
:return: the number of variation axes in the face
.. function:: ot_var_named_instance_get_postscript_name_id(face: ~gi.repository.HarfBuzz.face_t, instance_index: int) -> int
Fetches the ``name`` table Name ID that provides display names for
the "PostScript name" defined for the given named instance in the face.
.. versionadded:: 2.2.0
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:param instance_index: The index of the named instance to query
:return: the Name ID found for the PostScript name
.. function:: ot_var_named_instance_get_subfamily_name_id(face: ~gi.repository.HarfBuzz.face_t, instance_index: int) -> int
Fetches the ``name`` table Name ID that provides display names for
the "Subfamily name" defined for the given named instance in the face.
.. versionadded:: 2.2.0
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:param instance_index: The index of the named instance to query
:return: the Name ID found for the Subfamily name
.. function:: ot_var_normalize_coords(face: ~gi.repository.HarfBuzz.face_t, coords_length: int, design_coords: float) -> 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.
The normalized values have 14 bits of fixed-point sub-integer precision as per
OpenType specification.
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
.. versionadded:: 1.4.2
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:param coords_length: The length of the coordinate array
:param design_coords: The design-space coordinates to normalize
.. function:: ot_var_normalize_variations(face: ~gi.repository.HarfBuzz.face_t, variations: ~gi.repository.HarfBuzz.variation_t, variations_length: int) -> list[int]
Normalizes all of the coordinates in the given list of variation axes.
.. versionadded:: 1.4.2
:param face: The :obj:`~gi.repository.HarfBuzz.face_t` to work on
:param variations: The array of variations to normalize
:param variations_length: The number of variations to normalize
.. function:: paint_color(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, is_foreground: int, color: int) -> None
Perform a "color" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param is_foreground: whether the color is the foreground
:param color: The color to use
.. function:: paint_color_glyph(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, glyph: int, font: ~gi.repository.HarfBuzz.font_t) -> int
Perform a "color-glyph" paint operation.
.. versionadded:: 8.2.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param glyph: the glyph ID
:param font: the font
.. function:: paint_custom_palette_color(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, color_index: int) -> ~typing.Tuple[int, int]
Gets the custom palette color for ``color_index``\.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param color_index: color index
:return: ``true`` if found, ``false`` otherwise
.. function:: paint_funcs_create() -> ~gi.repository.HarfBuzz.paint_funcs_t
Creates a new :obj:`~gi.repository.HarfBuzz.paint_funcs_t` structure of paint functions.
The initial reference count of 1 should be released with :func:`~gi.repository.HarfBuzz.paint_funcs_destroy`
when you are done using the :obj:`~gi.repository.HarfBuzz.paint_funcs_t`\. This function never returns
``NULL``\. If memory cannot be allocated, a special singleton :obj:`~gi.repository.HarfBuzz.paint_funcs_t`
object will be returned.
.. versionadded:: 7.0.0
:return: the paint-functions structure
.. function:: paint_funcs_get_empty() -> ~gi.repository.HarfBuzz.paint_funcs_t
Fetches the singleton empty paint-functions structure.
.. versionadded:: 7.0.0
:return: The empty paint-functions structure
.. function:: paint_funcs_is_immutable(funcs: ~gi.repository.HarfBuzz.paint_funcs_t) -> int
Tests whether a paint-functions structure is immutable.
.. versionadded:: 7.0.0
:param funcs: The paint-functions structure
:return: ``true`` if ``funcs`` is immutable, ``false`` otherwise
.. function:: paint_funcs_make_immutable(funcs: ~gi.repository.HarfBuzz.paint_funcs_t) -> None
Makes a paint-functions structure immutable.
After this call, all attempts to set one of the callbacks
on ``funcs`` will fail.
.. versionadded:: 7.0.0
:param funcs: The paint-functions structure
.. function:: paint_funcs_set_color_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, int, int, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the paint-color callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The paint-color callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_color_glyph_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, int, ~gi.repository.HarfBuzz.font_t, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the color-glyph callback on the paint functions struct.
.. versionadded:: 8.2.0
:param funcs: A paint functions struct
:param func: The color-glyph callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_custom_palette_color_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, int, ~typing.Any], ~typing.Tuple[int, int]], user_data: ~typing.Any = None) -> None
Sets the custom-palette-color callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The custom-palette-color callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_image_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.blob_t, int, int, int, float, ~gi.repository.HarfBuzz.glyph_extents_t | None, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the paint-image callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The paint-image callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_linear_gradient_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.color_line_t, float, float, float, float, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the linear-gradient callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The linear-gradient callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_pop_clip_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the pop-clip callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The pop-clip callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_pop_group_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.paint_composite_mode_t, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the pop-group callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The pop-group callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_pop_transform_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the pop-transform callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The pop-transform callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_push_clip_glyph_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, int, ~gi.repository.HarfBuzz.font_t, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the push-clip-glyph callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The push-clip-glyph callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_push_clip_rectangle_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, float, float, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the push-clip-rect callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The push-clip-rectangle callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_push_group_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the push-group callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The push-group callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_push_transform_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, float, float, float, float, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the push-transform callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The push-transform callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_radial_gradient_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.color_line_t, float, float, float, float, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the radial-gradient callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The radial-gradient callback
:param user_data: Data to pass to ``func``
.. function:: paint_funcs_set_sweep_gradient_func(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.paint_funcs_t, ~typing.Any, ~gi.repository.HarfBuzz.color_line_t, float, float, float, float, ~typing.Any], None], user_data: ~typing.Any = None) -> None
Sets the sweep-gradient callback on the paint functions struct.
.. versionadded:: 7.0.0
:param funcs: A paint functions struct
:param func: The sweep-gradient callback
:param user_data: Data to pass to ``func``
.. function:: paint_image(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, image: ~gi.repository.HarfBuzz.blob_t, width: int, height: int, format: int, slant: float, extents: ~gi.repository.HarfBuzz.glyph_extents_t | None = None) -> None
Perform a "image" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param image: image data
:param width: width of the raster image in pixels, or 0
:param height: height of the raster image in pixels, or 0
:param format: the image format as a tag
:param slant: the synthetic slant ratio to be applied to the image during rendering
:param extents: the extents of the glyph
.. function:: paint_linear_gradient(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, color_line: ~gi.repository.HarfBuzz.color_line_t, x0: float, y0: float, x1: float, y1: float, x2: float, y2: float) -> None
Perform a "linear-gradient" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param color_line: Color information for the gradient
:param x0: X coordinate of the first point
:param y0: Y coordinate of the first point
:param x1: X coordinate of the second point
:param y1: Y coordinate of the second point
:param x2: X coordinate of the third point
:param y2: Y coordinate of the third point
.. function:: paint_pop_clip(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any = None) -> None
Perform a "pop-clip" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
.. function:: paint_pop_group(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, mode: ~gi.repository.HarfBuzz.paint_composite_mode_t) -> None
Perform a "pop-group" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param mode: the compositing mode to use
.. function:: paint_pop_transform(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any = None) -> None
Perform a "pop-transform" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
.. function:: paint_push_clip_glyph(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, glyph: int, font: ~gi.repository.HarfBuzz.font_t) -> None
Perform a "push-clip-glyph" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param glyph: the glyph ID
:param font: the font
.. function:: paint_push_clip_rectangle(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, xmin: float, ymin: float, xmax: float, ymax: float) -> None
Perform a "push-clip-rect" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param xmin: min X for the rectangle
:param ymin: min Y for the rectangle
:param xmax: max X for the rectangle
:param ymax: max Y for the rectangle
.. function:: paint_push_group(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any = None) -> None
Perform a "push-group" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
.. function:: paint_push_transform(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, xx: float, yx: float, xy: float, yy: float, dx: float, dy: float) -> None
Perform a "push-transform" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param xx: xx component of the transform matrix
:param yx: yx component of the transform matrix
:param xy: xy component of the transform matrix
:param yy: yy component of the transform matrix
:param dx: dx component of the transform matrix
:param dy: dy component of the transform matrix
.. function:: paint_radial_gradient(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, color_line: ~gi.repository.HarfBuzz.color_line_t, x0: float, y0: float, r0: float, x1: float, y1: float, r1: float) -> None
Perform a "radial-gradient" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param color_line: Color information for the gradient
:param x0: X coordinate of the first circle's center
:param y0: Y coordinate of the first circle's center
:param r0: radius of the first circle
:param x1: X coordinate of the second circle's center
:param y1: Y coordinate of the second circle's center
:param r1: radius of the second circle
.. function:: paint_sweep_gradient(funcs: ~gi.repository.HarfBuzz.paint_funcs_t, paint_data: ~typing.Any, color_line: ~gi.repository.HarfBuzz.color_line_t, x0: float, y0: float, start_angle: float, end_angle: float) -> None
Perform a "sweep-gradient" paint operation.
.. versionadded:: 7.0.0
:param funcs: paint functions
:param paint_data: associated data passed by the caller
:param color_line: Color information for the gradient
:param x0: X coordinate of the circle's center
:param y0: Y coordinate of the circle's center
:param start_angle: the start angle
:param end_angle: the end angle
.. function:: script_from_iso15924_tag(tag: int) -> ~gi.repository.HarfBuzz.script_t
Converts an ISO 15924 script tag to a corresponding :obj:`~gi.repository.HarfBuzz.script_t`\.
.. versionadded:: 0.9.2
:param tag: an :obj:`~gi.repository.HarfBuzz.tag_t` representing an ISO 15924 tag.
:return: An :obj:`~gi.repository.HarfBuzz.script_t` corresponding to the ISO 15924 tag.
.. function:: script_from_string(str: list[int]) -> ~gi.repository.HarfBuzz.script_t
Converts a string ``str`` representing an ISO 15924 script tag to a
corresponding :obj:`~gi.repository.HarfBuzz.script_t`\. Shorthand for :func:`~gi.repository.HarfBuzz.tag_from_string` then
:func:`~gi.repository.HarfBuzz.script_from_iso15924_tag`.
.. versionadded:: 0.9.2
:param str: a string representing an
ISO 15924 tag.
:return: An :obj:`~gi.repository.HarfBuzz.script_t` corresponding to the ISO 15924 tag.
.. function:: script_get_horizontal_direction(script: ~gi.repository.HarfBuzz.script_t) -> ~gi.repository.HarfBuzz.direction_t
Fetches the :obj:`~gi.repository.HarfBuzz.direction_t` of a script when it is
set horizontally. All right-to-left scripts will return
``HB_DIRECTION_RTL``. All left-to-right scripts will return
``HB_DIRECTION_LTR``. Scripts that can be written either
horizontally or vertically will return ``HB_DIRECTION_INVALID``.
Unknown scripts will return ``HB_DIRECTION_LTR``.
.. versionadded:: 0.9.2
:param script: The :obj:`~gi.repository.HarfBuzz.script_t` to query
:return: The horizontal :obj:`~gi.repository.HarfBuzz.direction_t` of ``script``
.. function:: script_to_iso15924_tag(script: ~gi.repository.HarfBuzz.script_t) -> int
Converts an :obj:`~gi.repository.HarfBuzz.script_t` to a corresponding ISO 15924 script tag.
.. versionadded:: 0.9.2
:param script: an :obj:`~gi.repository.HarfBuzz.script_t` to convert.
:return: An :obj:`~gi.repository.HarfBuzz.tag_t` representing an ISO 15924 script tag.
.. function:: segment_properties_equal(a: ~gi.repository.HarfBuzz.segment_properties_t, b: ~gi.repository.HarfBuzz.segment_properties_t) -> int
Checks the equality of two :obj:`~gi.repository.HarfBuzz.segment_properties_t`\'s.
.. versionadded:: 0.9.7
:param a: first :obj:`~gi.repository.HarfBuzz.segment_properties_t` to compare.
:param b: second :obj:`~gi.repository.HarfBuzz.segment_properties_t` to compare.
:return: ``true`` if all properties of ``a`` equal those of ``b``\, ``false`` otherwise.
.. function:: segment_properties_hash(p: ~gi.repository.HarfBuzz.segment_properties_t) -> int
Creates a hash representing ``p``\.
.. versionadded:: 0.9.7
:param p: :obj:`~gi.repository.HarfBuzz.segment_properties_t` to hash.
:return: A hash of ``p``\.
.. function:: segment_properties_overlay(p: ~gi.repository.HarfBuzz.segment_properties_t, src: ~gi.repository.HarfBuzz.segment_properties_t) -> None
Fills in missing fields of ``p`` from ``src`` in a considered manner.
First, if ``p`` does not have direction set, direction is copied from ``src``\.
Next, if ``p`` and ``src`` have the same direction (which can be unset), if ``p``
does not have script set, script is copied from ``src``\.
Finally, if ``p`` and ``src`` have the same direction and script (which either
can be unset), if ``p`` does not have language set, language is copied from
``src``\.
.. versionadded:: 3.3.0
:param p: :obj:`~gi.repository.HarfBuzz.segment_properties_t` to fill in.
:param src: :obj:`~gi.repository.HarfBuzz.segment_properties_t` to fill in from.
.. function:: set_add(set: ~gi.repository.HarfBuzz.set_t, codepoint: int) -> None
Adds ``codepoint`` to ``set``\.
.. versionadded:: 0.9.2
:param set: A set
:param codepoint: The element to add to ``set``
.. function:: set_add_range(set: ~gi.repository.HarfBuzz.set_t, first: int, last: int) -> None
Adds all of the elements from ``first`` to ``last``
(inclusive) to ``set``\.
.. versionadded:: 0.9.7
:param set: A set
:param first: The first element to add to ``set``
:param last: The final element to add to ``set``
.. function:: set_add_sorted_array(set: ~gi.repository.HarfBuzz.set_t, sorted_codepoints: list[int]) -> None
Adds ``num_codepoints`` codepoints to a set at once.
The codepoints array must be in increasing order,
with size at least ``num_codepoints``\.
.. versionadded:: 4.1.0
:param set: A set
:param sorted_codepoints: Array of codepoints to add
.. function:: set_allocation_successful(set: ~gi.repository.HarfBuzz.set_t) -> int
Tests whether memory allocation for a set was successful.
.. versionadded:: 0.9.2
:param set: A set
:return: ``true`` if allocation succeeded, ``false`` otherwise
.. function:: set_clear(set: ~gi.repository.HarfBuzz.set_t) -> None
Clears out the contents of a set.
.. versionadded:: 0.9.2
:param set: A set
.. function:: set_create() -> ~gi.repository.HarfBuzz.set_t
Creates a new, initially empty set.
.. versionadded:: 0.9.2
:return: The new :obj:`~gi.repository.HarfBuzz.set_t`
.. function:: set_del(set: ~gi.repository.HarfBuzz.set_t, codepoint: int) -> None
Removes ``codepoint`` from ``set``\.
.. versionadded:: 0.9.2
:param set: A set
:param codepoint: Removes ``codepoint`` from ``set``
.. function:: set_del_range(set: ~gi.repository.HarfBuzz.set_t, first: int, last: int) -> None
Removes all of the elements from ``first`` to ``last``
(inclusive) from ``set``\.
If ``last`` is ``HB_SET_VALUE_INVALID``, then all values
greater than or equal to ``first`` are removed.
.. versionadded:: 0.9.7
:param set: A set
:param first: The first element to remove from ``set``
:param last: The final element to remove from ``set``
.. function:: set_get_empty() -> ~gi.repository.HarfBuzz.set_t
Fetches the singleton empty :obj:`~gi.repository.HarfBuzz.set_t`\.
.. versionadded:: 0.9.2
:return: The empty :obj:`~gi.repository.HarfBuzz.set_t`
.. function:: set_get_max(set: ~gi.repository.HarfBuzz.set_t) -> int
Finds the largest element in the set.
.. versionadded:: 0.9.7
:param set: A set
:return: maximum of ``set``\, or ``HB_SET_VALUE_INVALID`` if ``set`` is empty.
.. function:: set_get_min(set: ~gi.repository.HarfBuzz.set_t) -> int
Finds the smallest element in the set.
.. versionadded:: 0.9.7
:param set: A set
:return: minimum of ``set``\, or ``HB_SET_VALUE_INVALID`` if ``set`` is empty.
.. function:: set_get_population(set: ~gi.repository.HarfBuzz.set_t) -> int
Returns the number of elements in the set.
.. versionadded:: 0.9.7
:param set: A set
:return: The population of ``set``
.. function:: set_has(set: ~gi.repository.HarfBuzz.set_t, codepoint: int) -> int
Tests whether ``codepoint`` belongs to ``set``\.
.. versionadded:: 0.9.2
:param set: A set
:param codepoint: The element to query
:return: ``true`` if ``codepoint`` is in ``set``\, ``false`` otherwise
.. function:: set_hash(set: ~gi.repository.HarfBuzz.set_t) -> int
Creates a hash representing ``set``\.
.. versionadded:: 4.4.0
:param set: A set
:return: A hash of ``set``\.
.. function:: set_intersect(set: ~gi.repository.HarfBuzz.set_t, other: ~gi.repository.HarfBuzz.set_t) -> None
Makes ``set`` the intersection of ``set`` and ``other``\.
.. versionadded:: 0.9.2
:param set: A set
:param other: Another set
.. function:: set_invert(set: ~gi.repository.HarfBuzz.set_t) -> None
Inverts the contents of ``set``\.
.. versionadded:: 3.0.0
:param set: A set
.. function:: set_is_empty(set: ~gi.repository.HarfBuzz.set_t) -> int
Tests whether a set is empty (contains no elements).
.. versionadded:: 0.9.7
:param set: a set.
:return: ``true`` if ``set`` is empty
.. function:: set_is_equal(set: ~gi.repository.HarfBuzz.set_t, other: ~gi.repository.HarfBuzz.set_t) -> int
Tests whether ``set`` and ``other`` are equal (contain the same
elements).
.. versionadded:: 0.9.7
:param set: A set
:param other: Another set
:return: ``true`` if the two sets are equal, ``false`` otherwise.
.. function:: set_is_inverted(set: ~gi.repository.HarfBuzz.set_t) -> int
Returns whether the set is inverted.
.. versionadded:: 7.0.0
:param set: A set
:return: ``true`` if the set is inverted, ``false`` otherwise
.. function:: set_is_subset(set: ~gi.repository.HarfBuzz.set_t, larger_set: ~gi.repository.HarfBuzz.set_t) -> int
Tests whether ``set`` is a subset of ``larger_set``\.
.. versionadded:: 1.8.1
:param set: A set
:param larger_set: Another set
:return: ``true`` if the ``set`` is a subset of (or equal to) ``larger_set``\, ``false`` otherwise.
.. function:: set_next(set: ~gi.repository.HarfBuzz.set_t, codepoint: int) -> ~typing.Tuple[int, int]
Fetches the next element in ``set`` that is greater than current value of ``codepoint``\.
Set ``codepoint`` to ``HB_SET_VALUE_INVALID`` to get started.
.. versionadded:: 0.9.2
:param set: A set
:param codepoint: Input = Code point to query
Output = Code point retrieved
:return: ``true`` if there was a next value, ``false`` otherwise
.. function:: set_next_many(set: ~gi.repository.HarfBuzz.set_t, codepoint: int, out: list[int]) -> int
Finds the next element in ``set`` that is greater than ``codepoint``\. Writes out
codepoints to ``out``\, until either the set runs out of elements, or ``size``
codepoints are written, whichever comes first.
.. versionadded:: 4.2.0
:param set: A set
:param codepoint: Outputting codepoints starting after this one.
Use ``HB_SET_VALUE_INVALID`` to get started.
:param out: An array of codepoints to write to.
:return: the number of values written.
.. function:: set_next_range(set: ~gi.repository.HarfBuzz.set_t, last: int) -> ~typing.Tuple[int, int, int]
Fetches the next consecutive range of elements in ``set`` that
are greater than current value of ``last``\.
Set ``last`` to ``HB_SET_VALUE_INVALID`` to get started.
.. versionadded:: 0.9.7
:param set: A set
:param last: Input = The current last code point in the range
Output = The last code point in the range
:return: ``true`` if there was a next range, ``false`` otherwise
.. function:: set_previous(set: ~gi.repository.HarfBuzz.set_t, codepoint: int) -> ~typing.Tuple[int, int]
Fetches the previous element in ``set`` that is lower than current value of ``codepoint``\.
Set ``codepoint`` to ``HB_SET_VALUE_INVALID`` to get started.
.. versionadded:: 1.8.0
:param set: A set
:param codepoint: Input = Code point to query
Output = Code point retrieved
:return: ``true`` if there was a previous value, ``false`` otherwise
.. function:: set_previous_range(set: ~gi.repository.HarfBuzz.set_t, first: int) -> ~typing.Tuple[int, int, int]
Fetches the previous consecutive range of elements in ``set`` that
are greater than current value of ``last``\.
Set ``first`` to ``HB_SET_VALUE_INVALID`` to get started.
.. versionadded:: 1.8.0
:param set: A set
:param first: Input = The current first code point in the range
Output = The first code point in the range
:return: ``true`` if there was a previous range, ``false`` otherwise
.. function:: set_set(set: ~gi.repository.HarfBuzz.set_t, other: ~gi.repository.HarfBuzz.set_t) -> None
Makes the contents of ``set`` equal to the contents of ``other``\.
.. versionadded:: 0.9.2
:param set: A set
:param other: Another set
.. function:: set_subtract(set: ~gi.repository.HarfBuzz.set_t, other: ~gi.repository.HarfBuzz.set_t) -> None
Subtracts the contents of ``other`` from ``set``\.
.. versionadded:: 0.9.2
:param set: A set
:param other: Another set
.. function:: set_symmetric_difference(set: ~gi.repository.HarfBuzz.set_t, other: ~gi.repository.HarfBuzz.set_t) -> None
Makes ``set`` the symmetric difference of ``set``
and ``other``\.
.. versionadded:: 0.9.2
:param set: A set
:param other: Another set
.. function:: set_union(set: ~gi.repository.HarfBuzz.set_t, other: ~gi.repository.HarfBuzz.set_t) -> None
Makes ``set`` the union of ``set`` and ``other``\.
.. versionadded:: 0.9.2
:param set: A set
:param other: Another set
.. function:: shape(font: ~gi.repository.HarfBuzz.font_t, buffer: ~gi.repository.HarfBuzz.buffer_t, features: list[~gi.repository.HarfBuzz.feature_t] | None = None) -> None
Shapes ``buffer`` using ``font`` turning its Unicode characters content to
positioned glyphs. If ``features`` is not ``NULL``\, 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.
.. versionadded:: 0.9.2
:param font: an :obj:`~gi.repository.HarfBuzz.font_t` to use for shaping
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t` to shape
:param features: an array of user
specified :obj:`~gi.repository.HarfBuzz.feature_t` or ``NULL``
.. function:: shape_full(font: ~gi.repository.HarfBuzz.font_t, buffer: ~gi.repository.HarfBuzz.buffer_t, features: list[~gi.repository.HarfBuzz.feature_t] | None = None, shaper_list: list[str] | None = None) -> int
See :func:`~gi.repository.HarfBuzz.shape` for details. If ``shaper_list`` is not ``NULL``\, the specified
shapers will be used in the given order, otherwise the default shapers list
will be used.
.. versionadded:: 0.9.2
:param font: an :obj:`~gi.repository.HarfBuzz.font_t` to use for shaping
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t` to shape
:param features: an array of user
specified :obj:`~gi.repository.HarfBuzz.feature_t` or ``NULL``
:param shaper_list: a ``NULL``\-terminated
array of shapers to use or ``NULL``
:return: false if all shapers failed, true otherwise
.. function:: shape_justify(font: ~gi.repository.HarfBuzz.font_t, buffer: ~gi.repository.HarfBuzz.buffer_t, features: list[~gi.repository.HarfBuzz.feature_t] | None, shaper_list: list[str] | None, min_target_advance: float, max_target_advance: float, advance: float) -> ~typing.Tuple[int, float, int, float]
See :func:`~gi.repository.HarfBuzz.shape_full` for basic details. If ``shaper_list`` is not ``NULL``\, the specified
shapers will be used in the given order, otherwise the default shapers list
will be used.
In addition, justify the shaping results such that the shaping results reach
the target advance width/height, depending on the buffer direction.
If the advance of the buffer shaped with :func:`~gi.repository.HarfBuzz.shape_full` is already known,
put that in *advance. Otherwise set *\advance to zero.
This API is currently experimental and will probably change in the future.
:param font: a mutable :obj:`~gi.repository.HarfBuzz.font_t` to use for shaping
:param buffer: an :obj:`~gi.repository.HarfBuzz.buffer_t` to shape
:param features: an array of user
specified :obj:`~gi.repository.HarfBuzz.feature_t` or ``NULL``
:param shaper_list: a ``NULL``\-terminated
array of shapers to use or ``NULL``
:param min_target_advance: Minimum advance width/height to aim for.
:param max_target_advance: Maximum advance width/height to aim for.
:param advance: Input/output advance width/height of the buffer.
:return: false if all shapers failed, true otherwise
XSince: EXPERIMENTAL
.. function:: shape_list_shapers() -> list[str]
Retrieves the list of shapers supported by HarfBuzz.
.. versionadded:: 0.9.2
:return: an array of
constant strings
.. function:: shape_plan_create(face: ~gi.repository.HarfBuzz.face_t, props: ~gi.repository.HarfBuzz.segment_properties_t, user_features: list[~gi.repository.HarfBuzz.feature_t], shaper_list: list[str]) -> ~gi.repository.HarfBuzz.shape_plan_t
Constructs a shaping plan for a combination of ``face``\, ``user_features``\, ``props``\,
and ``shaper_list``\.
.. versionadded:: 0.9.7
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to use
:param props: The :obj:`~gi.repository.HarfBuzz.segment_properties_t` of the segment
:param user_features: The list of user-selected features
:param shaper_list: List of shapers to try
:return: The shaping plan
.. function:: shape_plan_create2(face: ~gi.repository.HarfBuzz.face_t, props: ~gi.repository.HarfBuzz.segment_properties_t, user_features: list[~gi.repository.HarfBuzz.feature_t], coords: list[int], shaper_list: list[str]) -> ~gi.repository.HarfBuzz.shape_plan_t
The variable-font version of ``hb_shape_plan_create``.
Constructs a shaping plan for a combination of ``face``\, ``user_features``\, ``props``\,
and ``shaper_list``\, plus the variation-space coordinates ``coords``\.
.. versionadded:: 1.4.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to use
:param props: The :obj:`~gi.repository.HarfBuzz.segment_properties_t` of the segment
:param user_features: The list of user-selected features
:param coords: The list of variation-space coordinates
:param shaper_list: List of shapers to try
:return: The shaping plan
.. function:: shape_plan_create_cached(face: ~gi.repository.HarfBuzz.face_t, props: ~gi.repository.HarfBuzz.segment_properties_t, user_features: list[~gi.repository.HarfBuzz.feature_t], shaper_list: list[str]) -> ~gi.repository.HarfBuzz.shape_plan_t
Creates a cached shaping plan suitable for reuse, for a combination
of ``face``\, ``user_features``\, ``props``\, and ``shaper_list``\.
.. versionadded:: 0.9.7
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to use
:param props: The :obj:`~gi.repository.HarfBuzz.segment_properties_t` of the segment
:param user_features: The list of user-selected features
:param shaper_list: List of shapers to try
:return: The shaping plan
.. function:: shape_plan_create_cached2(face: ~gi.repository.HarfBuzz.face_t, props: ~gi.repository.HarfBuzz.segment_properties_t, user_features: list[~gi.repository.HarfBuzz.feature_t], coords: list[int], shaper_list: list[str]) -> ~gi.repository.HarfBuzz.shape_plan_t
The variable-font version of ``hb_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``\.
.. versionadded:: 1.4.0
:param face: :obj:`~gi.repository.HarfBuzz.face_t` to use
:param props: The :obj:`~gi.repository.HarfBuzz.segment_properties_t` of the segment
:param user_features: The list of user-selected features
:param coords: The list of variation-space coordinates
:param shaper_list: List of shapers to try
:return: The shaping plan
.. function:: shape_plan_execute(shape_plan: ~gi.repository.HarfBuzz.shape_plan_t, font: ~gi.repository.HarfBuzz.font_t, buffer: ~gi.repository.HarfBuzz.buffer_t, features: list[~gi.repository.HarfBuzz.feature_t]) -> int
Executes the given shaping plan on the specified buffer, using
the given ``font`` and ``features``\.
.. versionadded:: 0.9.7
:param shape_plan: A shaping plan
:param font: The :obj:`~gi.repository.HarfBuzz.font_t` to use
:param buffer: The :obj:`~gi.repository.HarfBuzz.buffer_t` to work upon
:param features: Features to enable
:return: ``true`` if success, ``false`` otherwise.
.. function:: shape_plan_get_empty() -> ~gi.repository.HarfBuzz.shape_plan_t
Fetches the singleton empty shaping plan.
.. versionadded:: 0.9.7
:return: The empty shaping plan
.. function:: shape_plan_get_shaper(shape_plan: ~gi.repository.HarfBuzz.shape_plan_t) -> str
Fetches the shaper from a given shaping plan.
.. versionadded:: 0.9.7
:param shape_plan: A shaping plan
:return: The shaper
.. function:: style_get_value(font: ~gi.repository.HarfBuzz.font_t, style_tag: ~gi.repository.HarfBuzz.style_tag_t) -> float
Searches variation axes of a :obj:`~gi.repository.HarfBuzz.font_t` object for a specific axis first,
if not set, then tries to get default style values from different
tables of the font.
.. versionadded:: 3.0.0
:param font: a :obj:`~gi.repository.HarfBuzz.font_t` object.
:param style_tag: a style tag.
:return: Corresponding axis or default value to a style tag.
.. function:: tag_from_string(str: list[int]) -> int
Converts a string into an :obj:`~gi.repository.HarfBuzz.tag_t`\. Valid tags
are four characters. Shorter input strings will be
padded with spaces. Longer input strings will be
truncated.
.. versionadded:: 0.9.2
:param str: String to convert
:return: The :obj:`~gi.repository.HarfBuzz.tag_t` corresponding to ``str``
.. function:: tag_to_string(tag: int) -> list[int]
Converts an :obj:`~gi.repository.HarfBuzz.tag_t` to a string and returns it in ``buf``\.
Strings will be four characters long.
.. versionadded:: 0.9.5
:param tag: :obj:`~gi.repository.HarfBuzz.tag_t` to convert
.. function:: unicode_combining_class(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, unicode: int) -> ~gi.repository.HarfBuzz.unicode_combining_class_t
Retrieves the Canonical Combining Class (ccc) property
of code point ``unicode``\.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
:param unicode: The code point to query
:return: The :obj:`~gi.repository.HarfBuzz.unicode_combining_class_t` of ``unicode``
.. function:: unicode_compose(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, a: int, b: int) -> ~typing.Tuple[int, int]
Fetches the composition of a sequence of two Unicode
code points.
Calls the composition function of the specified
Unicode-functions structure ``ufuncs``\.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
:param a: The first Unicode code point to compose
:param b: The second Unicode code point to compose
:return: ``true`` if ``a`` and ``b`` composed, ``false`` otherwise
.. function:: unicode_decompose(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, ab: int) -> ~typing.Tuple[int, int, int]
Fetches the decomposition of a Unicode code point.
Calls the decomposition function of the specified
Unicode-functions structure ``ufuncs``\.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
:param ab: Unicode code point to decompose
:return: ``true`` if ``ab`` was decomposed, ``false`` otherwise
.. function:: unicode_decompose_compatibility(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, u: int) -> ~typing.Tuple[int, int]
Fetches the compatibility decomposition of a Unicode
code point. Deprecated.
.. versionadded:: 0.9.2
.. deprecated:: 2.0.0
Please do not use it in newly written code
:param ufuncs: The Unicode-functions structure
:param u: Code point to decompose
:return: length of ``decomposed``\.
.. function:: unicode_eastasian_width(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, unicode: int) -> int
Don't use. Not used by HarfBuzz.
.. versionadded:: 0.9.2
.. deprecated:: 2.0.0
Please do not use it in newly written code
:param ufuncs: a Unicode-function structure
:param unicode: The code point to query
.. function:: unicode_funcs_create(parent: ~gi.repository.HarfBuzz.unicode_funcs_t | None = None) -> ~gi.repository.HarfBuzz.unicode_funcs_t
Creates a new :obj:`~gi.repository.HarfBuzz.unicode_funcs_t` structure of Unicode functions.
.. versionadded:: 0.9.2
:param parent: Parent Unicode-functions structure
:return: The Unicode-functions structure
.. function:: unicode_funcs_get_default() -> ~gi.repository.HarfBuzz.unicode_funcs_t
Fetches a pointer to the default Unicode-functions structure that is used
when no functions are explicitly set on :obj:`~gi.repository.HarfBuzz.buffer_t`\.
.. versionadded:: 0.9.2
:return: a pointer to the :obj:`~gi.repository.HarfBuzz.unicode_funcs_t` Unicode-functions structure
.. function:: unicode_funcs_get_empty() -> ~gi.repository.HarfBuzz.unicode_funcs_t
Fetches the singleton empty Unicode-functions structure.
.. versionadded:: 0.9.2
:return: The empty Unicode-functions structure
.. function:: unicode_funcs_get_parent(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t) -> ~gi.repository.HarfBuzz.unicode_funcs_t
Fetches the parent of the Unicode-functions structure
``ufuncs``\.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
:return: The parent Unicode-functions structure
.. function:: unicode_funcs_is_immutable(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t) -> int
Tests whether the specified Unicode-functions structure
is immutable.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
:return: ``true`` if ``ufuncs`` is immutable, ``false`` otherwise
.. function:: unicode_funcs_make_immutable(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t) -> None
Makes the specified Unicode-functions structure
immutable.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
.. function:: unicode_funcs_set_combining_class_func(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.unicode_funcs_t, int, ~typing.Any], ~gi.repository.HarfBuzz.unicode_combining_class_t], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.unicode_combining_class_func_t`\.
.. versionadded:: 0.9.2
:param ufuncs: A Unicode-functions structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: unicode_funcs_set_compose_func(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.unicode_funcs_t, int, int, ~typing.Any], ~typing.Tuple[int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.unicode_compose_func_t`\.
.. versionadded:: 0.9.2
:param ufuncs: A Unicode-functions structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: unicode_funcs_set_decompose_compatibility_func(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.unicode_funcs_t, int, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.unicode_decompose_compatibility_func_t`\.
.. versionadded:: 0.9.2
.. deprecated:: 2.0.0
Please do not use it in newly written code
:param ufuncs: A Unicode-functions structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: unicode_funcs_set_decompose_func(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.unicode_funcs_t, int, ~typing.Any], ~typing.Tuple[int, int, int]], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.unicode_decompose_func_t`\.
.. versionadded:: 0.9.2
:param ufuncs: A Unicode-functions structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: unicode_funcs_set_eastasian_width_func(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.unicode_funcs_t, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.unicode_eastasian_width_func_t`\.
.. versionadded:: 0.9.2
.. deprecated:: 2.0.0
Please do not use it in newly written code
:param ufuncs: a Unicode-function structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: unicode_funcs_set_general_category_func(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.unicode_funcs_t, int, ~typing.Any], ~gi.repository.HarfBuzz.unicode_general_category_t], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.unicode_general_category_func_t`\.
.. versionadded:: 0.9.2
:param ufuncs: A Unicode-functions structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: unicode_funcs_set_mirroring_func(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.unicode_funcs_t, int, ~typing.Any], int], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.unicode_mirroring_func_t`\.
.. versionadded:: 0.9.2
:param ufuncs: A Unicode-functions structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: unicode_funcs_set_script_func(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, func: ~typing.Callable[[~gi.repository.HarfBuzz.unicode_funcs_t, int, ~typing.Any], ~gi.repository.HarfBuzz.script_t], user_data: ~typing.Any = None) -> None
Sets the implementation function for :obj:`~gi.repository.HarfBuzz.unicode_script_func_t`\.
.. versionadded:: 0.9.2
:param ufuncs: A Unicode-functions structure
:param func: The callback function to assign
:param user_data: Data to pass to ``func``
.. function:: unicode_general_category(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, unicode: int) -> ~gi.repository.HarfBuzz.unicode_general_category_t
Retrieves the General Category (gc) property
of code point ``unicode``\.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
:param unicode: The code point to query
:return: The :obj:`~gi.repository.HarfBuzz.unicode_general_category_t` of ``unicode``
.. function:: unicode_mirroring(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, unicode: int) -> int
Retrieves the Bi-directional Mirroring Glyph code
point defined for code point ``unicode``\.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
:param unicode: The code point to query
:return: The :obj:`~gi.repository.HarfBuzz.codepoint_t` of the Mirroring Glyph for ``unicode``
.. function:: unicode_script(ufuncs: ~gi.repository.HarfBuzz.unicode_funcs_t, unicode: int) -> ~gi.repository.HarfBuzz.script_t
Retrieves the :obj:`~gi.repository.HarfBuzz.script_t` script to which code
point ``unicode`` belongs.
.. versionadded:: 0.9.2
:param ufuncs: The Unicode-functions structure
:param unicode: The code point to query
:return: The :obj:`~gi.repository.HarfBuzz.script_t` of ``unicode``
.. function:: variation_from_string(str: list[int]) -> ~typing.Tuple[int, ~gi.repository.HarfBuzz.variation_t]
Parses a string into a :obj:`~gi.repository.HarfBuzz.variation_t`\.
The format for specifying variation settings follows. All valid CSS
font-variation-settings values other than 'normal' and 'inherited' are also
accepted, though, not documented below.
The format is a tag, optionally followed by an equals sign, followed by a
number. For example ``wght=500``\, or ``slnt=-7.5``\.
.. versionadded:: 1.4.2
:param str: a string to parse
:return: ``true`` if ``str`` is successfully parsed, ``false`` otherwise
.. function:: variation_to_string(variation: ~gi.repository.HarfBuzz.variation_t) -> list[str]
Converts an :obj:`~gi.repository.HarfBuzz.variation_t` into a ``NULL``\-terminated string in the format
understood by :func:`~gi.repository.HarfBuzz.variation_from_string`. The client in responsible for
allocating big enough size for ``buf``\, 128 bytes is more than enough.
.. versionadded:: 1.4.2
:param variation: an :obj:`~gi.repository.HarfBuzz.variation_t` to convert