Functions¶
Details¶
- HarfBuzz.aat_layout_feature_type_get_name_id(face, feature_type)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponfeature_type (
HarfBuzz.aat_layout_feature_type_t
) – TheHarfBuzz.aat_layout_feature_type_t
of the requested feature type
- Returns:
Name identifier of the requested feature type
- Return type:
Fetches the name identifier of the specified feature type in the face’s
name
table.New in version 2.2.0.
- HarfBuzz.aat_layout_feature_type_get_selector_infos(face, feature_type, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponfeature_type (
HarfBuzz.aat_layout_feature_type_t
) – TheHarfBuzz.aat_layout_feature_type_t
of the requested feature typestart_offset (
int
) – offset of the first feature type to retrieve
- Returns:
Number of all available feature selectors
- selectors:
A buffer pointer. The selectors available for the feature type queries.
- default_index:
The index of the feature’s default selector, if any
- Return type:
(
int
, selectors: [HarfBuzz.aat_layout_feature_selector_info_t
], default_index:int
)
Fetches a list of the selectors available for the specified feature in the given face.
If upon return, default_index is set to
HarfBuzz.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.New in version 2.2.0.
- HarfBuzz.aat_layout_get_feature_types(face, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponstart_offset (
int
) – offset of the first feature type to retrieve
- Returns:
Number of all available feature types.
- features:
Array of feature types found
- Return type:
(
int
, features: [HarfBuzz.aat_layout_feature_type_t
])
Fetches a list of the AAT feature types included in the specified face.
New in version 2.2.0.
- HarfBuzz.aat_layout_has_positioning(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests whether the specified face includes any positioning information in the
kerx
table.Note: does not examine the `GPOS` table.
New in version 2.3.0.
- HarfBuzz.aat_layout_has_substitution(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests whether the specified face includes any substitutions in the
morx
ormort
tables.Note: does not examine the `GSUB` table.
New in version 2.3.0.
- HarfBuzz.aat_layout_has_tracking(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests whether the specified face includes any tracking information in the
trak
table.New in version 2.3.0.
- HarfBuzz.blob_copy_writable_or_fail(blob)¶
- Parameters:
blob (
HarfBuzz.blob_t
) – A blob.- Returns:
The new blob, or nullptr if allocation failed
- Return type:
Makes a writable copy of blob.
New in version 1.8.0.
- HarfBuzz.blob_create_from_file(file_name)¶
- Parameters:
file_name (
str
) – A font filename- Returns:
An
HarfBuzz.blob_t
pointer with the content of the file, orHarfBuzz.blob_get_empty
() if failed.- Return type:
Creates a new blob containing the data from the specified binary font file.
New in version 1.7.7.
- HarfBuzz.blob_create_from_file_or_fail(file_name)¶
- Parameters:
file_name (
str
) – A font filename- Returns:
An
HarfBuzz.blob_t
pointer with the content of the file, orNULL
if failed.- Return type:
Creates a new blob containing the data from the specified binary font file.
New in version 2.8.2.
- HarfBuzz.blob_create_sub_blob(parent, offset, length)¶
- Parameters:
parent (
HarfBuzz.blob_t
) – Parent blob.offset (
int
) – Start offset of sub-blob within parent, in bytes.length (
int
) – Length of sub-blob.
- Returns:
New blob, or the empty blob if something failed or if length is zero or offset is beyond the end of parent's data. Destroy with hb_blob_destroy().
- Return type:
Returns a blob that represents a range of bytes in parent. The new blob is always created with
HarfBuzz.memory_mode_t.READONLY
, meaning that it will never modify data in the parent blob. The parent data is not expected to be modified, and will result in undefined behavior if it is.Makes parent immutable.
New in version 0.9.2.
- HarfBuzz.blob_get_data(blob)¶
- Parameters:
blob (
HarfBuzz.blob_t
) – a blob.- Returns:
the byte data of blob.
- Return type:
Fetches the data from a blob.
New in version 0.9.2.
- HarfBuzz.blob_get_data_writable(blob)¶
- Parameters:
blob (
HarfBuzz.blob_t
) – a blob.- Returns:
Writable blob data, or
NULL
if failed.- Return type:
[
str
]
Tries to make blob data writable (possibly copying it) and return pointer to data.
Fails if blob has been made immutable, or if memory allocation fails.
New in version 0.9.2.
- HarfBuzz.blob_get_empty()¶
- Returns:
The empty blob.
- Return type:
Returns the singleton empty blob.
See TODO:link object types for more information.
New in version 0.9.2.
- HarfBuzz.blob_get_length(blob)¶
- Parameters:
blob (
HarfBuzz.blob_t
) – a blob.- Returns:
the length of blob data in bytes.
- Return type:
Fetches the length of a blob’s data.
New in version 0.9.2.
- HarfBuzz.blob_is_immutable(blob)¶
- Parameters:
blob (
HarfBuzz.blob_t
) – a blob.- Returns:
true
if blob is immutable,false
otherwise- Return type:
Tests whether a blob is immutable.
New in version 0.9.2.
- HarfBuzz.blob_make_immutable(blob)¶
- Parameters:
blob (
HarfBuzz.blob_t
) – a blob
Makes a blob immutable.
New in version 0.9.2.
- HarfBuzz.buffer_add(buffer, codepoint, cluster)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
codepoint (
int
) – A Unicode code point.cluster (
int
) – The cluster value of codepoint.
Appends a character with the Unicode value of codepoint to buffer, and gives it the initial cluster value of cluster. Clusters can be any thing the client wants, they are usually used to refer to the index of the character in the input text stream and are output in HarfBuzz.glyph_info_t.cluster field.
This function does not check the validity of codepoint, it is up to the caller to ensure it is a valid Unicode code point.
New in version 0.9.7.
- HarfBuzz.buffer_add_codepoints(buffer, text, item_offset, item_length)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – aHarfBuzz.buffer_t
to append characters to.text ([
int
]) – an array of Unicode code points to append.item_offset (
int
) – the offset of the first code point to add to the buffer.item_length (
int
) – the number of code points to add to the buffer, or -1 for the end of text (assuming it isNULL
terminated).
Appends characters from text array to buffer. The item_offset is the position of the first character from text that will be appended, and item_length is the number of character. When shaping part of a larger text (e.g. a run of text from a paragraph), instead of passing just the substring corresponding to the run, it is preferable to pass the whole paragraph and specify the run start and length as item_offset and item_length, respectively, to give HarfBuzz the full context to be able, for example, to do cross-run Arabic shaping or properly handle combining marks at stat of run.
This function does not check the validity of text, it is up to the caller to ensure it contains a valid Unicode scalar values. In contrast,
HarfBuzz.buffer_add_utf32
() can be used that takes similar input but performs sanity-check on the input.New in version 0.9.31.
- HarfBuzz.buffer_add_latin1(buffer, text, item_offset, item_length)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
text (
bytes
) – an array of UTF-8 characters to appenditem_offset (
int
) – the offset of the first character to add to the bufferitem_length (
int
) – the number of characters to add to the buffer, or -1 for the end of text (assuming it isNULL
terminated)
Similar to
HarfBuzz.buffer_add_codepoints
(), but allows only access to first 256 Unicode code points that can fit in 8-bit strings.Has nothing to do with non-Unicode Latin-1 encoding.
New in version 0.9.39.
- HarfBuzz.buffer_add_utf16(buffer, text, item_offset, item_length)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
text ([
int
]) – An array of UTF-16 characters to appenditem_offset (
int
) – The offset of the first character to add to the bufferitem_length (
int
) – The number of characters to add to the buffer, or -1 for the end of text (assuming it isNULL
terminated)
See
HarfBuzz.buffer_add_codepoints
().Replaces invalid UTF-16 characters with the buffer replacement code point, see
HarfBuzz.buffer_set_replacement_codepoint
().New in version 0.9.2.
- HarfBuzz.buffer_add_utf32(buffer, text, item_offset, item_length)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
text ([
int
]) – An array of UTF-32 characters to appenditem_offset (
int
) – The offset of the first character to add to the bufferitem_length (
int
) – The number of characters to add to the buffer, or -1 for the end of text (assuming it isNULL
terminated)
See
HarfBuzz.buffer_add_codepoints
().Replaces invalid UTF-32 characters with the buffer replacement code point, see
HarfBuzz.buffer_set_replacement_codepoint
().New in version 0.9.2.
- HarfBuzz.buffer_add_utf8(buffer, text, item_offset, item_length)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
text (
bytes
) – An array of UTF-8 characters to append.item_offset (
int
) – The offset of the first character to add to the buffer.item_length (
int
) – The number of characters to add to the buffer, or -1 for the end of text (assuming it isNULL
terminated).
See
HarfBuzz.buffer_add_codepoints
().Replaces invalid UTF-8 characters with the buffer replacement code point, see
HarfBuzz.buffer_set_replacement_codepoint
().New in version 0.9.2.
- HarfBuzz.buffer_allocation_successful(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
true
if buffer memory allocation succeeded,false
otherwise.- Return type:
Check if allocating memory for the buffer succeeded.
New in version 0.9.2.
- HarfBuzz.buffer_append(buffer, source, start, end)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
source (
HarfBuzz.buffer_t
) – sourceHarfBuzz.buffer_t
start (
int
) – start index into source buffer to copy. Use 0 to copy from start of buffer.end (
int
) – end index into source buffer to copy. Use HB_FEATURE_GLOBAL_END to copy to end of buffer.
Append (part of) contents of another buffer to this buffer.
New in version 1.5.0.
- HarfBuzz.buffer_clear_contents(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
Similar to
HarfBuzz.buffer_reset
(), but does not clear the Unicode functions and the replacement code point.New in version 0.9.11.
- HarfBuzz.buffer_create()¶
- Returns:
A newly allocated
HarfBuzz.buffer_t
with a reference count of 1. The initial reference count should be released with hb_buffer_destroy() when you are done using theHarfBuzz.buffer_t
. This function never returnsNULL
. If memory cannot be allocated, a specialHarfBuzz.buffer_t
object will be returned on whichHarfBuzz.buffer_allocation_successful
() returnsfalse
.- Return type:
Creates a new
HarfBuzz.buffer_t
with all properties to defaults.New in version 0.9.2.
- HarfBuzz.buffer_create_similar(src)¶
- Parameters:
src (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
A newly allocated
HarfBuzz.buffer_t
, similar toHarfBuzz.buffer_create
().- Return type:
Creates a new
HarfBuzz.buffer_t
, similar toHarfBuzz.buffer_create
(). The only difference is that the buffer is configured similarly to src.New in version 3.3.0.
- HarfBuzz.buffer_deserialize_glyphs(buffer, buf, font, format)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
buffer.buf ([
str
]) – string to deserializefont (
HarfBuzz.font_t
orNone
) – font for getting glyph IDsformat (
HarfBuzz.buffer_serialize_format_t
) – theHarfBuzz.buffer_serialize_format_t
of the input buf
- Returns:
true
if parse was successful,false
if an error occurred.- end_ptr:
output pointer to the character after last consumed one.
- Return type:
Deserializes glyphs buffer from textual representation in the format produced by
HarfBuzz.buffer_serialize_glyphs
().New in version 0.9.7.
- HarfBuzz.buffer_deserialize_unicode(buffer, buf, format)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
buffer.buf ([
str
]) – string to deserializeformat (
HarfBuzz.buffer_serialize_format_t
) – theHarfBuzz.buffer_serialize_format_t
of the input buf
- Returns:
true
if parse was successful,false
if an error occurred.- end_ptr:
output pointer to the character after last consumed one.
- Return type:
Deserializes Unicode buffer from textual representation in the format produced by
HarfBuzz.buffer_serialize_unicode
().New in version 2.7.3.
- HarfBuzz.buffer_diff(buffer, reference, dottedcircle_glyph, position_fuzz)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – a buffer.reference (
HarfBuzz.buffer_t
) – other buffer to compare to.dottedcircle_glyph (
int
) – glyph id of U+25CC DOTTED CIRCLE, or (hb_codepoint_t) -1.position_fuzz (
int
) – allowed absolute difference in position values.
- Return type:
If dottedcircle_glyph is (hb_codepoint_t) -1 then
HarfBuzz.buffer_diff_flags_t.DOTTED_CIRCLE_PRESENT
andHarfBuzz.buffer_diff_flags_t.NOTDEF_PRESENT
are never returned. This should be used by most callers if just comparing two buffers is needed.New in version 1.5.0.
- HarfBuzz.buffer_get_cluster_level(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The cluster level of buffer
- Return type:
Fetches the cluster level of a buffer. The
HarfBuzz.buffer_cluster_level_t
dictates one aspect of how HarfBuzz will treat non-base characters during shaping.New in version 0.9.42.
- HarfBuzz.buffer_get_content_type(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The type of buffer contents
- Return type:
Fetches the type of buffer contents. Buffers are either empty, contain characters (before shaping), or contain glyphs (the result of shaping).
New in version 0.9.5.
- HarfBuzz.buffer_get_direction(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The direction of the buffer.
- Return type:
See
HarfBuzz.buffer_set_direction
()New in version 0.9.2.
- HarfBuzz.buffer_get_empty()¶
- Returns:
The empty buffer
- Return type:
Fetches an empty
HarfBuzz.buffer_t
.New in version 0.9.2.
- HarfBuzz.buffer_get_flags(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The buffer flags
- Return type:
Fetches the
HarfBuzz.buffer_flags_t
of buffer.New in version 0.9.7.
- HarfBuzz.buffer_get_glyph_infos(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The buffer glyph information array. The value valid as long as buffer has not been modified.
- Return type:
Returns buffer glyph information array. Returned pointer is valid as long as buffer contents are not modified.
New in version 0.9.2.
- HarfBuzz.buffer_get_glyph_positions(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The buffer glyph position array. The value valid as long as buffer has not been modified.
- Return type:
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
HarfBuzz.buffer_set_message_func
()), in which caseNULL
is returned.New in version 0.9.2.
- HarfBuzz.buffer_get_invisible_glyph(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The buffer invisible #hb_codepoint_t
- Return type:
See
HarfBuzz.buffer_set_invisible_glyph
().New in version 2.0.0.
- HarfBuzz.buffer_get_language(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The
HarfBuzz.language_t
of the buffer. Must not be freed by the caller.- Return type:
See
HarfBuzz.buffer_set_language
().New in version 0.9.2.
- HarfBuzz.buffer_get_length(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The buffer length. The value valid as long as buffer has not been modified.
- Return type:
Returns the number of items in the buffer.
New in version 0.9.2.
- HarfBuzz.buffer_get_not_found_glyph(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The buffer not-found #hb_codepoint_t
- Return type:
See
HarfBuzz.buffer_set_not_found_glyph
().New in version 3.1.0.
- HarfBuzz.buffer_get_replacement_codepoint(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The buffer replacement #hb_codepoint_t
- Return type:
Fetches the #hb_codepoint_t that replaces invalid entries for a given encoding when adding text to buffer.
New in version 0.9.31.
- HarfBuzz.buffer_get_script(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The
HarfBuzz.script_t
of the buffer- Return type:
Fetches the script of buffer.
New in version 0.9.2.
- HarfBuzz.buffer_get_segment_properties(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The output
HarfBuzz.segment_properties_t
- Return type:
Sets props to the
HarfBuzz.segment_properties_t
of buffer.New in version 0.9.7.
- HarfBuzz.buffer_get_unicode_funcs(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
- Returns:
The Unicode-functions structure
- Return type:
Fetches the Unicode-functions structure of a buffer.
New in version 0.9.2.
- HarfBuzz.buffer_guess_segment_properties(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
Sets unset buffer segment properties based on buffer Unicode contents. If buffer is not empty, it must have content type
HarfBuzz.buffer_content_type_t.UNICODE
.If buffer script is not set (ie. is
HarfBuzz.script_t.INVALID
), it will be set to the Unicode script of the first character in the buffer that has a script other thanHarfBuzz.script_t.COMMON
,HarfBuzz.script_t.INHERITED
, andHarfBuzz.script_t.UNKNOWN
.Next, if buffer direction is not set (ie. is
HarfBuzz.direction_t.INVALID
), it will be set to the natural horizontal direction of the buffer script as returned byHarfBuzz.script_get_horizontal_direction
(). IfHarfBuzz.script_get_horizontal_direction
() returnsHarfBuzz.direction_t.INVALID
, thenHarfBuzz.direction_t.LTR
is used.Finally, if buffer language is not set (ie. is
HarfBuzz.LANGUAGE_INVALID
), it will be set to the process’s default language as returned byHarfBuzz.language_get_default
(). This may change in the future by taking buffer script into consideration when choosing a language. Note thatHarfBuzz.language_get_default
() is NOT threadsafe the first time it is called. See documentation for that function for details.New in version 0.9.7.
- HarfBuzz.buffer_has_positions(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
.- Returns:
true
if the buffer has position array,false
otherwise.- Return type:
Returns whether buffer has glyph position data. A buffer gains position data when
HarfBuzz.buffer_get_glyph_positions
() is called on it, and cleared of position data whenHarfBuzz.buffer_clear_contents
() is called.New in version 2.7.3.
- HarfBuzz.buffer_normalize_glyphs(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
Reorders a glyph buffer to have canonical in-cluster glyph order / position. The resulting clusters should behave identical to pre-reordering clusters.
This has nothing to do with Unicode normalization.
New in version 0.9.2.
- HarfBuzz.buffer_pre_allocate(buffer, size)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
size (
int
) – Number of items to pre allocate.
- Returns:
true
if buffer memory allocation succeeded,false
otherwise- Return type:
Pre allocates memory for buffer to fit at least size number of items.
New in version 0.9.2.
- HarfBuzz.buffer_reset(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
Resets the buffer to its initial status, as if it was just newly created with
HarfBuzz.buffer_create
().New in version 0.9.2.
- HarfBuzz.buffer_reverse(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
Reverses buffer contents.
New in version 0.9.2.
- HarfBuzz.buffer_reverse_clusters(buffer)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
Reverses buffer clusters. That is, the buffer contents are reversed, then each cluster (consecutive items having the same cluster number) are reversed again.
New in version 0.9.2.
- HarfBuzz.buffer_reverse_range(buffer, start, end)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
start (
int
) – start indexend (
int
) – end index
Reverses buffer contents between start and end.
New in version 0.9.41.
- HarfBuzz.buffer_serialize(buffer, start, end, font, format, flags)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
buffer.start (
int
) – the first item in buffer to serialize.end (
int
) – the last item in buffer to serialize.font (
HarfBuzz.font_t
orNone
) – theHarfBuzz.font_t
used to shape this buffer, needed to read glyph names and extents. IfNULL
, an empty font will be used.format (
HarfBuzz.buffer_serialize_format_t
) – theHarfBuzz.buffer_serialize_format_t
to use for formatting the output.flags (
HarfBuzz.buffer_serialize_flags_t
) – theHarfBuzz.buffer_serialize_flags_t
that control what glyph properties to serialize.
- Returns:
The number of serialized items.
- buf:
output string to write serialized buffer into.
- buf_consumed:
if not
NULL
, will be set to the number of bytes written into buf.
- Return type:
Serializes buffer into a textual representation of its content, whether Unicode codepoints or glyph identifiers and positioning information. This is useful for showing the contents of the buffer, for example during debugging. See the documentation of
HarfBuzz.buffer_serialize_unicode
() andHarfBuzz.buffer_serialize_glyphs
() for a description of the output format.New in version 2.7.3.
- HarfBuzz.buffer_serialize_format_from_string(str)¶
- Parameters:
str (
bytes
) – a string to parse- Returns:
The parsed
HarfBuzz.buffer_serialize_format_t
.- Return type:
Parses a string into an
HarfBuzz.buffer_serialize_format_t
. Does not check if str is a valid buffer serialization format, useHarfBuzz.buffer_serialize_list_formats
() to get the list of supported formats.New in version 0.9.7.
- HarfBuzz.buffer_serialize_format_to_string(format)¶
- Parameters:
format (
HarfBuzz.buffer_serialize_format_t
) – anHarfBuzz.buffer_serialize_format_t
to convert.- Returns:
A
NULL
terminated string corresponding to format. Should not be freed.- Return type:
Converts format to the string corresponding it, or
NULL
if it is not a validHarfBuzz.buffer_serialize_format_t
.New in version 0.9.7.
- HarfBuzz.buffer_serialize_glyphs(buffer, start, end, font, format, flags)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
buffer.start (
int
) – the first item in buffer to serialize.end (
int
) – the last item in buffer to serialize.font (
HarfBuzz.font_t
orNone
) – theHarfBuzz.font_t
used to shape this buffer, needed to read glyph names and extents. IfNULL
, an empty font will be used.format (
HarfBuzz.buffer_serialize_format_t
) – theHarfBuzz.buffer_serialize_format_t
to use for formatting the output.flags (
HarfBuzz.buffer_serialize_flags_t
) – theHarfBuzz.buffer_serialize_flags_t
that control what glyph properties to serialize.
- Returns:
The number of serialized items.
- buf:
output string to write serialized buffer into.
- buf_consumed:
if not
NULL
, will be set to the number of bytes written into buf.
- Return type:
Serializes buffer into a textual representation of its glyph content, useful for showing the contents of the buffer, for example during debugging. There are currently two supported serialization formats:
- text
A human-readable, plain text format. The serialized glyphs will look something like:
`` [uni0651=0@518,0+0|uni0628=0+1897] ``
The serialized glyphs are delimited with
[
and]
.Glyphs are separated with
|
Each glyph starts with glyph name, or glyph index if
HarfBuzz.buffer_serialize_flags_t.NO_GLYPH_NAMES
flag is set. Then,If
HarfBuzz.buffer_serialize_flags_t.NO_CLUSTERS
is not set,=
then HarfBuzz.glyph_info_t.cluster.If
HarfBuzz.buffer_serialize_flags_t.NO_POSITIONS
is not set, theHarfBuzz.glyph_position_t
in the format:If both HarfBuzz.glyph_position_t.x_offset and HarfBuzz.glyph_position_t.y_offset are not 0,
@x_offset,y_offset
. Then,+x_advance
, then,y_advance
if HarfBuzz.glyph_position_t.y_advance is not 0. Then,
If
HarfBuzz.buffer_serialize_flags_t.GLYPH_EXTENTS
is set, theHarfBuzz.glyph_extents_t
in the format<x_bearing,y_bearing,width,height>
- json
A machine-readable, structured format. The serialized glyphs will look something like:
`` [{“g”:”uni0651”,”cl”:0,”dx”:518,”dy”:0,”ax”:0,”ay”:0}, {“g”:”uni0628”,”cl”:0,”dx”:0,”dy”:0,”ax”:1897,”ay”:0}] ``
Each glyph is a JSON object, with the following properties:
g
: the glyph name or glyph index ifHarfBuzz.buffer_serialize_flags_t.NO_GLYPH_NAMES
flag is set.cl
: HarfBuzz.glyph_info_t.cluster ifHarfBuzz.buffer_serialize_flags_t.NO_CLUSTERS
is not set.dx
,``dy``,``ax``,``ay``: HarfBuzz.glyph_position_t.x_offset, HarfBuzz.glyph_position_t.y_offset, HarfBuzz.glyph_position_t.x_advance and HarfBuzz.glyph_position_t.y_advance respectively, ifHarfBuzz.buffer_serialize_flags_t.NO_POSITIONS
is not set.xb
,``yb``,``w``,``h``: HarfBuzz.glyph_extents_t.x_bearing, HarfBuzz.glyph_extents_t.y_bearing, HarfBuzz.glyph_extents_t.width and HarfBuzz.glyph_extents_t.height respectively ifHarfBuzz.buffer_serialize_flags_t.GLYPH_EXTENTS
is set.
New in version 0.9.7.
- HarfBuzz.buffer_serialize_list_formats()¶
- Returns:
A string array of buffer serialization formats. Should not be freed.
- Return type:
[
str
]
Returns a list of supported buffer serialization formats.
New in version 0.9.7.
- HarfBuzz.buffer_serialize_unicode(buffer, start, end, format, flags)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
buffer.start (
int
) – the first item in buffer to serialize.end (
int
) – the last item in buffer to serialize.format (
HarfBuzz.buffer_serialize_format_t
) – theHarfBuzz.buffer_serialize_format_t
to use for formatting the output.flags (
HarfBuzz.buffer_serialize_flags_t
) – theHarfBuzz.buffer_serialize_flags_t
that control what glyph properties to serialize.
- Returns:
The number of serialized items.
- buf:
output string to write serialized buffer into.
- buf_consumed:
if not
NULL
, will be set to the number of bytes written into buf.
- Return type:
Serializes buffer into a textual representation of its content, when the buffer contains Unicode codepoints (i.e., before shaping). This is useful for showing the contents of the buffer, for example during debugging. There are currently two supported serialization formats:
- text
A human-readable, plain text format. The serialized codepoints will look something like:
`` <U+0651=0|U+0628=1> ``
Glyphs are separated with
|
Unicode codepoints are expressed as zero-padded four (or more) digit hexadecimal numbers preceded by
U+
If
HarfBuzz.buffer_serialize_flags_t.NO_CLUSTERS
is not set, the cluster will be indicated with a=
then 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 integercl
: HarfBuzz.glyph_info_t.cluster ifHarfBuzz.buffer_serialize_flags_t.NO_CLUSTERS
is not set.
For example:
`` [{u:1617,cl:0},{u:1576,cl:1}] ``
New in version 2.7.3.
- HarfBuzz.buffer_set_cluster_level(buffer, cluster_level)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
cluster_level (
HarfBuzz.buffer_cluster_level_t
) – The cluster level to set on the buffer
Sets the cluster level of a buffer. The
HarfBuzz.buffer_cluster_level_t
dictates one aspect of how HarfBuzz will treat non-base characters during shaping.New in version 0.9.42.
- HarfBuzz.buffer_set_content_type(buffer, content_type)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
content_type (
HarfBuzz.buffer_content_type_t
) – The type of buffer contents to set
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
HarfBuzz.buffer_content_type_t.INVALID
. CallingHarfBuzz.buffer_reset
(),HarfBuzz.buffer_clear_contents
(), as well as callingHarfBuzz.buffer_set_length
() with an argument of zero all set the buffer content type to invalid as well.Calling
HarfBuzz.buffer_add_utf8
(),HarfBuzz.buffer_add_utf16
(),HarfBuzz.buffer_add_utf32
(),HarfBuzz.buffer_add_codepoints
() andHarfBuzz.buffer_add_latin1
() expect that buffer is either empty and have a content type of invalid, or that buffer content type isHarfBuzz.buffer_content_type_t.UNICODE
, and they also set the content type to Unicode if they added anything to an empty buffer.Finally
HarfBuzz.shape
() andHarfBuzz.shape_full
() expect that the buffer is either empty and have content type of invalid, or that buffer content type isHarfBuzz.buffer_content_type_t.UNICODE
, and upon success they set the buffer content type toHarfBuzz.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.
New in version 0.9.5.
- HarfBuzz.buffer_set_direction(buffer, direction)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
direction (
HarfBuzz.direction_t
) – theHarfBuzz.direction_t
of the buffer
Set the text flow direction of the buffer. No shaping can happen without setting buffer direction, and it controls the visual direction for the output glyphs; for RTL direction the glyphs will be reversed. Many layout features depend on the proper setting of the direction, for example, reversing RTL text before shaping, then shaping with LTR direction is not the same as keeping the text in logical order and shaping with RTL direction.
New in version 0.9.2.
- HarfBuzz.buffer_set_flags(buffer, flags)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
flags (
HarfBuzz.buffer_flags_t
) – The buffer flags to set
Sets buffer flags to flags. See
HarfBuzz.buffer_flags_t
.New in version 0.9.7.
- HarfBuzz.buffer_set_invisible_glyph(buffer, invisible)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
invisible (
int
) – the invisible #hb_codepoint_t
Sets the #hb_codepoint_t that replaces invisible characters in the shaping result. If set to zero (default), the glyph for the U+0020 SPACE character is used. Otherwise, this value is used verbatim.
New in version 2.0.0.
- HarfBuzz.buffer_set_language(buffer, language)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
language (
HarfBuzz.language_t
) – AnHarfBuzz.language_t
to set
Sets the language of buffer to language.
Languages are crucial for selecting which OpenType feature to apply to the buffer which can result in applying language-specific behaviour. Languages are orthogonal to the scripts, and though they are related, they are different concepts and should not be confused with each other.
Use
HarfBuzz.language_from_string
() to convert from BCP 47 language tags toHarfBuzz.language_t
.New in version 0.9.2.
- HarfBuzz.buffer_set_length(buffer, length)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
length (
int
) – The new length of buffer
- Returns:
true
if buffer memory allocation succeeded,false
otherwise.- Return type:
Similar to
HarfBuzz.buffer_pre_allocate
(), but clears any new items added at the end.New in version 0.9.2.
- HarfBuzz.buffer_set_message_func(buffer, func, *user_data)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
func (
HarfBuzz.buffer_message_func_t
) – Callback function
Sets the implementation function for
HarfBuzz.buffer_message_func_t
.New in version 1.1.3.
- HarfBuzz.buffer_set_not_found_glyph(buffer, not_found)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
not_found (
int
) – the not-found #hb_codepoint_t
Sets the #hb_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.
New in version 3.1.0.
- HarfBuzz.buffer_set_replacement_codepoint(buffer, replacement)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
replacement (
int
) – the replacement #hb_codepoint_t
Sets the #hb_codepoint_t that replaces invalid entries for a given encoding when adding text to buffer.
Default is
HarfBuzz.BUFFER_REPLACEMENT_CODEPOINT_DEFAULT
.New in version 0.9.31.
- HarfBuzz.buffer_set_script(buffer, script)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
script (
HarfBuzz.script_t
) – AnHarfBuzz.script_t
to set.
Sets the script of buffer to script.
Script is crucial for choosing the proper shaping behaviour for scripts that require it (e.g. Arabic) and the which OpenType features defined in the font to be applied.
You can pass one of the predefined
HarfBuzz.script_t
values, or useHarfBuzz.script_from_string
() orHarfBuzz.script_from_iso15924_tag
() to get the corresponding script from an ISO 15924 script tag.New in version 0.9.2.
- HarfBuzz.buffer_set_segment_properties(buffer, props)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
props (
HarfBuzz.segment_properties_t
) – AnHarfBuzz.segment_properties_t
to use
Sets the segment properties of the buffer, a shortcut for calling
HarfBuzz.buffer_set_direction
(),HarfBuzz.buffer_set_script
() andHarfBuzz.buffer_set_language
() individually.New in version 0.9.7.
- HarfBuzz.buffer_set_unicode_funcs(buffer, unicode_funcs)¶
- Parameters:
buffer (
HarfBuzz.buffer_t
) – AnHarfBuzz.buffer_t
unicode_funcs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structure
Sets the Unicode-functions structure of a buffer to unicode_funcs.
New in version 0.9.2.
- HarfBuzz.color_get_alpha(color)¶
- Parameters:
color (
int
) – an #hb_color_t we are interested in its channels.- Returns:
Alpha channel value
- Return type:
Fetches the alpha channel of the given color.
New in version 2.1.0.
- HarfBuzz.color_get_blue(color)¶
- Parameters:
color (
int
) – an #hb_color_t we are interested in its channels.- Returns:
Blue channel value
- Return type:
Fetches the blue channel of the given color.
New in version 2.1.0.
- HarfBuzz.color_get_green(color)¶
- Parameters:
color (
int
) – an #hb_color_t we are interested in its channels.- Returns:
Green channel value
- Return type:
Fetches the green channel of the given color.
New in version 2.1.0.
- HarfBuzz.color_get_red(color)¶
- Parameters:
color (
int
) – an #hb_color_t we are interested in its channels.- Returns:
Red channel value
- Return type:
Fetches the red channel of the given color.
New in version 2.1.0.
- HarfBuzz.color_line_get_color_stops(color_line, start)¶
- Parameters:
color_line (
HarfBuzz.color_line_t
) – aHarfBuzz.color_line_t
objectstart (
int
) – the index of the first color stop to return
- Returns:
the total number of color stops in color_line
- color_stops:
Array of
HarfBuzz.color_stop_t
to populate
- Return type:
(
int
, color_stops: [HarfBuzz.color_stop_t
])
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.
New in version 7.0.0.
- HarfBuzz.color_line_get_extend(color_line)¶
- Parameters:
color_line (
HarfBuzz.color_line_t
) – aHarfBuzz.color_line_t
object- Returns:
the extend mode of color_line
- Return type:
Fetches the extend mode of the color line object.
New in version 7.0.0.
- HarfBuzz.direction_from_string(str)¶
- Parameters:
str (
bytes
) – String to convert- Returns:
The
HarfBuzz.direction_t
matching str- Return type:
Converts a string to an
HarfBuzz.direction_t
.Matching is loose and applies only to the first letter. For examples, “LTR” and “left-to-right” will both return
HarfBuzz.direction_t.LTR
.Unmatched strings will return
HarfBuzz.direction_t.INVALID
.New in version 0.9.2.
- HarfBuzz.direction_to_string(direction)¶
- Parameters:
direction (
HarfBuzz.direction_t
) – TheHarfBuzz.direction_t
to convert- Returns:
The string corresponding to direction
- Return type:
Converts an
HarfBuzz.direction_t
to a string.New in version 0.9.2.
- HarfBuzz.draw_close_path(dfuncs, draw_data, st)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functionsdraw_data (
object
orNone
) – associated draw data passed by the callerst (
HarfBuzz.draw_state_t
) – current draw state
Perform a “close-path” draw operation.
New in version 4.0.0.
- HarfBuzz.draw_cubic_to(dfuncs, draw_data, st, control1_x, control1_y, control2_x, control2_y, to_x, to_y)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functionsdraw_data (
object
orNone
) – associated draw data passed by the callerst (
HarfBuzz.draw_state_t
) – current draw statecontrol1_x (
float
) – X component of first control pointcontrol1_y (
float
) – Y component of first control pointcontrol2_x (
float
) – X component of second control pointcontrol2_y (
float
) – Y component of second control pointto_x (
float
) – X component of target pointto_y (
float
) – Y component of target point
Perform a “cubic-to” draw operation.
New in version 4.0.0.
- HarfBuzz.draw_funcs_create()¶
- Returns:
A newly allocated
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 theHarfBuzz.draw_funcs_t
. This function never returnsNULL
. If memory cannot be allocated, a special singletonHarfBuzz.draw_funcs_t
object will be returned.- Return type:
Creates a new draw callbacks object.
New in version 4.0.0.
- HarfBuzz.draw_funcs_get_empty()¶
- Returns:
The empty draw-functions structure
- Return type:
Fetches the singleton empty draw-functions structure.
New in version 7.0.0.
- HarfBuzz.draw_funcs_is_immutable(dfuncs)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functions- Returns:
true
if dfuncs is immutable,false
otherwise- Return type:
Checks whether dfuncs is immutable.
New in version 4.0.0.
- HarfBuzz.draw_funcs_make_immutable(dfuncs)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functions
Makes dfuncs object immutable.
New in version 4.0.0.
- HarfBuzz.draw_funcs_set_close_path_func(dfuncs, func, *user_data)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functions objectfunc (
HarfBuzz.draw_close_path_func_t
) – close-path callback
Sets close-path callback to the draw functions object.
New in version 4.0.0.
- HarfBuzz.draw_funcs_set_cubic_to_func(dfuncs, func, *user_data)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functionsfunc (
HarfBuzz.draw_cubic_to_func_t
) – cubic-to callback
Sets cubic-to callback to the draw functions object.
New in version 4.0.0.
- HarfBuzz.draw_funcs_set_line_to_func(dfuncs, func, *user_data)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functions objectfunc (
HarfBuzz.draw_line_to_func_t
) – line-to callback
Sets line-to callback to the draw functions object.
New in version 4.0.0.
- HarfBuzz.draw_funcs_set_move_to_func(dfuncs, func, *user_data)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functions objectfunc (
HarfBuzz.draw_move_to_func_t
) – move-to callback
Sets move-to callback to the draw functions object.
New in version 4.0.0.
- HarfBuzz.draw_funcs_set_quadratic_to_func(dfuncs, func, *user_data)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functions objectfunc (
HarfBuzz.draw_quadratic_to_func_t
) – quadratic-to callback
Sets quadratic-to callback to the draw functions object.
New in version 4.0.0.
- HarfBuzz.draw_line_to(dfuncs, draw_data, st, to_x, to_y)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functionsdraw_data (
object
orNone
) – associated draw data passed by the callerst (
HarfBuzz.draw_state_t
) – current draw stateto_x (
float
) – X component of target pointto_y (
float
) – Y component of target point
Perform a “line-to” draw operation.
New in version 4.0.0.
- HarfBuzz.draw_move_to(dfuncs, draw_data, st, to_x, to_y)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functionsdraw_data (
object
orNone
) – associated draw data passed by the callerst (
HarfBuzz.draw_state_t
) – current draw stateto_x (
float
) – X component of target pointto_y (
float
) – Y component of target point
Perform a “move-to” draw operation.
New in version 4.0.0.
- HarfBuzz.draw_quadratic_to(dfuncs, draw_data, st, control_x, control_y, to_x, to_y)¶
- Parameters:
dfuncs (
HarfBuzz.draw_funcs_t
) – draw functionsdraw_data (
object
orNone
) – associated draw data passed by the callerst (
HarfBuzz.draw_state_t
) – current draw statecontrol_x (
float
) – X component of control pointcontrol_y (
float
) – Y component of control pointto_x (
float
) – X component of target pointto_y (
float
) – Y component of target point
Perform a “quadratic-to” draw operation.
New in version 4.0.0.
- HarfBuzz.face_builder_add_table(face, tag, blob)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object created withHarfBuzz.face_builder_create
()tag (
int
) – The #hb_tag_t of the table to addblob (
HarfBuzz.blob_t
) – The blob containing the table data to add
- Return type:
Add table for tag with data provided by blob to the face. face must be created using
HarfBuzz.face_builder_create
().New in version 1.9.0.
- HarfBuzz.face_builder_create()¶
- Returns:
New face.
- Return type:
Creates a
HarfBuzz.face_t
that can be used withHarfBuzz.face_builder_add_table
(). After tables are added to the face, it can be compiled to a binary font file by callingHarfBuzz.face_reference_blob
().New in version 1.9.0.
- HarfBuzz.face_builder_sort_tables(face, tags)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object created withHarfBuzz.face_builder_create
()tags ([
int
]) – ordered list of table tags terminated by %HB_TAG_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.
New in version 5.3.0.
- HarfBuzz.face_collect_nominal_glyph_mapping(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object- Returns:
- mapping:
The map to add Unicode-to-glyph mapping to
- unicodes:
The set to add Unicode characters to, or
NULL
- Return type:
(mapping:
HarfBuzz.map_t
, unicodes:HarfBuzz.set_t
orNone
)
Collects the mapping from Unicode characters to nominal glyphs of the face, and optionally all of the Unicode characters covered by face.
New in version 7.0.0.
- HarfBuzz.face_collect_unicodes(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object- Returns:
The set to add Unicode characters to
- Return type:
out:
HarfBuzz.set_t
Collects all of the Unicode characters covered by face and adds them to the
HarfBuzz.set_t
set out.New in version 1.9.0.
- HarfBuzz.face_collect_variation_selectors(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object- Returns:
The set to add Variation Selector characters to
- Return type:
out:
HarfBuzz.set_t
Collects all Unicode “Variation Selector” characters covered by face and adds them to the
HarfBuzz.set_t
set out.New in version 1.9.0.
- HarfBuzz.face_collect_variation_unicodes(face, variation_selector)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face objectvariation_selector (
int
) – The Variation Selector to query
- Returns:
The set to add Unicode characters to
- Return type:
out:
HarfBuzz.set_t
Collects all Unicode characters for variation_selector covered by face and adds them to the
HarfBuzz.set_t
set out.New in version 1.9.0.
- HarfBuzz.face_count(blob)¶
- Parameters:
blob (
HarfBuzz.blob_t
) – a blob.- Returns:
Number of faces in blob
- Return type:
Fetches the number of faces in a blob.
New in version 1.7.7.
- HarfBuzz.face_create(blob, index)¶
- Parameters:
blob (
HarfBuzz.blob_t
) –HarfBuzz.blob_t
to work uponindex (
int
) – The index of the face within blob
- Returns:
The new face object
- Return type:
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
HarfBuzz.face_get_index
(). Note: The high 16-bits of index, if non-zero, are used byHarfBuzz.font_create
() to load named-instances in variable fonts. SeeHarfBuzz.font_create
() for details.New in version 0.9.2.
- HarfBuzz.face_create_for_tables(reference_table_func, *user_data)¶
- Parameters:
reference_table_func (
HarfBuzz.reference_table_func_t
) – Table-referencing function
- Returns:
The new face object
- Return type:
Variant of
HarfBuzz.face_create
(), built for those cases where it is more convenient to provide data for individual tables instead of the whole font data. With the caveat thatHarfBuzz.face_get_table_tags
() does not currently work with faces created this way.Creates a new face object from the specified user_data and reference_table_func, with the destroy callback.
New in version 0.9.2.
- HarfBuzz.face_get_empty()¶
- Returns:
The empty face object
- Return type:
Fetches the singleton empty face object.
New in version 0.9.2.
- HarfBuzz.face_get_glyph_count(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object- Returns:
The glyph-count value of face
- Return type:
Fetches the glyph-count value of the specified face object.
New in version 0.9.7.
- HarfBuzz.face_get_index(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object- Returns:
The index of face.
- Return type:
Fetches the face-index corresponding to the given face.
Note: face indices within a collection are zero-based.
New in version 0.9.2.
- HarfBuzz.face_get_table_tags(face, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face objectstart_offset (
int
) – The index of first table tag to retrieve
- Returns:
Total number of tables, or zero if it is not possible to list
- table_tags:
The array of table tags found
- Return type:
Fetches a list of all table tags for a face, if possible. The list returned will begin at the offset provided
New in version 1.6.0.
- HarfBuzz.face_get_upem(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object- Returns:
The upem value of face
- Return type:
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.
New in version 0.9.2.
- HarfBuzz.face_is_immutable(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object- Returns:
true
is face is immutable,false
otherwise- Return type:
Tests whether the given face object is immutable.
New in version 0.9.2.
- HarfBuzz.face_make_immutable(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object
Makes the given face object immutable.
New in version 0.9.2.
- HarfBuzz.face_reference_blob(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face object- Returns:
A pointer to the blob for face
- Return type:
Fetches a pointer to the binary blob that contains the specified face. Returns an empty blob if referencing face data is not possible.
New in version 0.9.2.
- HarfBuzz.face_reference_table(face, tag)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face objecttag (
int
) – The #hb_tag_t of the table to query
- Returns:
A pointer to the tag table within face
- Return type:
Fetches a reference to the specified table within the specified face.
New in version 0.9.2.
- HarfBuzz.face_set_glyph_count(face, glyph_count)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face objectglyph_count (
int
) – The glyph-count value to assign
Sets the glyph count for a face object to the specified value.
This API is used in rare circumstances.
New in version 0.9.7.
- HarfBuzz.face_set_index(face, index)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face objectindex (
int
) – The index to assign
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
HarfBuzz.face_get_index
().New in version 0.9.2.
- HarfBuzz.face_set_upem(face, upem)¶
- Parameters:
face (
HarfBuzz.face_t
) – A face objectupem (
int
) – The units-per-em value to assign
Sets the units-per-em (upem) for a face object to the specified value.
This API is used in rare circumstances.
New in version 0.9.2.
- HarfBuzz.feature_from_string(str)¶
- Parameters:
str (
bytes
) – a string to parse- Returns:
true
if str is successfully parsed,false
otherwise- feature:
the
HarfBuzz.feature_t
to initialize with the parsed values
- Return type:
(
int
, feature:HarfBuzz.feature_t
)
Parses a string into a
HarfBuzz.feature_t
.The format for specifying feature strings follows. All valid CSS font-feature-settings values other than ‘normal’ and the global values are also accepted, though not documented below. CSS string escapes are not supported.
The range indices refer to the positions between Unicode characters. The position before the first character is always 0.
The format is Python-esque. Here is how it all works:
Syntax Value Start End
Setting value: kern 1 0 ∞ Turn feature on +kern 1 0 ∞ Turn feature on -kern 0 0 ∞ Turn feature off kern=0 0 0 ∞ Turn feature off kern=1 1 0 ∞ Turn feature on aalt=2 2 0 ∞ Choose 2nd alternate Setting index: kern[] 1 0 ∞ Turn feature on kern[:] 1 0 ∞ Turn feature on kern[5:] 1 5 ∞ Turn feature on, partial kern[:5] 1 0 5 Turn feature on, partial kern[3:5] 1 3 5 Turn feature on, range kern[3] 1 3 3+1 Turn feature on, single
str
Mixing it all: aalt[3:5]=2 2 3 5 Turn 2nd alternate on for rangeNew in version 0.9.5.
- HarfBuzz.feature_to_string(feature)¶
- Parameters:
feature (
HarfBuzz.feature_t
) – anHarfBuzz.feature_t
to convert- Returns:
output string
- Return type:
buf: [
str
]
Converts a
HarfBuzz.feature_t
into aNULL
-terminated string in the format understood byHarfBuzz.feature_from_string
(). The client in responsible for allocating big enough size for buf, 128 bytes is more than enough.New in version 0.9.5.
- HarfBuzz.font_add_glyph_origin_for_direction(font, glyph, direction, x, y)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to querydirection (
HarfBuzz.direction_t
) – The direction of the text segmentx (
int
) – Input = The original X coordinate Output = The X coordinate plus the X-coordinate of the originy (
int
) – Input = The original Y coordinate Output = The Y coordinate plus the Y-coordinate of the origin
- Returns:
- x:
Input = The original X coordinate Output = The X coordinate plus the X-coordinate of the origin
- y:
Input = The original Y coordinate Output = The Y coordinate plus the Y-coordinate of the origin
- Return type:
Adds the origin coordinates to an (X,Y) point coordinate, in the specified glyph ID in the specified font.
Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 0.9.2.
- HarfBuzz.font_changed(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon
Notifies the font that underlying font data has changed. This has the effect of increasing the serial as returned by
HarfBuzz.font_get_serial
(), which invalidates internal caches.New in version 4.4.0.
- HarfBuzz.font_create(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – a face.- Returns:
The new font object
- Return type:
Constructs a new font object from the specified face.
Note: If face's index value (as passed to
HarfBuzz.face_create
() has non-zero top 16-bits, those bits minus one are passed toHarfBuzz.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.New in version 0.9.2.
- HarfBuzz.font_create_sub_font(parent)¶
- Parameters:
parent (
HarfBuzz.font_t
) – The parent font object- Returns:
The new sub-font font object
- Return type:
Constructs a sub-font font object from the specified parent font, replicating the parent’s properties.
New in version 0.9.2.
- HarfBuzz.font_draw_glyph(font, glyph, dfuncs, draw_data)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph IDdfuncs (
HarfBuzz.draw_funcs_t
) –HarfBuzz.draw_funcs_t
to draw todraw_data (
object
orNone
) – User data to pass to draw callbacks
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.
New in version 7.0.0.
- HarfBuzz.font_funcs_create()¶
- Returns:
The font-functions structure
- Return type:
Creates a new
HarfBuzz.font_funcs_t
structure of font functions.New in version 0.9.2.
- HarfBuzz.font_funcs_get_empty()¶
- Returns:
The font-functions structure
- Return type:
Fetches an empty font-functions structure.
New in version 0.9.2.
- HarfBuzz.font_funcs_is_immutable(ffuncs)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – The font-functions structure- Returns:
true
if ffuncs is immutable,false
otherwise- Return type:
Tests whether a font-functions structure is immutable.
New in version 0.9.2.
- HarfBuzz.font_funcs_make_immutable(ffuncs)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – The font-functions structure
Makes a font-functions structure immutable.
New in version 0.9.2.
- HarfBuzz.font_funcs_set_draw_glyph_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_draw_glyph_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_draw_glyph_func_t
.New in version 7.0.0.
- HarfBuzz.font_funcs_set_font_h_extents_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_font_extents_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_font_h_extents_func_t.
New in version 1.1.2.
- HarfBuzz.font_funcs_set_font_v_extents_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_font_extents_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_font_v_extents_func_t.
New in version 1.1.2.
- HarfBuzz.font_funcs_set_glyph_contour_point_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_contour_point_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_get_glyph_contour_point_func_t
.New in version 0.9.2.
- HarfBuzz.font_funcs_set_glyph_extents_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_extents_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_get_glyph_extents_func_t
.New in version 0.9.2.
- HarfBuzz.font_funcs_set_glyph_from_name_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_from_name_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_get_glyph_from_name_func_t
.New in version 0.9.2.
- HarfBuzz.font_funcs_set_glyph_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – The font-functions structurefunc (
HarfBuzz.font_get_glyph_func_t
) – callback function
Deprecated. Use
HarfBuzz.font_funcs_set_nominal_glyph_func
() andHarfBuzz.font_funcs_set_variation_glyph_func
() instead.New in version 0.9.2.
Deprecated since version 1.2.3.
- HarfBuzz.font_funcs_set_glyph_h_advance_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_advance_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_glyph_h_advance_func_t.
New in version 0.9.2.
- HarfBuzz.font_funcs_set_glyph_h_advances_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_advances_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_glyph_h_advances_func_t.
New in version 1.8.6.
- HarfBuzz.font_funcs_set_glyph_h_kerning_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_kerning_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_glyph_h_kerning_func_t.
New in version 0.9.2.
- HarfBuzz.font_funcs_set_glyph_h_origin_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_origin_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_glyph_h_origin_func_t.
New in version 0.9.2.
- HarfBuzz.font_funcs_set_glyph_name_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_name_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_get_glyph_name_func_t
.New in version 0.9.2.
- HarfBuzz.font_funcs_set_glyph_shape_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_shape_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_get_glyph_shape_func_t
, which is the same asHarfBuzz.font_draw_glyph_func_t
.New in version 4.0.0.
Deprecated since version 7.0.0: Use
HarfBuzz.font_funcs_set_draw_glyph_func
() instead
- HarfBuzz.font_funcs_set_glyph_v_advance_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_advance_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_glyph_v_advance_func_t.
New in version 0.9.2.
- HarfBuzz.font_funcs_set_glyph_v_advances_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_advances_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_glyph_v_advances_func_t.
New in version 1.8.6.
- HarfBuzz.font_funcs_set_glyph_v_kerning_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_kerning_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_glyph_v_kerning_func_t.
New in version 0.9.2.
Deprecated since version 2.0.0.
- HarfBuzz.font_funcs_set_glyph_v_origin_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_glyph_origin_func_t
) – The callback function to assign
Sets the implementation function for #hb_font_get_glyph_v_origin_func_t.
New in version 0.9.2.
- HarfBuzz.font_funcs_set_nominal_glyph_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_nominal_glyph_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_get_nominal_glyph_func_t
.New in version 1.2.3.
- HarfBuzz.font_funcs_set_nominal_glyphs_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_nominal_glyphs_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_get_nominal_glyphs_func_t
.New in version 2.0.0.
- HarfBuzz.font_funcs_set_paint_glyph_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_paint_glyph_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_paint_glyph_func_t
.New in version 7.0.0.
- HarfBuzz.font_funcs_set_variation_glyph_func(ffuncs, func, *user_data)¶
- Parameters:
ffuncs (
HarfBuzz.font_funcs_t
) – A font-function structurefunc (
HarfBuzz.font_get_variation_glyph_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.font_get_variation_glyph_func_t
.New in version 1.2.3.
- HarfBuzz.font_get_empty()¶
- Returns:
The empty font object
- Return type:
Fetches the empty font object.
New in version 0.9.2.
- HarfBuzz.font_get_extents_for_direction(font, direction)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upondirection (
HarfBuzz.direction_t
) – The direction of the text segment
- Returns:
The
HarfBuzz.font_extents_t
retrieved- Return type:
extents:
HarfBuzz.font_extents_t
Fetches the extents for a font in a text segment of the specified direction.
Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 1.1.3.
- HarfBuzz.font_get_face(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
The
HarfBuzz.face_t
value- Return type:
Fetches the face associated with the specified font object.
New in version 0.9.2.
- HarfBuzz.font_get_glyph(font, unicode, variation_selector)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponunicode (
int
) – The Unicode code point to queryvariation_selector (
int
) – A variation-selector code point
- Returns:
true
if data found,false
otherwise- glyph:
The glyph ID retrieved
- Return type:
Fetches the glyph ID for a Unicode code point in the specified font, with an optional variation selector.
If variation_selector is 0, calls
HarfBuzz.font_get_nominal_glyph
(); otherwise callsHarfBuzz.font_get_variation_glyph
().New in version 0.9.2.
- HarfBuzz.font_get_glyph_advance_for_direction(font, glyph, direction)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to querydirection (
HarfBuzz.direction_t
) – The direction of the text segment
- Returns:
- x:
The horizontal advance retrieved
- y:
The vertical advance retrieved
- Return type:
Fetches the advance for a glyph ID from the specified font, in a text segment of the specified direction.
Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_advances_for_direction(font, direction, count, first_glyph, glyph_stride)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upondirection (
HarfBuzz.direction_t
) – The direction of the text segmentcount (
int
) – The number of glyph IDs in the sequence queriedfirst_glyph (
int
) – The first glyph ID to queryglyph_stride (
int
) – The stride between successive glyph IDs
- Returns:
- first_advance:
The first advance retrieved
- advance_stride:
The stride between successive advances
- Return type:
Fetches the advances for a sequence of glyph IDs in the specified font, in a text segment of the specified direction.
Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 1.8.6.
- HarfBuzz.font_get_glyph_contour_point(font, glyph, point_index)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to querypoint_index (
int
) – The contour-point index to query
- Returns:
true
if data found,false
otherwise- x:
The X value retrieved for the contour point
- y:
The Y value retrieved for the contour point
- Return type:
Fetches the (x,y) coordinates of a specified contour-point index in the specified glyph, within the specified font.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_contour_point_for_origin(font, glyph, point_index, direction)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to querypoint_index (
int
) – The contour-point index to querydirection (
HarfBuzz.direction_t
) – The direction of the text segment
- Returns:
true
if data found,false
otherwise- x:
The X value retrieved for the contour point
- y:
The Y value retrieved for the contour point
- Return type:
Fetches the (X,Y) coordinates of a specified contour-point index in the specified glyph ID in the specified font, with respect to the origin in a text segment in the specified direction.
Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_extents(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to query
- Returns:
true
if data found,false
otherwise- extents:
The
HarfBuzz.glyph_extents_t
retrieved
- Return type:
(
int
, extents:HarfBuzz.glyph_extents_t
)
Fetches the
HarfBuzz.glyph_extents_t
data for a glyph ID in the specified font.New in version 0.9.2.
- HarfBuzz.font_get_glyph_extents_for_origin(font, glyph, direction)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to querydirection (
HarfBuzz.direction_t
) – The direction of the text segment
- Returns:
true
if data found,false
otherwise- extents:
The
HarfBuzz.glyph_extents_t
retrieved
- Return type:
(
int
, extents:HarfBuzz.glyph_extents_t
)
Fetches the
HarfBuzz.glyph_extents_t
data for a glyph ID in the specified font, with respect to the origin in a text segment in the specified direction.Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_from_name(font, name)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponname ([
str
]) – The name string to query
- Returns:
true
if data found,false
otherwise- glyph:
The glyph ID retrieved
- Return type:
Fetches the glyph ID that corresponds to a name string in the specified font.
Note: len == -1 means the name string is null-terminated.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_h_advance(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to query
- Returns:
The advance of glyph within font
- Return type:
Fetches the advance for a glyph ID in the specified font, for horizontal text segments.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_h_advances(font, count, first_glyph, glyph_stride, advance_stride)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponcount (
int
) – The number of glyph IDs in the sequence queriedfirst_glyph (
int
) – The first glyph ID to queryglyph_stride (
int
) – The stride between successive glyph IDsadvance_stride (
int
) – The stride between successive advances
- Returns:
The first advance retrieved
- Return type:
first_advance:
int
Fetches the advances for a sequence of glyph IDs in the specified font, for horizontal text segments.
New in version 1.8.6.
- HarfBuzz.font_get_glyph_h_kerning(font, left_glyph, right_glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponleft_glyph (
int
) – The glyph ID of the left glyph in the glyph pairright_glyph (
int
) – The glyph ID of the right glyph in the glyph pair
- Returns:
The kerning adjustment value
- Return type:
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
HarfBuzz.font_funcs_t
function).New in version 0.9.2.
- HarfBuzz.font_get_glyph_h_origin(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to query
- Returns:
true
if data found,false
otherwise- x:
The X coordinate of the origin
- y:
The Y coordinate of the origin
- Return type:
Fetches the (X,Y) coordinates of the origin for a glyph ID in the specified font, for horizontal text segments.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_kerning_for_direction(font, first_glyph, second_glyph, direction)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponfirst_glyph (
int
) – The glyph ID of the first glyph in the glyph pair to querysecond_glyph (
int
) – The glyph ID of the second glyph in the glyph pair to querydirection (
HarfBuzz.direction_t
) – The direction of the text segment
- Returns:
- x:
The horizontal kerning-adjustment value retrieved
- y:
The vertical kerning-adjustment value retrieved
- Return type:
Fetches the kerning-adjustment value for a glyph-pair in the specified font.
Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_name(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to query
- Returns:
true
if data found,false
otherwise- name:
Name string retrieved for the glyph ID
- Return type:
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.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_origin_for_direction(font, glyph, direction)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to querydirection (
HarfBuzz.direction_t
) – The direction of the text segment
- Returns:
- x:
The X coordinate retrieved for the origin
- y:
The Y coordinate retrieved for the origin
- Return type:
Fetches the (X,Y) coordinates of the origin for a glyph in the specified font.
Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_shape(font, glyph, dfuncs, draw_data)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph IDdfuncs (
HarfBuzz.draw_funcs_t
) –HarfBuzz.draw_funcs_t
to draw todraw_data (
object
orNone
) – User data to pass to draw callbacks
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.
New in version 4.0.0.
Deprecated since version 7.0.0: Use
HarfBuzz.font_draw_glyph
() instead
- HarfBuzz.font_get_glyph_v_advance(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to query
- Returns:
The advance of glyph within font
- Return type:
Fetches the advance for a glyph ID in the specified font, for vertical text segments.
New in version 0.9.2.
- HarfBuzz.font_get_glyph_v_advances(font, count, first_glyph, glyph_stride)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponcount (
int
) – The number of glyph IDs in the sequence queriedfirst_glyph (
int
) – The first glyph ID to queryglyph_stride (
int
) – The stride between successive glyph IDs
- Returns:
- first_advance:
The first advance retrieved
- advance_stride:
The stride between successive advances
- Return type:
Fetches the advances for a sequence of glyph IDs in the specified font, for vertical text segments.
New in version 1.8.6.
- HarfBuzz.font_get_glyph_v_kerning(font, top_glyph, bottom_glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upontop_glyph (
int
) – The glyph ID of the top glyph in the glyph pairbottom_glyph (
int
) – The glyph ID of the bottom glyph in the glyph pair
- Returns:
The kerning adjustment value
- Return type:
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
HarfBuzz.font_funcs_t
function).New in version 0.9.2.
Deprecated since version 2.0.0.
- HarfBuzz.font_get_glyph_v_origin(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to query
- Returns:
true
if data found,false
otherwise- x:
The X coordinate of the origin
- y:
The Y coordinate of the origin
- Return type:
Fetches the (X,Y) coordinates of the origin for a glyph ID in the specified font, for vertical text segments.
New in version 0.9.2.
- HarfBuzz.font_get_h_extents(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
true
if data found,false
otherwise- extents:
The font extents retrieved
- Return type:
(
int
, extents:HarfBuzz.font_extents_t
)
Fetches the extents for a specified font, for horizontal text segments.
New in version 1.1.3.
- HarfBuzz.font_get_nominal_glyph(font, unicode)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponunicode (
int
) – The Unicode code point to query
- Returns:
true
if data found,false
otherwise- glyph:
The glyph ID retrieved
- Return type:
Fetches the nominal glyph ID for a Unicode code point in the specified font.
This version of the function should not be used to fetch glyph IDs for code points modified by variation selectors. For variation-selector support, user
HarfBuzz.font_get_variation_glyph
() or useHarfBuzz.font_get_glyph
().New in version 1.2.3.
- HarfBuzz.font_get_nominal_glyphs(font, count, first_unicode, unicode_stride, glyph_stride)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponcount (
int
) – number of code points to queryfirst_unicode (
int
) – The first Unicode code point to queryunicode_stride (
int
) – The stride between successive code pointsglyph_stride (
int
) – The stride between successive glyph IDs
- Returns:
the number of code points processed
- first_glyph:
The first glyph ID retrieved
- Return type:
Fetches the nominal glyph IDs for a sequence of Unicode code points. Glyph IDs must be returned in a #hb_codepoint_t output parameter. Stops at the first unsupported glyph ID.
New in version 2.6.3.
- HarfBuzz.font_get_parent(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
The parent font object
- Return type:
Fetches the parent font of font.
New in version 0.9.2.
- HarfBuzz.font_get_ppem(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
- x_ppem:
Horizontal ppem value
- y_ppem:
Vertical ppem value
- Return type:
Fetches the horizontal and vertical points-per-em (ppem) of a font.
New in version 0.9.2.
- HarfBuzz.font_get_ptem(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
Point size. A value of zero means “not set.”
- Return type:
Fetches the “point size” of a font. Used in CoreText to implement optical sizing.
New in version 1.6.0.
- HarfBuzz.font_get_scale(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
- x_scale:
Horizontal scale value
- y_scale:
Vertical scale value
- Return type:
Fetches the horizontal and vertical scale of a font.
New in version 0.9.2.
- HarfBuzz.font_get_serial(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
serial number
- Return type:
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.
New in version 4.4.0.
- HarfBuzz.font_get_synthetic_bold(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
- x_embolden:
return location for horizontal value
- y_embolden:
return location for vertical value
- in_place:
return location for in-place value
- Return type:
Fetches the “synthetic boldness” parameters of a font.
New in version 7.0.0.
- HarfBuzz.font_get_synthetic_slant(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
Synthetic slant. By default is zero.
- Return type:
Fetches the “synthetic slant” of a font.
New in version 3.3.0.
- HarfBuzz.font_get_v_extents(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
true
if data found,false
otherwise- extents:
The font extents retrieved
- Return type:
(
int
, extents:HarfBuzz.font_extents_t
)
Fetches the extents for a specified font, for vertical text segments.
New in version 1.1.3.
- HarfBuzz.font_get_var_coords_design(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
coordinates array
- length:
Number of coordinates retrieved
- Return type:
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.
New in version 3.3.0.
- HarfBuzz.font_get_var_coords_normalized(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
coordinates array
- length:
Number of coordinates retrieved
- Return type:
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.
New in version 1.4.2.
- HarfBuzz.font_get_var_named_instance(font)¶
- Parameters:
font (
HarfBuzz.font_t
) – a font.- Returns:
Named-instance index or
HarfBuzz.FONT_NO_VAR_NAMED_INSTANCE
.- Return type:
Returns the currently-set named-instance index of the font.
New in version 7.0.0.
- HarfBuzz.font_get_variation_glyph(font, unicode, variation_selector)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponunicode (
int
) – The Unicode code point to queryvariation_selector (
int
) – The variation-selector code point to query
- Returns:
true
if data found,false
otherwise- glyph:
The glyph ID retrieved
- Return type:
Fetches the glyph ID for a Unicode code point when followed by by the specified variation-selector code point, in the specified font.
New in version 1.2.3.
- HarfBuzz.font_glyph_from_string(font, s)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upons (
bytes
) – string to query
- Returns:
true
if data found,false
otherwise- glyph:
The glyph ID corresponding to the string requested
- Return type:
Fetches the glyph ID from font that matches the specified string. Strings of the format
gidDDD
oruniUUUU
are parsed automatically.Note: len == -1 means the string is null-terminated.
New in version 0.9.2.
- HarfBuzz.font_glyph_to_string(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to query
- Returns:
The string containing the glyph name
- Return type:
s: [
str
]
Fetches the name of the specified glyph ID in font and returns it in string s.
If the glyph ID has no name in font, a string of the form
gidDDD
is generated, withDDD
being the glyph ID.According to the OpenType specification, glyph names are limited to 63 characters and can only contain (a subset of) ASCII.
New in version 0.9.2.
- HarfBuzz.font_is_immutable(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
true
if font is immutable,false
otherwise- Return type:
Tests whether a font object is immutable.
New in version 0.9.2.
- HarfBuzz.font_make_immutable(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon
Makes font immutable.
New in version 0.9.2.
- HarfBuzz.font_paint_glyph(font, glyph, pfuncs, paint_data, palette_index, foreground)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph IDpfuncs (
HarfBuzz.paint_funcs_t
) –HarfBuzz.paint_funcs_t
to paint withpaint_data (
object
orNone
) – User data to pass to paint callbackspalette_index (
int
) – The index of the font’s color palette to useforeground (
int
) – The foreground color, unpremultipled
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
HarfBuzz.ot_color_has_palettes
()), then palette_index selects the palette to use. If the font only has one palette, this will be 0.New in version 7.0.0.
- HarfBuzz.font_set_face(font, face)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponface (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to assign
Sets face as the font-face value of font.
New in version 1.4.3.
- HarfBuzz.font_set_funcs(font, klass, font_data, destroy)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponklass (
HarfBuzz.font_funcs_t
) – The font-functions structure.destroy (
HarfBuzz.destroy_func_t
orNone
) – The function to call when font_data is not needed anymore
Replaces the font-functions structure attached to a font, updating the font’s user-data with font-data and the destroy callback.
New in version 0.9.2.
- HarfBuzz.font_set_funcs_data(font, font_data, destroy)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upondestroy (
HarfBuzz.destroy_func_t
orNone
) – The function to call when font_data is not needed anymore
Replaces the user data attached to a font, updating the font’s destroy callback.
New in version 0.9.2.
- HarfBuzz.font_set_parent(font, parent)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponparent (
HarfBuzz.font_t
) – The parent font object to assign
Sets the parent font of font.
New in version 1.0.5.
- HarfBuzz.font_set_ppem(font, x_ppem, y_ppem)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponx_ppem (
int
) – Horizontal ppem value to assigny_ppem (
int
) – Vertical ppem value to assign
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.
New in version 0.9.2.
- HarfBuzz.font_set_ptem(font, ptem)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponptem (
float
) – font size in points.
Sets the “point size” of a font. Set to zero to unset. Used in CoreText to implement optical sizing.
Note: There are 72 points in an inch.
New in version 1.6.0.
- HarfBuzz.font_set_scale(font, x_scale, y_scale)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponx_scale (
int
) – Horizontal scale value to assigny_scale (
int
) – Vertical scale value to assign
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 #hb_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
HarfBuzz.font_set_ptem
(), and the pixel size usingHarfBuzz.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 #hb_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.
New in version 0.9.2.
- HarfBuzz.font_set_synthetic_bold(font, x_embolden, y_embolden, in_place)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponx_embolden (
float
) – the amount to embolden horizontallyy_embolden (
float
) – the amount to embolden verticallyin_place (
int
) – whether to embolden glyphs in-place
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
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.New in version 7.0.0.
- HarfBuzz.font_set_synthetic_slant(font, slant)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponslant (
float
) – synthetic slant value.
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
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.New in version 3.3.0.
- HarfBuzz.font_set_var_coords_design(font, coords)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponcoords ([
float
]) – Array of variation coordinates to apply
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.
New in version 1.4.2.
- HarfBuzz.font_set_var_coords_normalized(font, coords)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponcoords ([
int
]) – Array of variation coordinates to apply
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.
New in version 1.4.2.
- HarfBuzz.font_set_var_named_instance(font, instance_index)¶
- Parameters:
font (
HarfBuzz.font_t
) – a font.instance_index (
int
) – named instance index.
Sets design coords of a font from a named-instance index.
New in version 2.6.0.
- HarfBuzz.font_set_variation(font, tag, value)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upontag (
int
) – The #hb_tag_t tag of the variation-axis namevalue (
float
) – The value of the variation axis
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
HarfBuzz.font_set_variations
() instead.New in version 7.1.0.
- HarfBuzz.font_set_variations(font, variations)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponvariations ([
HarfBuzz.variation_t
]) – Array of variation settings to apply
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.
New in version 1.4.2.
- HarfBuzz.font_subtract_glyph_origin_for_direction(font, glyph, direction, x, y)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph ID to querydirection (
HarfBuzz.direction_t
) – The direction of the text segmentx (
int
) – Input = The original X coordinate Output = The X coordinate minus the X-coordinate of the originy (
int
) – Input = The original Y coordinate Output = The Y coordinate minus the Y-coordinate of the origin
- Returns:
- x:
Input = The original X coordinate Output = The X coordinate minus the X-coordinate of the origin
- y:
Input = The original Y coordinate Output = The Y coordinate minus the Y-coordinate of the origin
- Return type:
Subtracts the origin coordinates from an (X,Y) point coordinate, in the specified glyph ID in the specified font.
Calls the appropriate direction-specific variant (horizontal or vertical) depending on the value of direction.
New in version 0.9.2.
- HarfBuzz.ft_face_create(ft_face, destroy)¶
- Parameters:
ft_face (
freetype2.Face
) –freetype2.Face
to work upondestroy (
HarfBuzz.destroy_func_t
orNone
) – A callback to call when the face object is not needed anymore
- Returns:
the new
HarfBuzz.face_t
face object- Return type:
Creates an
HarfBuzz.face_t
face object from the specifiedfreetype2.Face
.Note that this is using the
freetype2.Face
object just to get at the underlying font data, and fonts created from the returnedHarfBuzz.face_t
will use the native HarfBuzz font implementation, unless you callHarfBuzz.ft_font_set_funcs
() on them.This variant of the function does not provide any life-cycle management.
Most client programs should use
HarfBuzz.ft_face_create_referenced
() (or, perhaps,HarfBuzz.ft_face_create_cached
()) instead.If you know you have valid reasons not to use
HarfBuzz.ft_face_create_referenced
(), then it is the client program’s responsibility to destroy ft_face after theHarfBuzz.face_t
face object has been destroyed.New in version 0.9.2.
- HarfBuzz.ft_face_create_cached(ft_face)¶
- Parameters:
ft_face (
freetype2.Face
) –freetype2.Face
to work upon- Returns:
the new
HarfBuzz.face_t
face object- Return type:
Creates an
HarfBuzz.face_t
face object from the specifiedfreetype2.Face
.Note that this is using the
freetype2.Face
object just to get at the underlying font data, and fonts created from the returnedHarfBuzz.face_t
will use the native HarfBuzz font implementation, unless you callHarfBuzz.ft_font_set_funcs
() on them.This variant of the function caches the newly created
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 sameHarfBuzz.face_t
returned to them, and thatHarfBuzz.face_t
will be correctly reference counted.However, client programs are still responsible for destroying ft_face after the last
HarfBuzz.face_t
face object has been destroyed.New in version 0.9.2.
- HarfBuzz.ft_face_create_referenced(ft_face)¶
- Parameters:
ft_face (
freetype2.Face
) –freetype2.Face
to work upon- Returns:
the new
HarfBuzz.face_t
face object- Return type:
Creates an
HarfBuzz.face_t
face object from the specifiedfreetype2.Face
.Note that this is using the
freetype2.Face
object just to get at the underlying font data, and fonts created from the returnedHarfBuzz.face_t
will use the native HarfBuzz font implementation, unless you callHarfBuzz.ft_font_set_funcs
() on them.This is the preferred variant of the
HarfBuzz.ft_face_create
function family, because it calls FT_Reference_Face() on ft_face, ensuring that ft_face remains alive as long as the resultingHarfBuzz.face_t
face object remains alive. Also calls FT_Done_Face() when theHarfBuzz.face_t
face object is destroyed.Use this version unless you know you have good reasons not to.
New in version 0.9.38.
- HarfBuzz.ft_font_changed(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon
Refreshes the state of font when the underlying
freetype2.Face
has changed. This function should be called after changing the size or variation-axis settings on thefreetype2.Face
.New in version 1.0.5.
- HarfBuzz.ft_font_create(ft_face, destroy)¶
- Parameters:
ft_face (
freetype2.Face
) –freetype2.Face
to work upondestroy (
HarfBuzz.destroy_func_t
orNone
) – A callback to call when the font object is not needed anymore
- Returns:
the new
HarfBuzz.font_t
font object- Return type:
Creates an
HarfBuzz.font_t
font object from the specifiedfreetype2.Face
.Note: You must set the face size on ft_face before calling
HarfBuzz.ft_font_create
() on it. HarfBuzz assumes size is always set and will access `size` member offreetype2.Face
unconditionally. This variant of the function does not provide any life-cycle management.Most client programs should use
HarfBuzz.ft_font_create_referenced
() instead.If you know you have valid reasons not to use
HarfBuzz.ft_font_create_referenced
(), then it is the client program’s responsibility to destroy ft_face after theHarfBuzz.font_t
font object has been destroyed.HarfBuzz will use the destroy callback on the
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 theHarfBuzz.font_t
font object has been destroyed.New in version 0.9.2.
- HarfBuzz.ft_font_create_referenced(ft_face)¶
- Parameters:
ft_face (
freetype2.Face
) –freetype2.Face
to work upon- Returns:
the new
HarfBuzz.font_t
font object- Return type:
Creates an
HarfBuzz.font_t
font object from the specifiedfreetype2.Face
.Note: You must set the face size on ft_face before calling
HarfBuzz.ft_font_create_referenced
() on it. HarfBuzz assumes size is always set and will access `size` member offreetype2.Face
unconditionally. This is the preferred variant of theHarfBuzz.ft_font_create
function family, because it calls FT_Reference_Face() on ft_face, ensuring that ft_face remains alive as long as the resultingHarfBuzz.font_t
font object remains alive.Use this version unless you know you have good reasons not to.
New in version 0.9.38.
- HarfBuzz.ft_font_get_load_flags(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
FT_Load_Glyph flags found, or 0
- Return type:
Fetches the FT_Load_Glyph load flags of the specified
HarfBuzz.font_t
.For more information, see <https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx>
This function works with
HarfBuzz.font_t
objects created byHarfBuzz.ft_font_create
() orHarfBuzz.ft_font_create_referenced
().New in version 1.0.5.
- HarfBuzz.ft_font_set_funcs(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon
Configures the font-functions structure of the specified
HarfBuzz.font_t
font object to use FreeType font functions.In particular, you can use this function to configure an existing
HarfBuzz.face_t
face object for use with FreeType font functions even if thatHarfBuzz.face_t
face object was initially created withHarfBuzz.face_create
(), and therefore was not initially configured to use FreeType font functions.An
HarfBuzz.font_t
object created withHarfBuzz.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
HarfBuzz.font_t
after calling this function, you need to callHarfBuzz.ft_hb_font_changed
() to update the underlyingfreetype2.Face
.Note: Internally, this function creates an
freetype2.Face
.New in version 1.0.5.
- HarfBuzz.ft_font_set_load_flags(font, load_flags)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponload_flags (
int
) – The FreeType load flags to set
Sets the FT_Load_Glyph load flags for the specified
HarfBuzz.font_t
.For more information, see <https://freetype.org/freetype2/docs/reference/ft2-glyph_retrieval.html#ft_load_xxx>
This function works with
HarfBuzz.font_t
objects created byHarfBuzz.ft_font_create
() orHarfBuzz.ft_font_create_referenced
().New in version 1.0.5.
- HarfBuzz.ft_hb_font_changed(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon- Returns:
true if changed, false otherwise
- Return type:
Refreshes the state of the underlying
freetype2.Face
of font when theHarfBuzz.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.New in version 4.4.0.
- HarfBuzz.glib_blob_create(gbytes)¶
- Parameters:
gbytes (
GLib.Bytes
) – theGLib.Bytes
structure to work upon- Returns:
the new
HarfBuzz.blob_t
blob object- Return type:
Creates an
HarfBuzz.blob_t
blob from the specifiedGLib.Bytes
data structure.New in version 0.9.38.
- HarfBuzz.glib_get_unicode_funcs()¶
- Returns:
a pointer to the
HarfBuzz.unicode_funcs_t
Unicode-functions structure- Return type:
Fetches a Unicode-functions structure that is populated with the appropriate GLib function for each method.
New in version 0.9.38.
- HarfBuzz.glib_script_from_script(script)¶
- Parameters:
script (
HarfBuzz.script_t
) – TheHarfBuzz.script_t
to query- Returns:
the
GLib.UnicodeScript
identifier found- Return type:
Fetches the
GLib.UnicodeScript
identifier that corresponds to the specifiedHarfBuzz.script_t
script.New in version 0.9.38.
- HarfBuzz.glib_script_to_script(script)¶
- Parameters:
script (
GLib.UnicodeScript
) – TheGLib.UnicodeScript
identifier to query- Returns:
the
HarfBuzz.script_t
script found- Return type:
Fetches the
HarfBuzz.script_t
script that corresponds to the specifiedGLib.UnicodeScript
identifier.New in version 0.9.38.
- HarfBuzz.glyph_info_get_glyph_flags(info)¶
- Parameters:
info (
HarfBuzz.glyph_info_t
) – aHarfBuzz.glyph_info_t
- Returns:
The
HarfBuzz.glyph_flags_t
encoded within info- Return type:
Returns glyph flags encoded within a
HarfBuzz.glyph_info_t
.New in version 1.5.0.
- HarfBuzz.language_from_string(str)¶
- Parameters:
str (
bytes
) – a string representing a BCP 47 language tag- Returns:
The
HarfBuzz.language_t
corresponding to the BCP 47 language tag.- Return type:
Converts str representing a BCP 47 language tag to the corresponding
HarfBuzz.language_t
.New in version 0.9.2.
- HarfBuzz.language_get_default()¶
- Returns:
The default language of the locale as an
HarfBuzz.language_t
- Return type:
Fetch the default language from current locale.
Note that the first time this function is called, it calls “setlocale (LC_CTYPE, nullptr)” to fetch current locale. The underlying setlocale function is, in many implementations, NOT threadsafe. To avoid problems, call this function once before multiple threads can call it. This function is only used from
HarfBuzz.buffer_guess_segment_properties
() by HarfBuzz itself.New in version 0.9.2.
- HarfBuzz.language_matches(language, specific)¶
- Parameters:
language (
HarfBuzz.language_t
) – TheHarfBuzz.language_t
to work onspecific (
HarfBuzz.language_t
) – AnotherHarfBuzz.language_t
- Returns:
true
if languages match,false
otherwise.- Return type:
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”.
New in version 5.0.0.
- HarfBuzz.language_to_string(language)¶
- Parameters:
language (
HarfBuzz.language_t
) – TheHarfBuzz.language_t
to convert- Returns:
A
NULL
-terminated string representing the language. Must not be freed by the caller.- Return type:
Converts an
HarfBuzz.language_t
to a string.New in version 0.9.2.
- HarfBuzz.map_allocation_successful(map)¶
- Parameters:
map (
HarfBuzz.map_t
) – A map- Returns:
true
if allocation succeeded,false
otherwise- Return type:
Tests whether memory allocation for a set was successful.
New in version 1.7.7.
- HarfBuzz.map_clear(map)¶
- Parameters:
map (
HarfBuzz.map_t
) – A map
Clears out the contents of map.
New in version 1.7.7.
- HarfBuzz.map_copy(map)¶
- Parameters:
map (
HarfBuzz.map_t
) – A map- Returns:
Newly-allocated map.
- Return type:
Allocate a copy of map.
New in version 4.4.0.
- HarfBuzz.map_create()¶
- Returns:
The new
HarfBuzz.map_t
- Return type:
Creates a new, initially empty map.
New in version 1.7.7.
- HarfBuzz.map_del(map, key)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapkey (
int
) – The key to delete
Removes key and its stored value from map.
New in version 1.7.7.
- HarfBuzz.map_get(map, key)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapkey (
int
) – The key to query
- Return type:
Fetches the value stored for key in map.
New in version 1.7.7.
- HarfBuzz.map_get_empty()¶
- Returns:
The empty
HarfBuzz.map_t
- Return type:
Fetches the singleton empty
HarfBuzz.map_t
.New in version 1.7.7.
- HarfBuzz.map_get_population(map)¶
- Parameters:
map (
HarfBuzz.map_t
) – A map- Returns:
The population of map
- Return type:
Returns the number of key-value pairs in the map.
New in version 1.7.7.
- HarfBuzz.map_has(map, key)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapkey (
int
) – The key to query
- Returns:
true
if key is found in map,false
otherwise- Return type:
Tests whether key is an element of map.
New in version 1.7.7.
- HarfBuzz.map_hash(map)¶
- Parameters:
map (
HarfBuzz.map_t
) – A map- Returns:
A hash of map.
- Return type:
Creates a hash representing map.
New in version 4.4.0.
- HarfBuzz.map_is_empty(map)¶
- Parameters:
map (
HarfBuzz.map_t
) – A map- Returns:
true
if map is empty- Return type:
Tests whether map is empty (contains no elements).
New in version 1.7.7.
- HarfBuzz.map_is_equal(map, other)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapother (
HarfBuzz.map_t
) – Another map
- Returns:
true
if the two maps are equal,false
otherwise.- Return type:
Tests whether map and other are equal (contain the same elements).
New in version 4.3.0.
- HarfBuzz.map_keys(map, keys)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapkeys (
HarfBuzz.set_t
) – A set
Add the keys of map to keys.
New in version 7.0.0.
- HarfBuzz.map_next(map, idx)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapidx (
int
) – Iterator internal state
- Returns:
true
if there was a next value,false
otherwise- idx:
Iterator internal state
- key:
Key retrieved
- value:
Value retrieved
- Return type:
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.
New in version 7.0.0.
- HarfBuzz.map_set(map, key, value)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapkey (
int
) – The key to store in the mapvalue (
int
) – The value to store for key
Stores key:value in the map.
New in version 1.7.7.
- HarfBuzz.map_update(map, other)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapother (
HarfBuzz.map_t
) – Another map
Add the contents of other to map.
New in version 7.0.0.
- HarfBuzz.map_values(map, values)¶
- Parameters:
map (
HarfBuzz.map_t
) – A mapvalues (
HarfBuzz.set_t
) – A set
Add the values of map to values.
New in version 7.0.0.
- HarfBuzz.ot_color_glyph_get_layers(face, glyph, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponglyph (
int
) – The glyph index to querystart_offset (
int
) – offset of the first layer to retrieve
- Returns:
Total number of layers available for the glyph index queried
- layers:
The array of layers found
- Return type:
(
int
, layers: [HarfBuzz.ot_color_layer_t
])
Fetches a list of all color layers for the specified glyph index in the specified face. The list returned will begin at the offset provided.
New in version 2.1.0.
- HarfBuzz.ot_color_glyph_has_paint(face, glyph)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponglyph (
int
) – The glyph index to query
- Returns:
true
if data found,false
otherwise- Return type:
Tests where a face includes COLRv1 paint data for glyph.
New in version 7.0.0.
- HarfBuzz.ot_color_glyph_reference_png(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – a glyph index
- Returns:
An
HarfBuzz.blob_t
containing the PNG image for the glyph, if available- Return type:
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.
New in version 2.1.0.
- HarfBuzz.ot_color_glyph_reference_svg(face, glyph)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponglyph (
int
) – a svg glyph index
- Returns:
An
HarfBuzz.blob_t
containing the SVG document of the glyph, if available- Return type:
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.
New in version 2.1.0.
- HarfBuzz.ot_color_has_layers(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests whether a face includes a
COLR
table with data according to COLRv0.New in version 2.1.0.
- HarfBuzz.ot_color_has_paint(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests where a face includes a
COLR
table with data according to COLRv1.New in version 7.0.0.
- HarfBuzz.ot_color_has_palettes(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests whether a face includes a
CPAL
color-palette table.New in version 2.1.0.
- HarfBuzz.ot_color_has_png(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests whether a face has PNG glyph images (either in
CBDT
orsbix
tables).New in version 2.1.0.
- HarfBuzz.ot_color_has_svg(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon.- Returns:
true
if data found,false
otherwise.- Return type:
Tests whether a face includes any
SVG
glyph images.New in version 2.1.0.
- HarfBuzz.ot_color_palette_color_get_name_id(face, color_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponcolor_index (
int
) – The index of the color
- Returns:
the Name ID found for the color.
- Return type:
Fetches the
name
table Name ID that provides display names for the specified color in a face’sCPAL
color palette.Display names can be generic (e.g., “Background”) or specific (e.g., “Eye color”).
New in version 2.1.0.
- HarfBuzz.ot_color_palette_get_colors(face, palette_index, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponpalette_index (
int
) – the index of the color palette to querystart_offset (
int
) – offset of the first color to retrieve
- Returns:
the total number of colors in the palette
- colors:
The array of #hb_color_t records found
- Return type:
Fetches a list of the colors in a color palette.
After calling this function, colors will be filled with the palette colors. If colors is
None
, the function will just return the number of total colors without storing any actual colors; this can be used for allocating a buffer of suitable size before callingHarfBuzz.ot_color_palette_get_colors
() a second time.The RGBA values in the palette are unpremultiplied. See the OpenType spec CPAL section for details.
New in version 2.1.0.
- HarfBuzz.ot_color_palette_get_count(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
the number of palettes found
- Return type:
Fetches the number of color palettes in a face.
New in version 2.1.0.
- HarfBuzz.ot_color_palette_get_flags(face, palette_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponpalette_index (
int
) – The index of the color palette
- Returns:
the
HarfBuzz.ot_color_palette_flags_t
of the requested color palette- Return type:
Fetches the flags defined for a color palette.
New in version 2.1.0.
- HarfBuzz.ot_color_palette_get_name_id(face, palette_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponpalette_index (
int
) – The index of the color palette
- Returns:
the Named ID found for the palette. If the requested palette has no name the result is
HarfBuzz.ot_name_id_predefined_t.INVALID
.- Return type:
Fetches the
name
table Name ID that provides display names for aCPAL
color palette.Palette display names can be generic (e.g., “Default”) or provide specific, themed names (e.g., “Spring”, “Summer”, “Fall”, and “Winter”).
New in version 2.1.0.
- HarfBuzz.ot_font_set_funcs(font)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upon
Sets the font functions to use when working with font.
New in version 0.9.28.
- HarfBuzz.ot_layout_collect_features(face, table_tag, scripts, languages, features)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscripts ([
int
] orNone
) – The array of scripts to collect features for, terminated by %HB_TAG_NONElanguages ([
int
] orNone
) – The array of languages to collect features for, terminated by %HB_TAG_NONEfeatures ([
int
] orNone
) – The array of features to collect, terminated by %HB_TAG_NONE
- Returns:
The set of feature indexes found for the query
- Return type:
feature_indexes:
HarfBuzz.set_t
Fetches a list of all feature indexes in the specified face’s GSUB table or GPOS table, underneath the specified scripts, languages, and features. If no list of scripts is provided, all scripts will be queried. If no list of languages is provided, all languages will be queried. If no list of features is provided, all features will be queried.
New in version 1.8.5.
- HarfBuzz.ot_layout_collect_features_map(face, table_tag, script_index, language_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_index (
int
) – The index of the requested language tag
- Returns:
The map of feature tag to feature index.
- Return type:
feature_map:
HarfBuzz.map_t
Fetches the mapping from feature tags to feature indexes for the specified script and language.
New in version 8.1.0.
- HarfBuzz.ot_layout_collect_lookups(face, table_tag, scripts, languages, features)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscripts ([
int
] orNone
) – The array of scripts to collect lookups for, terminated by %HB_TAG_NONElanguages ([
int
] orNone
) – The array of languages to collect lookups for, terminated by %HB_TAG_NONEfeatures ([
int
] orNone
) – The array of features to collect lookups for, terminated by %HB_TAG_NONE
- Returns:
The array of lookup indexes found for the query
- Return type:
lookup_indexes:
HarfBuzz.set_t
Fetches a list of all feature-lookup indexes in the specified face’s GSUB table or GPOS table, underneath the specified scripts, languages, and features. If no list of scripts is provided, all scripts will be queried. If no list of languages is provided, all languages will be queried. If no list of features is provided, all features will be queried.
New in version 0.9.8.
- HarfBuzz.ot_layout_feature_get_characters(face, table_tag, feature_index, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – table tag to query, “GSUB” or “GPOS”.feature_index (
int
) – index of feature to query.start_offset (
int
) – offset of the first character to retrieve
- Returns:
Number of total sample characters in the cvXX feature.
- characters:
A buffer pointer. The Unicode codepoints of the characters for which this feature provides glyph variants.
- Return type:
Fetches a list of the characters defined as having a variant under the specified “Character Variant” (“cvXX”) feature tag.
New in version 2.0.0.
- HarfBuzz.ot_layout_feature_get_lookups(face, table_tag, feature_index, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSfeature_index (
int
) – The index of the requested featurestart_offset (
int
) – offset of the first lookup to retrieve
- Returns:
Total number of lookups.
- lookup_indexes:
The array of lookup indexes found for the query
- Return type:
Fetches a list of all lookups enumerated for the specified feature, in the specified face’s GSUB table or GPOS table. The list returned will begin at the offset provided.
New in version 0.9.7.
- HarfBuzz.ot_layout_feature_get_name_ids(face, table_tag, feature_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – table tag to query, “GSUB” or “GPOS”.feature_index (
int
) – index of feature to query.
- Returns:
true
if data found,false
otherwise- label_id:
The ‘name’ table name ID that specifies a string for a user-interface label for this feature. (May be
None
.)- tooltip_id:
The ‘name’ table name ID that specifies a string that an application can use for tooltip text for this feature. (May be
None
.)- sample_id:
The ‘name’ table name ID that specifies sample text that illustrates the effect of this feature. (May be
None
.)- num_named_parameters:
Number of named parameters. (May be zero.)
- first_param_id:
The first ‘name’ table name ID used to specify strings for user-interface labels for the feature parameters. (Must be zero if numParameters is zero.)
- Return type:
(
int
, label_id:int
, tooltip_id:int
, sample_id:int
, num_named_parameters:int
, first_param_id:int
)
Fetches name indices from feature parameters for “Stylistic Set” (‘ssXX’) or “Character Variant” (‘cvXX’) features.
New in version 2.0.0.
- HarfBuzz.ot_layout_feature_with_variations_get_lookups(face, table_tag, feature_index, variations_index, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSfeature_index (
int
) – The index of the feature to queryvariations_index (
int
) – The index of the feature variation to querystart_offset (
int
) – offset of the first lookup to retrieve
- Returns:
Total number of lookups.
- lookup_indexes:
The array of lookups found for the query
- Return type:
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.
New in version 1.4.0.
- HarfBuzz.ot_layout_get_attach_points(face, glyph, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work onglyph (
int
) – The #hb_codepoint_t code point to querystart_offset (
int
) – offset of the first attachment point to retrieve
- Returns:
Total number of attachment points for glyph.
- point_array:
The array of attachment points found for the query
- Return type:
Fetches a list of all attachment points for the specified glyph in the GDEF table of the face. The list returned will begin at the offset provided.
Useful if the client program wishes to cache the list.
- HarfBuzz.ot_layout_get_baseline(font, baseline_tag, direction, script_tag, language_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – a fontbaseline_tag (
HarfBuzz.ot_layout_baseline_tag_t
) – a baseline tagdirection (
HarfBuzz.direction_t
) – text direction.script_tag (
int
) – script tag.language_tag (
int
) – language tag, currently unused.
- Returns:
true
if found baseline value in the font.- coord:
baseline value if found.
- Return type:
Fetches a baseline value from the face.
New in version 2.6.0.
- HarfBuzz.ot_layout_get_baseline2(font, baseline_tag, direction, script, language)¶
- Parameters:
font (
HarfBuzz.font_t
) – a fontbaseline_tag (
HarfBuzz.ot_layout_baseline_tag_t
) – a baseline tagdirection (
HarfBuzz.direction_t
) – text direction.script (
HarfBuzz.script_t
) – script.language (
HarfBuzz.language_t
orNone
) – language, currently unused.
- Returns:
true
if found baseline value in the font.- coord:
baseline value if found.
- Return type:
Fetches a baseline value from the face.
This function is like
HarfBuzz.ot_layout_get_baseline
() but takesHarfBuzz.script_t
andHarfBuzz.language_t
instead of OpenType #hb_tag_t.New in version 8.0.0.
- HarfBuzz.ot_layout_get_baseline_with_fallback(font, baseline_tag, direction, script_tag, language_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – a fontbaseline_tag (
HarfBuzz.ot_layout_baseline_tag_t
) – a baseline tagdirection (
HarfBuzz.direction_t
) – text direction.script_tag (
int
) – script tag.language_tag (
int
) – language tag, currently unused.
- Returns:
baseline value if found.
- Return type:
coord:
int
Fetches a baseline value from the face, and synthesizes it if the font does not have it.
New in version 4.0.0.
- HarfBuzz.ot_layout_get_baseline_with_fallback2(font, baseline_tag, direction, script, language)¶
- Parameters:
font (
HarfBuzz.font_t
) – a fontbaseline_tag (
HarfBuzz.ot_layout_baseline_tag_t
) – a baseline tagdirection (
HarfBuzz.direction_t
) – text direction.script (
HarfBuzz.script_t
) – script.language (
HarfBuzz.language_t
orNone
) – language, currently unused.
- Returns:
baseline value if found.
- Return type:
coord:
int
Fetches a baseline value from the face, and synthesizes it if the font does not have it.
This function is like
HarfBuzz.ot_layout_get_baseline_with_fallback
() but takesHarfBuzz.script_t
andHarfBuzz.language_t
instead of OpenType #hb_tag_t.New in version 8.0.0.
- HarfBuzz.ot_layout_get_font_extents(font, direction, script_tag, language_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – a fontdirection (
HarfBuzz.direction_t
) – text direction.script_tag (
int
) – script tag.language_tag (
int
) – language tag.
- Returns:
true
if found script/language-specific font extents.- extents:
font extents if found.
- Return type:
(
int
, extents:HarfBuzz.font_extents_t
orNone
)
Fetches script/language-specific font extents. These values are looked up in the
BASE
table’sMinMax
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.
New in version 8.0.0.
- HarfBuzz.ot_layout_get_font_extents2(font, direction, script, language)¶
- Parameters:
font (
HarfBuzz.font_t
) – a fontdirection (
HarfBuzz.direction_t
) – text direction.script (
HarfBuzz.script_t
) – script.language (
HarfBuzz.language_t
orNone
) – language.
- Returns:
true
if found script/language-specific font extents.- extents:
font extents if found.
- Return type:
(
int
, extents:HarfBuzz.font_extents_t
orNone
)
Fetches script/language-specific font extents. These values are looked up in the
BASE
table’sMinMax
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
HarfBuzz.ot_layout_get_font_extents
() but takesHarfBuzz.script_t
andHarfBuzz.language_t
instead of OpenType #hb_tag_t.New in version 8.0.0.
- HarfBuzz.ot_layout_get_glyph_class(face, glyph)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work onglyph (
int
) – The #hb_codepoint_t code point to query
- Returns:
The
HarfBuzz.ot_layout_glyph_class_t
glyph class of the given code point in the GDEF table of the face.- Return type:
Fetches the GDEF class of the requested glyph in the specified face.
New in version 0.9.7.
- HarfBuzz.ot_layout_get_glyphs_in_class(face, klass)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work onklass (
HarfBuzz.ot_layout_glyph_class_t
) – TheHarfBuzz.ot_layout_glyph_class_t
GDEF class to retrieve
- Returns:
The
HarfBuzz.set_t
set of all glyphs belonging to the requested class.- Return type:
glyphs:
HarfBuzz.set_t
Retrieves the set of all glyphs from the face that belong to the requested glyph class in the face’s GDEF table.
New in version 0.9.7.
- HarfBuzz.ot_layout_get_horizontal_baseline_tag_for_script(script)¶
- Parameters:
script (
HarfBuzz.script_t
) – a script tag.- Returns:
dominant baseline tag for the script.
- Return type:
Fetches the dominant horizontal baseline tag used by script.
New in version 4.0.0.
- HarfBuzz.ot_layout_get_ligature_carets(font, direction, glyph, start_offset)¶
- Parameters:
font (
HarfBuzz.font_t
) – TheHarfBuzz.font_t
to work ondirection (
HarfBuzz.direction_t
) – TheHarfBuzz.direction_t
text direction to useglyph (
int
) – The #hb_codepoint_t code point to querystart_offset (
int
) – offset of the first caret position to retrieve
- Returns:
Total number of ligature caret positions for glyph.
- caret_array:
The array of caret positions found for the query
- Return type:
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.
- HarfBuzz.ot_layout_get_size_params(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- design_size:
The design size of the face
- subfamily_id:
The identifier of the face within the font subfamily
- subfamily_name_id:
The ‘name’ table name ID of the face within the font subfamily
- range_start:
The minimum size of the recommended size range for the face
- range_end:
The maximum size of the recommended size range for the face
- Return type:
(
int
, design_size:int
, subfamily_id:int
, subfamily_name_id:int
, range_start:int
, range_end:int
)
Fetches optical-size feature data (i.e., the
size
feature from GPOS). Note that the subfamily_id and the subfamily name string (accessible via the subfamily_name_id) as used here are defined as pertaining only to fonts within a font family that differ specifically in their respective size ranges; other ways to differentiate fonts within a subfamily are not covered by thesize
feature.For more information on this distinction, see the `size feature documentation < https://docs.microsoft.com/en-us/typography/opentype/spec/features_pt#tag-size>`__.
New in version 0.9.10.
- HarfBuzz.ot_layout_has_glyph_classes(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests whether a face has any glyph classes defined in its GDEF table.
- HarfBuzz.ot_layout_has_positioning(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if the face has GPOS data,false
otherwise- Return type:
Tests whether the specified face includes any GPOS positioning.
- HarfBuzz.ot_layout_has_substitution(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upon- Returns:
true
if data found,false
otherwise- Return type:
Tests whether the specified face includes any GSUB substitutions.
New in version 0.6.0.
- HarfBuzz.ot_layout_language_find_feature(face, table_tag, script_index, language_index, feature_tag)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_index (
int
) – The index of the requested language tagfeature_tag (
int
) – #hb_tag_t of the feature tag requested
- Returns:
true
if the feature is found,false
otherwise- feature_index:
The index of the requested feature
- Return type:
Fetches the index of a given feature tag in the specified face’s GSUB table or GPOS table, underneath the specified script and language.
New in version 0.6.0.
- HarfBuzz.ot_layout_language_get_feature_indexes(face, table_tag, script_index, language_index, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_index (
int
) – The index of the requested language tagstart_offset (
int
) – offset of the first feature tag to retrieve
- Returns:
Total number of features.
- feature_indexes:
The array of feature indexes found for the query
- Return type:
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.
New in version 0.6.0.
- HarfBuzz.ot_layout_language_get_feature_tags(face, table_tag, script_index, language_index, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_index (
int
) – The index of the requested language tagstart_offset (
int
) – offset of the first feature tag to retrieve
- Returns:
Total number of feature tags.
- feature_tags:
The array of #hb_tag_t feature tags found for the query
- Return type:
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.
New in version 0.6.0.
- HarfBuzz.ot_layout_language_get_required_feature(face, table_tag, script_index, language_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_index (
int
) – The index of the requested language tag
- Returns:
true
if the feature is found,false
otherwise- feature_index:
The index of the requested feature
- feature_tag:
The #hb_tag_t of the requested feature
- Return type:
Fetches the tag of a requested feature index in the given face’s GSUB or GPOS table, underneath the specified script and language.
New in version 0.9.30.
- HarfBuzz.ot_layout_language_get_required_feature_index(face, table_tag, script_index, language_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_index (
int
) – The index of the requested language tag
- Returns:
true
if the feature is found,false
otherwise- feature_index:
The index of the requested feature
- Return type:
Fetches the index of a requested feature in the given face’s GSUB or GPOS table, underneath the specified script and language.
New in version 0.6.0.
- HarfBuzz.ot_layout_lookup_collect_glyphs(face, table_tag, lookup_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSlookup_index (
int
) – The index of the feature lookup to query
- Returns:
- glyphs_before:
Array of glyphs preceding the substitution range
- glyphs_input:
Array of input glyphs that would be substituted by the lookup
- glyphs_after:
Array of glyphs following the substitution range
- glyphs_output:
Array of glyphs that would be the substituted output of the lookup
- Return type:
(glyphs_before:
HarfBuzz.set_t
, glyphs_input:HarfBuzz.set_t
, glyphs_after:HarfBuzz.set_t
, glyphs_output:HarfBuzz.set_t
)
Fetches a list of all glyphs affected by the specified lookup in the specified face’s GSUB table or GPOS table.
New in version 0.9.7.
- HarfBuzz.ot_layout_lookup_get_glyph_alternates(face, lookup_index, glyph, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) – a face.lookup_index (
int
) – index of the feature lookup to query.glyph (
int
) – a glyph id.start_offset (
int
) – starting offset.
- Returns:
Total number of alternates found in the specific lookup index for the given glyph id.
- alternate_glyphs:
A glyphs buffer. Alternate glyphs associated with the glyph id.
- Return type:
Fetches alternates of a glyph from a given GSUB lookup index.
New in version 2.6.8.
- HarfBuzz.ot_layout_lookup_get_optical_bound(font, lookup_index, direction, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) – a font.lookup_index (
int
) – index of the feature lookup to query.direction (
HarfBuzz.direction_t
) – edge of the glyph to query.glyph (
int
) – a glyph id.
- Returns:
Adjustment value. Negative values mean the glyph will stick out of the margin.
- Return type:
Fetches the optical bound of a glyph positioned at the margin of text. The direction identifies which edge of the glyph to query.
New in version 5.3.0.
- HarfBuzz.ot_layout_lookup_substitute_closure(face, lookup_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponlookup_index (
int
) – index of the feature lookup to query
- Returns:
Array of glyphs comprising the transitive closure of the lookup
- Return type:
glyphs:
HarfBuzz.set_t
Compute the transitive closure of glyphs needed for a specified lookup.
New in version 0.9.7.
- HarfBuzz.ot_layout_lookup_would_substitute(face, lookup_index, glyphs, glyphs_length, zero_context)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponlookup_index (
int
) – The index of the lookup to queryglyphs (
int
) – The sequence of glyphs to query for substitutionglyphs_length (
int
) – The length of the glyph sequencezero_context (
int
) – #hb_bool_t indicating whether pre-/post-context are disallowed in substitutions
- Returns:
true
if a substitution would be triggered,false
otherwise- Return type:
Tests whether a specified lookup in the specified face would trigger a substitution on the given glyph sequence.
New in version 0.9.7.
- HarfBuzz.ot_layout_lookups_substitute_closure(face, lookups)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponlookups (
HarfBuzz.set_t
) – The set of lookups to query
- Returns:
Array of glyphs comprising the transitive closure of the lookups
- Return type:
glyphs:
HarfBuzz.set_t
Compute the transitive closure of glyphs needed for all of the provided lookups.
New in version 1.8.1.
- HarfBuzz.ot_layout_script_find_language(face, table_tag, script_index, language_tag, language_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_tag (
int
) – The #hb_tag_t of the requested languagelanguage_index (
int
) – The index of the requested language
- Returns:
true
if the language tag is found,false
otherwise- Return type:
Fetches the index of a given language tag in the specified face’s GSUB table or GPOS table, underneath the specified script tag.
New in version 0.6.0.
Deprecated since version 2.0.0.
- HarfBuzz.ot_layout_script_get_language_tags(face, table_tag, script_index, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script tagstart_offset (
int
) – offset of the first language tag to retrieve
- Returns:
Total number of language tags.
- language_tags:
Array of language tags found in the table
- Return type:
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.
New in version 0.6.0.
- HarfBuzz.ot_layout_script_select_language(face, table_tag, script_index, language_count, language_tags)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_count (
int
) – The number of languages in the specified scriptlanguage_tags (
int
) – The array of language tags
- Returns:
true
if one of the given language tags is found,false
otherwise- language_index:
The index of the requested language
- Return type:
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.New in version 2.0.0.
- HarfBuzz.ot_layout_script_select_language2(face, table_tag, script_index, language_count, language_tags)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_index (
int
) – The index of the requested script taglanguage_count (
int
) – The number of languages in the specified scriptlanguage_tags (
int
) – The array of language tags
- Returns:
true
if one of the given language tags is found,false
otherwise- language_index:
The index of the chosen language
- chosen_language:
#hb_tag_t of the chosen language
- Return type:
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 toHarfBuzz.OT_LAYOUT_DEFAULT_LANGUAGE_INDEX
and chosen_language is set to #HB_TAG_NONE.New in version 7.0.0.
- HarfBuzz.ot_layout_table_choose_script(face, table_tag, script_tags)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_tags (
int
) – Array of #hb_tag_t script tags
- Returns:
- script_index:
The index of the chosen script
- chosen_script:
#hb_tag_t of the chosen script
- Return type:
Deprecated since 2.0.0
- HarfBuzz.ot_layout_table_find_feature_variations(face, table_tag, coords, num_coords)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOScoords (
int
) – The variation coordinates to querynum_coords (
int
) – The number of variation coordinates
- Returns:
true
if feature variations were found,false
otherwise.- variations_index:
The array of feature variations found for the query
- Return type:
Fetches a list of feature variations in the specified face’s GSUB table or GPOS table, at the specified variation coordinates.
New in version 1.4.0.
- HarfBuzz.ot_layout_table_find_script(face, table_tag, script_tag)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_tag (
int
) – #hb_tag_t of the script tag requested
- Returns:
true
if the script is found,false
otherwise- script_index:
The index of the requested script tag
- Return type:
Fetches the index if a given script tag in the specified face’s GSUB table or GPOS table.
- HarfBuzz.ot_layout_table_get_feature_tags(face, table_tag, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSstart_offset (
int
) – offset of the first feature tag to retrieve
- Returns:
Total number of feature tags.
- feature_tags:
Array of feature tags found in the table
- Return type:
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.
New in version 0.6.0.
- HarfBuzz.ot_layout_table_get_lookup_count(face, table_tag)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOS
- Returns:
Total number of lookups.
- Return type:
Fetches the total number of lookups enumerated in the specified face’s GSUB table or GPOS table.
New in version 0.9.22.
- HarfBuzz.ot_layout_table_get_script_tags(face, table_tag, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSstart_offset (
int
) – offset of the first script tag to retrieve
- Returns:
Total number of script tags.
- script_tags:
The array of #hb_tag_t script tags found for the query
- Return type:
Fetches a list of all scripts enumerated in the specified face’s GSUB table or GPOS table. The list returned will begin at the offset provided.
- HarfBuzz.ot_layout_table_select_script(face, table_tag, script_count, script_tags)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work upontable_tag (
int
) – #HB_OT_TAG_GSUB or #HB_OT_TAG_GPOSscript_count (
int
) – Number of script tags in the arrayscript_tags (
int
) – Array of #hb_tag_t script tags
- Returns:
true
if one of the requested scripts is selected,false
if a fallback script is selected or if no scripts are selected.- script_index:
The index of the requested script
- chosen_script:
#hb_tag_t of the requested script
- Return type:
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
, andlatn
tags are tried in that order. If the table still does not have any of these scripts, script_index is set toHarfBuzz.OT_LAYOUT_NO_SCRIPT_INDEX
and chosen_script is set to #HB_TAG_NONE.New in version 2.0.0.
- HarfBuzz.ot_math_get_constant(font, constant)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponconstant (
HarfBuzz.ot_math_constant_t
) –HarfBuzz.ot_math_constant_t
the constant to retrieve
- Returns:
the requested constant or zero
- Return type:
Fetches the specified math constant. For most constants, the value returned is an #hb_position_t.
However, if the requested constant is
HarfBuzz.ot_math_constant_t.SCRIPT_PERCENT_SCALE_DOWN
,HarfBuzz.ot_math_constant_t.SCRIPT_SCRIPT_PERCENT_SCALE_DOWN
orHarfBuzz.ot_math_constant_t.RADICAL_DEGREE_BOTTOM_RAISE_PERCENT
, then the return value is an integer between 0 and 100 representing that percentage.New in version 1.3.3.
- HarfBuzz.ot_math_get_glyph_assembly(font, glyph, direction, start_offset)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The index of the glyph to stretchdirection (
HarfBuzz.direction_t
) – direction of the stretching (horizontal or vertical)start_offset (
int
) – offset of the first glyph part to retrieve
- Returns:
the total number of parts in the glyph assembly
- parts:
the glyph parts returned
- italics_correction:
italics correction of the glyph assembly
- Return type:
(
int
, parts: [HarfBuzz.ot_math_glyph_part_t
], italics_correction:int
)
Fetches the GlyphAssembly for the specified font, glyph index, and direction. Returned are a list of
HarfBuzz.ot_math_glyph_part_t
glyph parts that can be used to draw the glyph and an italics-correction value (if one is defined in the font).The direction parameter is only used to select between horizontal or vertical directions for the construction. Even though all
HarfBuzz.direction_t
values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is considered.New in version 1.3.3.
- HarfBuzz.ot_math_get_glyph_italics_correction(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph index from which to retrieve the value
- Returns:
the italics correction of the glyph or zero
- Return type:
Fetches an italics-correction value (if one exists) for the specified glyph index.
New in version 1.3.3.
- HarfBuzz.ot_math_get_glyph_kerning(font, glyph, kern, correction_height)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph index from which to retrieve the valuekern (
HarfBuzz.ot_math_kern_t
) – TheHarfBuzz.ot_math_kern_t
from which to retrieve the valuecorrection_height (
int
) – the correction height to use to determine the kerning.
- Returns:
requested kerning value or zero
- Return type:
Fetches the math kerning (cut-ins) value for the specified font, glyph index, and kern.
If the MathKern table is found, the function examines it to find a height value that is greater or equal to correction_height. If such a height value is found, corresponding kerning value from the table is returned. If no such height value is found, the last kerning value is returned.
New in version 1.3.3.
- HarfBuzz.ot_math_get_glyph_kernings(font, glyph, kern, start_offset)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph index from which to retrieve the kerningskern (
HarfBuzz.ot_math_kern_t
) – TheHarfBuzz.ot_math_kern_t
from which to retrieve the kerningsstart_offset (
int
) – offset of the first kern entry to retrieve
- Returns:
the total number of kern values available or zero
- kern_entries:
array of kern entries returned
- Return type:
(
int
, kern_entries: [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
HarfBuzz.ot_math_kern_entry_t
structs.See also
HarfBuzz.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 HarfBuzz.ot_math_kern_entry_t.kern_value of the uppermost
HarfBuzz.ot_math_kern_entry_t
actually comes from the font; its corresponding HarfBuzz.ot_math_kern_entry_t.max_correction_height is always set to INT32_MAX.New in version 3.4.0.
- HarfBuzz.ot_math_get_glyph_top_accent_attachment(font, glyph)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The glyph index from which to retrieve the value
- Returns:
the top accent attachment of the glyph or 0.5 * the advance width of glyph
- Return type:
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 noMathTopAccentAttachment
table or noMATH
table, any glyph) - the function synthesizes a value, returning the position at one-half the glyph’s advance width.New in version 1.3.3.
- HarfBuzz.ot_math_get_glyph_variants(font, glyph, direction, start_offset)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponglyph (
int
) – The index of the glyph to stretchdirection (
HarfBuzz.direction_t
) – The direction of the stretching (horizontal or vertical)start_offset (
int
) – offset of the first variant to retrieve
- Returns:
the total number of size variants available or zero
- variants:
array of variants returned
- Return type:
(
int
, variants: [HarfBuzz.ot_math_glyph_variant_t
])
Fetches the MathGlyphConstruction for the specified font, glyph index, and direction. The corresponding list of size variants is returned as a list of
HarfBuzz.ot_math_glyph_variant_t
structs.The direction parameter is only used to select between horizontal or vertical directions for the construction. Even though all
HarfBuzz.direction_t
values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is considered.New in version 1.3.3.
- HarfBuzz.ot_math_get_min_connector_overlap(font, direction)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work upondirection (
HarfBuzz.direction_t
) – direction of the stretching (horizontal or vertical)
- Returns:
requested minimum connector overlap or zero
- Return type:
Fetches the MathVariants table for the specified font and returns the minimum overlap of connecting glyphs that are required to draw a glyph assembly in the specified direction.
The direction parameter is only used to select between horizontal or vertical directions for the construction. Even though all
HarfBuzz.direction_t
values are accepted, only the result of #HB_DIRECTION_IS_HORIZONTAL is considered.New in version 1.3.3.
- HarfBuzz.ot_math_has_data(face)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to test- Returns:
true
if the table is found,false
otherwise- Return type:
Tests whether a face has a
MATH
table.New in version 1.3.3.
- HarfBuzz.ot_math_is_glyph_extended_shape(face, glyph)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponglyph (
int
) – The glyph index to test
- Returns:
true
if the glyph is an extended shape,false
otherwise- Return type:
Tests whether the given glyph index is an extended shape in the face.
New in version 1.3.3.
- HarfBuzz.ot_meta_get_entry_tags(face, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) – a face objectstart_offset (
int
) – iteration’s start offset
- Returns:
Number of all available feature types.
- entries:
entries tags buffer
- Return type:
(
int
, entries: [HarfBuzz.ot_meta_tag_t
])
Fetches all available feature types.
New in version 2.6.0.
- HarfBuzz.ot_meta_reference_entry(face, meta_tag)¶
- Parameters:
face (
HarfBuzz.face_t
) – aHarfBuzz.face_t
object.meta_tag (
HarfBuzz.ot_meta_tag_t
) – tag of metadata you like to have.
- Returns:
A blob containing the blob.
- Return type:
It fetches metadata entry of a given tag from a font.
New in version 2.6.0.
- HarfBuzz.ot_metrics_get_position(font, metrics_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – anHarfBuzz.font_t
object.metrics_tag (
HarfBuzz.ot_metrics_tag_t
) – tag of metrics value you like to fetch.
- Returns:
Whether found the requested metrics in the font.
- position:
result of metrics value from the font.
- Return type:
Fetches metrics value corresponding to metrics_tag from font.
New in version 2.6.0.
- HarfBuzz.ot_metrics_get_position_with_fallback(font, metrics_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – anHarfBuzz.font_t
object.metrics_tag (
HarfBuzz.ot_metrics_tag_t
) – tag of metrics value you like to fetch.
- Returns:
result of metrics value from the font.
- Return type:
position:
int
Fetches metrics value corresponding to metrics_tag from font, and synthesizes a value if it the value is missing in the font.
New in version 4.0.0.
- HarfBuzz.ot_metrics_get_variation(font, metrics_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – anHarfBuzz.font_t
object.metrics_tag (
HarfBuzz.ot_metrics_tag_t
) – tag of metrics value you like to fetch.
- Returns:
The requested metric value.
- Return type:
Fetches metrics value corresponding to metrics_tag from font with the current font variation settings applied.
New in version 2.6.0.
- HarfBuzz.ot_metrics_get_x_variation(font, metrics_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – anHarfBuzz.font_t
object.metrics_tag (
HarfBuzz.ot_metrics_tag_t
) – tag of metrics value you like to fetch.
- Returns:
The requested metric value.
- Return type:
Fetches horizontal metrics value corresponding to metrics_tag from font with the current font variation settings applied.
New in version 2.6.0.
- HarfBuzz.ot_metrics_get_y_variation(font, metrics_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – anHarfBuzz.font_t
object.metrics_tag (
HarfBuzz.ot_metrics_tag_t
) – tag of metrics value you like to fetch.
- Returns:
The requested metric value.
- Return type:
Fetches vertical metrics value corresponding to metrics_tag from font with the current font variation settings applied.
New in version 2.6.0.
- HarfBuzz.ot_name_get_utf16(face, name_id, language)¶
- Parameters:
face (
HarfBuzz.face_t
) – font face.name_id (
int
) – OpenType name identifier to fetch.language (
HarfBuzz.language_t
) – language to fetch the name for.
- Returns:
full length of the requested string, or 0 if not found.
- text:
buffer to write fetched name into.
- Return type:
Fetches a font name from the OpenType ‘name’ table. If language is
HarfBuzz.LANGUAGE_INVALID
, English (“en”) is assumed. Returns string in UTF-16 encoding. A NUL terminator is always written for convenience, and isn’t included in the output text_size.New in version 2.1.0.
- HarfBuzz.ot_name_get_utf32(face, name_id, language)¶
- Parameters:
face (
HarfBuzz.face_t
) – font face.name_id (
int
) – OpenType name identifier to fetch.language (
HarfBuzz.language_t
) – language to fetch the name for.
- Returns:
full length of the requested string, or 0 if not found.
- text:
buffer to write fetched name into.
- Return type:
Fetches a font name from the OpenType ‘name’ table. If language is
HarfBuzz.LANGUAGE_INVALID
, English (“en”) is assumed. Returns string in UTF-32 encoding. A NUL terminator is always written for convenience, and isn’t included in the output text_size.New in version 2.1.0.
- HarfBuzz.ot_name_get_utf8(face, name_id, language)¶
- Parameters:
face (
HarfBuzz.face_t
) – font face.name_id (
int
) – OpenType name identifier to fetch.language (
HarfBuzz.language_t
) – language to fetch the name for.
- Returns:
full length of the requested string, or 0 if not found.
- text:
buffer to write fetched name into.
- Return type:
Fetches a font name from the OpenType ‘name’ table. If language is
HarfBuzz.LANGUAGE_INVALID
, English (“en”) is assumed. Returns string in UTF-8 encoding. A NUL terminator is always written for convenience, and isn’t included in the output text_size.New in version 2.1.0.
- HarfBuzz.ot_name_list_names(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – font face.- Returns:
Array of available name entries.
- Return type:
Enumerates all available name IDs and language combinations. Returned array is owned by the face and should not be modified. It can be used as long as face is alive.
New in version 2.1.0.
- HarfBuzz.ot_shape_glyphs_closure(font, buffer, features)¶
- Parameters:
font (
HarfBuzz.font_t
) –HarfBuzz.font_t
to work uponbuffer (
HarfBuzz.buffer_t
) – The input buffer to compute fromfeatures ([
HarfBuzz.feature_t
]) – The features enabled on the buffer
- Returns:
The
HarfBuzz.set_t
set of glyphs comprising the transitive closure of the query- Return type:
glyphs:
HarfBuzz.set_t
Computes the transitive closure of glyphs needed for a specified input buffer under the given font and feature list. The closure is computed as a set, not as a list.
New in version 0.9.2.
- HarfBuzz.ot_shape_plan_collect_lookups(shape_plan, table_tag)¶
- Parameters:
shape_plan (
HarfBuzz.shape_plan_t
) –HarfBuzz.shape_plan_t
to querytable_tag (
int
) – GSUB or GPOS
- Returns:
The
HarfBuzz.set_t
set of lookups returned- Return type:
lookup_indexes:
HarfBuzz.set_t
Computes the complete set of GSUB or GPOS lookups that are applicable under a given shape_plan.
New in version 0.9.7.
- HarfBuzz.ot_tag_from_language(language)¶
- Parameters:
language (
HarfBuzz.language_t
) – anHarfBuzz.language_t
to convert.- Return type:
Converts an
HarfBuzz.language_t
to an #hb_tag_t.New in version 0.6.0.
Deprecated since version 2.0.0: use
HarfBuzz.ot_tags_from_script_and_language
() instead
- HarfBuzz.ot_tag_to_language(tag)¶
- Parameters:
tag (
int
) – an language tag- Returns:
The
HarfBuzz.language_t
corresponding to tag.- Return type:
Converts a language tag to an
HarfBuzz.language_t
.New in version 0.9.2.
- HarfBuzz.ot_tag_to_script(tag)¶
- Parameters:
tag (
int
) – a script tag- Returns:
The
HarfBuzz.script_t
corresponding to tag.- Return type:
Converts a script tag to an
HarfBuzz.script_t
.
- HarfBuzz.ot_tags_from_script(script)¶
- Parameters:
script (
HarfBuzz.script_t
) – anHarfBuzz.script_t
to convert.- Returns:
- script_tag_1:
output #hb_tag_t.
- script_tag_2:
output #hb_tag_t.
- Return type:
Converts an
HarfBuzz.script_t
to script tags.New in version 0.6.0.
Deprecated since version 2.0.0: use
HarfBuzz.ot_tags_from_script_and_language
() instead
- HarfBuzz.ot_tags_from_script_and_language(script, language, script_count, language_count)¶
- Parameters:
script (
HarfBuzz.script_t
) – anHarfBuzz.script_t
to convert.language (
HarfBuzz.language_t
orNone
) – anHarfBuzz.language_t
to convert.script_count (
int
) – maximum number of script tags to retrieve (IN) and actual number of script tags retrieved (OUT)language_count (
int
) – maximum number of language tags to retrieve (IN) and actual number of language tags retrieved (OUT)
- Returns:
- script_count:
maximum number of script tags to retrieve (IN) and actual number of script tags retrieved (OUT)
- script_tags:
array of size at least script_count to store the script tag results
- language_count:
maximum number of language tags to retrieve (IN) and actual number of language tags retrieved (OUT)
- language_tags:
array of size at least language_count to store the language tag results
- Return type:
(script_count:
int
, script_tags:int
, language_count:int
, language_tags:int
)
Converts an
HarfBuzz.script_t
and anHarfBuzz.language_t
to script and language tags.New in version 2.0.0.
- HarfBuzz.ot_tags_to_script_and_language(script_tag, language_tag)¶
- Parameters:
- Returns:
- script:
the
HarfBuzz.script_t
corresponding to script_tag.- language:
the
HarfBuzz.language_t
corresponding to script_tag and language_tag.
- Return type:
(script:
HarfBuzz.script_t
, language:HarfBuzz.language_t
)
Converts a script tag and a language tag to an
HarfBuzz.script_t
and anHarfBuzz.language_t
.New in version 2.0.0.
- HarfBuzz.ot_var_find_axis(face, axis_tag, axis_index)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponaxis_tag (
int
) – The #hb_tag_t of the variation axis to queryaxis_index (
int
) – The index of the variation axis
- Returns:
- axis_info:
The
HarfBuzz.ot_var_axis_info_t
of the axis tag queried
- Return type:
(
int
, axis_info:HarfBuzz.ot_var_axis_t
)
Fetches the variation-axis information corresponding to the specified axis tag in the specified face.
New in version 1.4.2.
Deprecated since version 2.2.0: * use
HarfBuzz.ot_var_find_axis_info
() instead
- HarfBuzz.ot_var_find_axis_info(face, axis_tag)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponaxis_tag (
int
) – The #hb_tag_t of the variation axis to query
- Returns:
true
if data found,false
otherwise- axis_info:
The
HarfBuzz.ot_var_axis_info_t
of the axis tag queried
- Return type:
(
int
, axis_info:HarfBuzz.ot_var_axis_info_t
)
Fetches the variation-axis information corresponding to the specified axis tag in the specified face.
New in version 2.2.0.
- HarfBuzz.ot_var_get_axes(face, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponstart_offset (
int
) – offset of the first lookup to retrieve
- Returns:
- axes_array:
The array of variation axes found
- Return type:
(
int
, axes_array: [HarfBuzz.ot_var_axis_t
])
Fetches a list of all variation axes in the specified face. The list returned will begin at the offset provided.
New in version 1.4.2.
Deprecated since version 2.2.0: use
HarfBuzz.ot_var_get_axis_infos
() instead
- HarfBuzz.ot_var_get_axis_count(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work on- Returns:
the number of variation axes defined
- Return type:
Fetches the number of OpenType variation axes included in the face.
New in version 1.4.2.
- HarfBuzz.ot_var_get_axis_infos(face, start_offset)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to work uponstart_offset (
int
) – offset of the first lookup to retrieve
- Returns:
the number of variation axes in the face
- axes_array:
The array of variation axes found
- Return type:
(
int
, axes_array: [HarfBuzz.ot_var_axis_info_t
])
Fetches a list of all variation axes in the specified face. The list returned will begin at the offset provided.
New in version 2.2.0.
- HarfBuzz.ot_var_get_named_instance_count(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work on- Returns:
the number of named instances defined
- Return type:
Fetches the number of named instances included in the face.
New in version 2.2.0.
- HarfBuzz.ot_var_has_data(face)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work on- Returns:
true
if data found,false
otherwise- Return type:
Tests whether a face includes any OpenType variation data in the
fvar
table.New in version 1.4.2.
- HarfBuzz.ot_var_named_instance_get_design_coords(face, instance_index)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work oninstance_index (
int
) – The index of the named instance to query
- Returns:
the number of variation axes in the face
- coords:
The array of coordinates found for the query
- Return type:
Fetches the design-space coordinates corresponding to the given named instance in the face.
New in version 2.2.0.
- HarfBuzz.ot_var_named_instance_get_postscript_name_id(face, instance_index)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work oninstance_index (
int
) – The index of the named instance to query
- Returns:
the Name ID found for the PostScript name
- Return type:
Fetches the
name
table Name ID that provides display names for the “PostScript name” defined for the given named instance in the face.New in version 2.2.0.
- HarfBuzz.ot_var_named_instance_get_subfamily_name_id(face, instance_index)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work oninstance_index (
int
) – The index of the named instance to query
- Returns:
the Name ID found for the Subfamily name
- Return type:
Fetches the
name
table Name ID that provides display names for the “Subfamily name” defined for the given named instance in the face.New in version 2.2.0.
- HarfBuzz.ot_var_normalize_coords(face, coords_length, design_coords)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work oncoords_length (
int
) – The length of the coordinate arraydesign_coords (
float
) – The design-space coordinates to normalize
- Returns:
The normalized coordinates
- Return type:
normalized_coords:
int
Normalizes the given design-space coordinates. The minimum and maximum values for the axis are mapped to the interval [-1,1], with the default axis value mapped to 0.
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/avarNew in version 1.4.2.
- HarfBuzz.ot_var_normalize_variations(face, variations, variations_length)¶
- Parameters:
face (
HarfBuzz.face_t
) – TheHarfBuzz.face_t
to work onvariations (
HarfBuzz.variation_t
) – The array of variations to normalizevariations_length (
int
) – The number of variations to normalize
- Returns:
The array of normalized coordinates
- Return type:
coords: [
int
]
Normalizes all of the coordinates in the given list of variation axes.
New in version 1.4.2.
- HarfBuzz.paint_color(funcs, paint_data, is_foreground, color)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the calleris_foreground (
int
) – whether the color is the foregroundcolor (
int
) – The color to use
Perform a “color” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_color_glyph(funcs, paint_data, glyph, font)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callerglyph (
int
) – the glyph IDfont (
HarfBuzz.font_t
) – the font
- Return type:
Perform a “color-glyph” paint operation.
New in version 8.2.0.
- HarfBuzz.paint_custom_palette_color(funcs, paint_data, color_index)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callercolor_index (
int
) – color index
- Returns:
true
if found,false
otherwise- color:
fetched color
- Return type:
Gets the custom palette color for color_index.
New in version 7.0.0.
- HarfBuzz.paint_funcs_create()¶
- Returns:
the paint-functions structure
- Return type:
Creates a new
HarfBuzz.paint_funcs_t
structure of paint functions.The initial reference count of 1 should be released with hb_paint_funcs_destroy() when you are done using the
HarfBuzz.paint_funcs_t
. This function never returnsNULL
. If memory cannot be allocated, a special singletonHarfBuzz.paint_funcs_t
object will be returned.New in version 7.0.0.
- HarfBuzz.paint_funcs_get_empty()¶
- Returns:
The empty paint-functions structure
- Return type:
Fetches the singleton empty paint-functions structure.
New in version 7.0.0.
- HarfBuzz.paint_funcs_is_immutable(funcs)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – The paint-functions structure- Returns:
true
if funcs is immutable,false
otherwise- Return type:
Tests whether a paint-functions structure is immutable.
New in version 7.0.0.
- HarfBuzz.paint_funcs_make_immutable(funcs)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – The paint-functions structure
Makes a paint-functions structure immutable.
After this call, all attempts to set one of the callbacks on funcs will fail.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_color_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_color_func_t
) – The paint-color callback
Sets the paint-color callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_color_glyph_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_color_glyph_func_t
) – The color-glyph callback
Sets the color-glyph callback on the paint functions struct.
New in version 8.2.0.
- HarfBuzz.paint_funcs_set_custom_palette_color_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_custom_palette_color_func_t
) – The custom-palette-color callback
Sets the custom-palette-color callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_image_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_image_func_t
) – The paint-image callback
Sets the paint-image callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_linear_gradient_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_linear_gradient_func_t
) – The linear-gradient callback
Sets the linear-gradient callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_pop_clip_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_pop_clip_func_t
) – The pop-clip callback
Sets the pop-clip callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_pop_group_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_pop_group_func_t
) – The pop-group callback
Sets the pop-group callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_pop_transform_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_pop_transform_func_t
) – The pop-transform callback
Sets the pop-transform callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_push_clip_glyph_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_push_clip_glyph_func_t
) – The push-clip-glyph callback
Sets the push-clip-glyph callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_push_clip_rectangle_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_push_clip_rectangle_func_t
) – The push-clip-rectangle callback
Sets the push-clip-rect callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_push_group_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_push_group_func_t
) – The push-group callback
Sets the push-group callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_push_transform_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_push_transform_func_t
) – The push-transform callback
Sets the push-transform callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_radial_gradient_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_radial_gradient_func_t
) – The radial-gradient callback
Sets the radial-gradient callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_funcs_set_sweep_gradient_func(funcs, func, *user_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – A paint functions structfunc (
HarfBuzz.paint_sweep_gradient_func_t
) – The sweep-gradient callback
Sets the sweep-gradient callback on the paint functions struct.
New in version 7.0.0.
- HarfBuzz.paint_image(funcs, paint_data, image, width, height, format, slant, extents)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callerimage (
HarfBuzz.blob_t
) – image datawidth (
int
) – width of the raster image in pixels, or 0height (
int
) – height of the raster image in pixels, or 0format (
int
) – the image format as a tagslant (
float
) – the synthetic slant ratio to be applied to the image during renderingextents (
HarfBuzz.glyph_extents_t
orNone
) – the extents of the glyph
Perform a “image” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_linear_gradient(funcs, paint_data, color_line, x0, y0, x1, y1, x2, y2)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callercolor_line (
HarfBuzz.color_line_t
) – Color information for the gradientx0 (
float
) – X coordinate of the first pointy0 (
float
) – Y coordinate of the first pointx1 (
float
) – X coordinate of the second pointy1 (
float
) – Y coordinate of the second pointx2 (
float
) – X coordinate of the third pointy2 (
float
) – Y coordinate of the third point
Perform a “linear-gradient” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_pop_clip(funcs, paint_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the caller
Perform a “pop-clip” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_pop_group(funcs, paint_data, mode)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callermode (
HarfBuzz.paint_composite_mode_t
) – the compositing mode to use
Perform a “pop-group” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_pop_transform(funcs, paint_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the caller
Perform a “pop-transform” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_push_clip_glyph(funcs, paint_data, glyph, font)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callerglyph (
int
) – the glyph IDfont (
HarfBuzz.font_t
) – the font
Perform a “push-clip-glyph” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_push_clip_rectangle(funcs, paint_data, xmin, ymin, xmax, ymax)¶
- Parameters:
Perform a “push-clip-rect” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_push_group(funcs, paint_data)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the caller
Perform a “push-group” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_push_transform(funcs, paint_data, xx, yx, xy, yy, dx, dy)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callerxx (
float
) – xx component of the transform matrixyx (
float
) – yx component of the transform matrixxy (
float
) – xy component of the transform matrixyy (
float
) – yy component of the transform matrixdx (
float
) – dx component of the transform matrixdy (
float
) – dy component of the transform matrix
Perform a “push-transform” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_radial_gradient(funcs, paint_data, color_line, x0, y0, r0, x1, y1, r1)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callercolor_line (
HarfBuzz.color_line_t
) – Color information for the gradientx0 (
float
) – X coordinate of the first circle’s centery0 (
float
) – Y coordinate of the first circle’s centerr0 (
float
) – radius of the first circlex1 (
float
) – X coordinate of the second circle’s centery1 (
float
) – Y coordinate of the second circle’s centerr1 (
float
) – radius of the second circle
Perform a “radial-gradient” paint operation.
New in version 7.0.0.
- HarfBuzz.paint_sweep_gradient(funcs, paint_data, color_line, x0, y0, start_angle, end_angle)¶
- Parameters:
funcs (
HarfBuzz.paint_funcs_t
) – paint functionspaint_data (
object
orNone
) – associated data passed by the callercolor_line (
HarfBuzz.color_line_t
) – Color information for the gradientx0 (
float
) – X coordinate of the circle’s centery0 (
float
) – Y coordinate of the circle’s centerstart_angle (
float
) – the start angleend_angle (
float
) – the end angle
Perform a “sweep-gradient” paint operation.
New in version 7.0.0.
- HarfBuzz.script_from_iso15924_tag(tag)¶
- Parameters:
tag (
int
) – an #hb_tag_t representing an ISO 15924 tag.- Returns:
An
HarfBuzz.script_t
corresponding to the ISO 15924 tag.- Return type:
Converts an ISO 15924 script tag to a corresponding
HarfBuzz.script_t
.New in version 0.9.2.
- HarfBuzz.script_from_string(str)¶
- Parameters:
str (
bytes
) – a string representing an ISO 15924 tag.- Returns:
An
HarfBuzz.script_t
corresponding to the ISO 15924 tag.- Return type:
Converts a string str representing an ISO 15924 script tag to a corresponding
HarfBuzz.script_t
. Shorthand forHarfBuzz.tag_from_string
() thenHarfBuzz.script_from_iso15924_tag
().New in version 0.9.2.
- HarfBuzz.script_get_horizontal_direction(script)¶
- Parameters:
script (
HarfBuzz.script_t
) – TheHarfBuzz.script_t
to query- Returns:
The horizontal
HarfBuzz.direction_t
of script- Return type:
Fetches the
HarfBuzz.direction_t
of a script when it is set horizontally. All right-to-left scripts will returnHarfBuzz.direction_t.RTL
. All left-to-right scripts will returnHarfBuzz.direction_t.LTR
. Scripts that can be written either horizontally or vertically will returnHarfBuzz.direction_t.INVALID
. Unknown scripts will returnHarfBuzz.direction_t.LTR
.New in version 0.9.2.
- HarfBuzz.script_to_iso15924_tag(script)¶
- Parameters:
script (
HarfBuzz.script_t
) – anHarfBuzz.script_t
to convert.- Returns:
An #hb_tag_t representing an ISO 15924 script tag.
- Return type:
Converts an
HarfBuzz.script_t
to a corresponding ISO 15924 script tag.New in version 0.9.2.
- HarfBuzz.segment_properties_equal(a, b)¶
- Parameters:
a (
HarfBuzz.segment_properties_t
) – firstHarfBuzz.segment_properties_t
to compare.b (
HarfBuzz.segment_properties_t
) – secondHarfBuzz.segment_properties_t
to compare.
- Returns:
true
if all properties of a equal those of b,false
otherwise.- Return type:
Checks the equality of two
HarfBuzz.segment_properties_t
's.New in version 0.9.7.
- HarfBuzz.segment_properties_hash(p)¶
- Parameters:
p (
HarfBuzz.segment_properties_t
) –HarfBuzz.segment_properties_t
to hash.- Returns:
A hash of p.
- Return type:
Creates a hash representing p.
New in version 0.9.7.
- HarfBuzz.segment_properties_overlay(p, src)¶
- Parameters:
p (
HarfBuzz.segment_properties_t
) –HarfBuzz.segment_properties_t
to fill in.src (
HarfBuzz.segment_properties_t
) –HarfBuzz.segment_properties_t
to fill in from.
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.
New in version 3.3.0.
- HarfBuzz.set_add(set, codepoint)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setcodepoint (
int
) – The element to add to set
Adds codepoint to set.
New in version 0.9.2.
- HarfBuzz.set_add_range(set, first, last)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setfirst (
int
) – The first element to add to setlast (
int
) – The final element to add to set
Adds all of the elements from first to last (inclusive) to set.
New in version 0.9.7.
- HarfBuzz.set_add_sorted_array(set, sorted_codepoints)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setsorted_codepoints ([
int
]) – Array of codepoints to add
Adds num_codepoints codepoints to a set at once. The codepoints array must be in increasing order, with size at least num_codepoints.
New in version 4.1.0.
- HarfBuzz.set_allocation_successful(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set- Returns:
true
if allocation succeeded,false
otherwise- Return type:
Tests whether memory allocation for a set was successful.
New in version 0.9.2.
- HarfBuzz.set_clear(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set
Clears out the contents of a set.
New in version 0.9.2.
- HarfBuzz.set_copy(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set- Returns:
Newly-allocated set.
- Return type:
Allocate a copy of set.
New in version 2.8.2.
- HarfBuzz.set_create()¶
- Returns:
The new
HarfBuzz.set_t
- Return type:
Creates a new, initially empty set.
New in version 0.9.2.
- HarfBuzz.set_del(set, codepoint)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setcodepoint (
int
) – Removes codepoint from set
Removes codepoint from set.
New in version 0.9.2.
- HarfBuzz.set_del_range(set, first, last)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setfirst (
int
) – The first element to remove from setlast (
int
) – The final element to remove from set
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.
New in version 0.9.7.
- HarfBuzz.set_get_empty()¶
- Returns:
The empty
HarfBuzz.set_t
- Return type:
Fetches the singleton empty
HarfBuzz.set_t
.New in version 0.9.2.
- HarfBuzz.set_get_max(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set- Returns:
maximum of set, or #HB_SET_VALUE_INVALID if set is empty.
- Return type:
Finds the largest element in the set.
New in version 0.9.7.
- HarfBuzz.set_get_min(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set- Returns:
minimum of set, or #HB_SET_VALUE_INVALID if set is empty.
- Return type:
Finds the smallest element in the set.
New in version 0.9.7.
- HarfBuzz.set_get_population(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set- Returns:
The population of set
- Return type:
Returns the number of elements in the set.
New in version 0.9.7.
- HarfBuzz.set_has(set, codepoint)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setcodepoint (
int
) – The element to query
- Returns:
true
if codepoint is in set,false
otherwise- Return type:
Tests whether codepoint belongs to set.
New in version 0.9.2.
- HarfBuzz.set_hash(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set- Returns:
A hash of set.
- Return type:
Creates a hash representing set.
New in version 4.4.0.
- HarfBuzz.set_intersect(set, other)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setother (
HarfBuzz.set_t
) – Another set
Makes set the intersection of set and other.
New in version 0.9.2.
- HarfBuzz.set_invert(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set
Inverts the contents of set.
New in version 3.0.0.
- HarfBuzz.set_is_empty(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – a set.- Returns:
true
if set is empty- Return type:
Tests whether a set is empty (contains no elements).
New in version 0.9.7.
- HarfBuzz.set_is_equal(set, other)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setother (
HarfBuzz.set_t
) – Another set
- Returns:
true
if the two sets are equal,false
otherwise.- Return type:
Tests whether set and other are equal (contain the same elements).
New in version 0.9.7.
- HarfBuzz.set_is_inverted(set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A set- Returns:
true
if the set is inverted,false
otherwise- Return type:
Returns whether the set is inverted.
New in version 7.0.0.
- HarfBuzz.set_is_subset(set, larger_set)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setlarger_set (
HarfBuzz.set_t
) – Another set
- Returns:
true
if the set is a subset of (or equal to) larger_set,false
otherwise.- Return type:
Tests whether set is a subset of larger_set.
New in version 1.8.1.
- HarfBuzz.set_next(set, codepoint)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setcodepoint (
int
) – Input = Code point to query Output = Code point retrieved
- Returns:
true
if there was a next value,false
otherwise- codepoint:
Input = Code point to query Output = Code point retrieved
- Return type:
Fetches the next element in set that is greater than current value of codepoint.
Set codepoint to #HB_SET_VALUE_INVALID to get started.
New in version 0.9.2.
- HarfBuzz.set_next_many(set, codepoint, out)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setcodepoint (
int
) – Outputting codepoints starting after this one. Use #HB_SET_VALUE_INVALID to get started.out ([
int
]) – An array of codepoints to write to.
- Returns:
the number of values written.
- Return type:
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.
New in version 4.2.0.
- HarfBuzz.set_next_range(set, last)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setlast (
int
) – Input = The current last code point in the range Output = The last code point in the range
- Returns:
true
if there was a next range,false
otherwise- first:
The first code point in the range
- last:
Input = The current last code point in the range Output = The last code point in the range
- Return type:
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.
New in version 0.9.7.
- HarfBuzz.set_previous(set, codepoint)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setcodepoint (
int
) – Input = Code point to query Output = Code point retrieved
- Returns:
true
if there was a previous value,false
otherwise- codepoint:
Input = Code point to query Output = Code point retrieved
- Return type:
Fetches the previous element in set that is lower than current value of codepoint.
Set codepoint to #HB_SET_VALUE_INVALID to get started.
New in version 1.8.0.
- HarfBuzz.set_previous_range(set, first)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setfirst (
int
) – Input = The current first code point in the range Output = The first code point in the range
- Returns:
true
if there was a previous range,false
otherwise- first:
Input = The current first code point in the range Output = The first code point in the range
- last:
The last code point in the range
- Return type:
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.
New in version 1.8.0.
- HarfBuzz.set_set(set, other)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setother (
HarfBuzz.set_t
) – Another set
Makes the contents of set equal to the contents of other.
New in version 0.9.2.
- HarfBuzz.set_subtract(set, other)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setother (
HarfBuzz.set_t
) – Another set
Subtracts the contents of other from set.
New in version 0.9.2.
- HarfBuzz.set_symmetric_difference(set, other)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setother (
HarfBuzz.set_t
) – Another set
Makes set the symmetric difference of set and other.
New in version 0.9.2.
- HarfBuzz.set_union(set, other)¶
- Parameters:
set (
HarfBuzz.set_t
) – A setother (
HarfBuzz.set_t
) – Another set
Makes set the union of set and other.
New in version 0.9.2.
- HarfBuzz.shape(font, buffer, features)¶
- Parameters:
font (
HarfBuzz.font_t
) – anHarfBuzz.font_t
to use for shapingbuffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
to shapefeatures ([
HarfBuzz.feature_t
] orNone
) – an array of user specifiedHarfBuzz.feature_t
orNULL
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.New in version 0.9.2.
- HarfBuzz.shape_full(font, buffer, features, shaper_list)¶
- Parameters:
font (
HarfBuzz.font_t
) – anHarfBuzz.font_t
to use for shapingbuffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
to shapefeatures ([
HarfBuzz.feature_t
] orNone
) – an array of user specifiedHarfBuzz.feature_t
orNULL
shaper_list ([
str
] orNone
) – aNULL
-terminated array of shapers to use orNULL
- Returns:
false if all shapers failed, true otherwise
- Return type:
See
HarfBuzz.shape
() for details. If shaper_list is notNULL
, the specified shapers will be used in the given order, otherwise the default shapers list will be used.New in version 0.9.2.
- HarfBuzz.shape_justify(font, buffer, features, shaper_list, min_target_advance, max_target_advance, advance)¶
- Parameters:
font (
HarfBuzz.font_t
) – a mutableHarfBuzz.font_t
to use for shapingbuffer (
HarfBuzz.buffer_t
) – anHarfBuzz.buffer_t
to shapefeatures ([
HarfBuzz.feature_t
] orNone
) – an array of user specifiedHarfBuzz.feature_t
orNULL
shaper_list ([
str
] orNone
) – aNULL
-terminated array of shapers to use orNULL
min_target_advance (
float
) – Minimum advance width/height to aim for.max_target_advance (
float
) – Maximum advance width/height to aim for.advance (
float
) – Input/output advance width/height of the buffer.
- Returns:
false if all shapers failed, true otherwise
XSince: EXPERIMENTAL
- advance:
Input/output advance width/height of the buffer.
- var_tag:
Variation-axis tag used for justification.
- var_value:
Variation-axis value used to reach target justification.
- Return type:
See
HarfBuzz.shape_full
() for basic details. If shaper_list is notNULL
, 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
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.
- HarfBuzz.shape_list_shapers()¶
- Returns:
an array of constant strings
- Return type:
[
str
]
Retrieves the list of shapers supported by HarfBuzz.
New in version 0.9.2.
- HarfBuzz.shape_plan_create(face, props, user_features, shaper_list)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to useprops (
HarfBuzz.segment_properties_t
) – TheHarfBuzz.segment_properties_t
of the segmentuser_features ([
HarfBuzz.feature_t
]) – The list of user-selected featuresshaper_list ([
str
]) – List of shapers to try
- Returns:
The shaping plan
- Return type:
Constructs a shaping plan for a combination of face, user_features, props, and shaper_list.
New in version 0.9.7.
- HarfBuzz.shape_plan_create2(face, props, user_features, coords, shaper_list)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to useprops (
HarfBuzz.segment_properties_t
) – TheHarfBuzz.segment_properties_t
of the segmentuser_features ([
HarfBuzz.feature_t
]) – The list of user-selected featurescoords ([
int
]) – The list of variation-space coordinatesshaper_list ([
str
]) – List of shapers to try
- Returns:
The shaping plan
- Return type:
The variable-font version of
HarfBuzz.shape_plan_create
. Constructs a shaping plan for a combination of face, user_features, props, and shaper_list, plus the variation-space coordinates coords.New in version 1.4.0.
- HarfBuzz.shape_plan_create_cached(face, props, user_features, shaper_list)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to useprops (
HarfBuzz.segment_properties_t
) – TheHarfBuzz.segment_properties_t
of the segmentuser_features ([
HarfBuzz.feature_t
]) – The list of user-selected featuresshaper_list ([
str
]) – List of shapers to try
- Returns:
The shaping plan
- Return type:
Creates a cached shaping plan suitable for reuse, for a combination of face, user_features, props, and shaper_list.
New in version 0.9.7.
- HarfBuzz.shape_plan_create_cached2(face, props, user_features, coords, shaper_list)¶
- Parameters:
face (
HarfBuzz.face_t
) –HarfBuzz.face_t
to useprops (
HarfBuzz.segment_properties_t
) – TheHarfBuzz.segment_properties_t
of the segmentuser_features ([
HarfBuzz.feature_t
]) – The list of user-selected featurescoords ([
int
]) – The list of variation-space coordinatesshaper_list ([
str
]) – List of shapers to try
- Returns:
The shaping plan
- Return type:
The variable-font version of
HarfBuzz.shape_plan_create_cached
. Creates a cached shaping plan suitable for reuse, for a combination of face, user_features, props, and shaper_list, plus the variation-space coordinates coords.New in version 1.4.0.
- HarfBuzz.shape_plan_execute(shape_plan, font, buffer, features)¶
- Parameters:
shape_plan (
HarfBuzz.shape_plan_t
) – A shaping planfont (
HarfBuzz.font_t
) – TheHarfBuzz.font_t
to usebuffer (
HarfBuzz.buffer_t
) – TheHarfBuzz.buffer_t
to work uponfeatures ([
HarfBuzz.feature_t
]) – Features to enable
- Returns:
true
if success,false
otherwise.- Return type:
Executes the given shaping plan on the specified buffer, using the given font and features.
New in version 0.9.7.
- HarfBuzz.shape_plan_get_empty()¶
- Returns:
The empty shaping plan
- Return type:
Fetches the singleton empty shaping plan.
New in version 0.9.7.
- HarfBuzz.shape_plan_get_shaper(shape_plan)¶
- Parameters:
shape_plan (
HarfBuzz.shape_plan_t
) – A shaping plan- Returns:
The shaper
- Return type:
Fetches the shaper from a given shaping plan.
New in version 0.9.7.
- HarfBuzz.style_get_value(font, style_tag)¶
- Parameters:
font (
HarfBuzz.font_t
) – aHarfBuzz.font_t
object.style_tag (
HarfBuzz.style_tag_t
) – a style tag.
- Returns:
Corresponding axis or default value to a style tag.
- Return type:
Searches variation axes of a
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.New in version 3.0.0.
- HarfBuzz.tag_from_string(str)¶
- Parameters:
str (
bytes
) – String to convert- Returns:
The #hb_tag_t corresponding to str
- Return type:
Converts a string into an #hb_tag_t. Valid tags are four characters. Shorter input strings will be padded with spaces. Longer input strings will be truncated.
New in version 0.9.2.
- HarfBuzz.tag_to_string(tag)¶
-
Converts an #hb_tag_t to a string and returns it in buf. Strings will be four characters long.
New in version 0.9.5.
- HarfBuzz.unicode_combining_class(ufuncs, unicode)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structureunicode (
int
) – The code point to query
- Returns:
The
HarfBuzz.unicode_combining_class_t
of unicode- Return type:
Retrieves the Canonical Combining Class (ccc) property of code point unicode.
New in version 0.9.2.
- HarfBuzz.unicode_compose(ufuncs, a, b)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structurea (
int
) – The first Unicode code point to composeb (
int
) – The second Unicode code point to compose
- Returns:
true
if a and b composed,false
otherwise- ab:
The composition of a, b
- Return type:
Fetches the composition of a sequence of two Unicode code points.
Calls the composition function of the specified Unicode-functions structure ufuncs.
New in version 0.9.2.
- HarfBuzz.unicode_decompose(ufuncs, ab)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structureab (
int
) – Unicode code point to decompose
- Returns:
true
if ab was decomposed,false
otherwise- a:
The first code point of the decomposition of ab
- b:
The second code point of the decomposition of ab
- Return type:
Fetches the decomposition of a Unicode code point.
Calls the decomposition function of the specified Unicode-functions structure ufuncs.
New in version 0.9.2.
- HarfBuzz.unicode_decompose_compatibility(ufuncs, u)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structureu (
int
) – Code point to decompose
- Returns:
length of decomposed.
- decomposed:
Compatibility decomposition of u
- Return type:
Fetches the compatibility decomposition of a Unicode code point. Deprecated.
New in version 0.9.2.
Deprecated since version 2.0.0.
- HarfBuzz.unicode_eastasian_width(ufuncs, unicode)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – a Unicode-function structureunicode (
int
) – The code point to query
- Return type:
Don’t use. Not used by HarfBuzz.
New in version 0.9.2.
Deprecated since version 2.0.0.
- HarfBuzz.unicode_funcs_create(parent)¶
- Parameters:
parent (
HarfBuzz.unicode_funcs_t
orNone
) – Parent Unicode-functions structure- Returns:
The Unicode-functions structure
- Return type:
Creates a new
HarfBuzz.unicode_funcs_t
structure of Unicode functions.New in version 0.9.2.
- HarfBuzz.unicode_funcs_get_default()¶
- Returns:
a pointer to the
HarfBuzz.unicode_funcs_t
Unicode-functions structure- Return type:
Fetches a pointer to the default Unicode-functions structure that is used when no functions are explicitly set on
HarfBuzz.buffer_t
.New in version 0.9.2.
- HarfBuzz.unicode_funcs_get_empty()¶
- Returns:
The empty Unicode-functions structure
- Return type:
Fetches the singleton empty Unicode-functions structure.
New in version 0.9.2.
- HarfBuzz.unicode_funcs_get_parent(ufuncs)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structure- Returns:
The parent Unicode-functions structure
- Return type:
Fetches the parent of the Unicode-functions structure ufuncs.
New in version 0.9.2.
- HarfBuzz.unicode_funcs_is_immutable(ufuncs)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structure- Returns:
true
if ufuncs is immutable,false
otherwise- Return type:
Tests whether the specified Unicode-functions structure is immutable.
New in version 0.9.2.
- HarfBuzz.unicode_funcs_make_immutable(ufuncs)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structure
Makes the specified Unicode-functions structure immutable.
New in version 0.9.2.
- HarfBuzz.unicode_funcs_set_combining_class_func(ufuncs, func, *user_data)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – A Unicode-functions structurefunc (
HarfBuzz.unicode_combining_class_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.unicode_combining_class_func_t
.New in version 0.9.2.
- HarfBuzz.unicode_funcs_set_compose_func(ufuncs, func, *user_data)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – A Unicode-functions structurefunc (
HarfBuzz.unicode_compose_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.unicode_compose_func_t
.New in version 0.9.2.
- HarfBuzz.unicode_funcs_set_decompose_compatibility_func(ufuncs, func, *user_data)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – A Unicode-functions structurefunc (
HarfBuzz.unicode_decompose_compatibility_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.unicode_decompose_compatibility_func_t
.New in version 0.9.2.
Deprecated since version 2.0.0.
- HarfBuzz.unicode_funcs_set_decompose_func(ufuncs, func, *user_data)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – A Unicode-functions structurefunc (
HarfBuzz.unicode_decompose_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.unicode_decompose_func_t
.New in version 0.9.2.
- HarfBuzz.unicode_funcs_set_eastasian_width_func(ufuncs, func, *user_data)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – a Unicode-function structurefunc (
HarfBuzz.unicode_eastasian_width_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.unicode_eastasian_width_func_t
.New in version 0.9.2.
Deprecated since version 2.0.0.
- HarfBuzz.unicode_funcs_set_general_category_func(ufuncs, func, *user_data)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – A Unicode-functions structurefunc (
HarfBuzz.unicode_general_category_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.unicode_general_category_func_t
.New in version 0.9.2.
- HarfBuzz.unicode_funcs_set_mirroring_func(ufuncs, func, *user_data)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – A Unicode-functions structurefunc (
HarfBuzz.unicode_mirroring_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.unicode_mirroring_func_t
.New in version 0.9.2.
- HarfBuzz.unicode_funcs_set_script_func(ufuncs, func, *user_data)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – A Unicode-functions structurefunc (
HarfBuzz.unicode_script_func_t
) – The callback function to assign
Sets the implementation function for
HarfBuzz.unicode_script_func_t
.New in version 0.9.2.
- HarfBuzz.unicode_general_category(ufuncs, unicode)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structureunicode (
int
) – The code point to query
- Returns:
The
HarfBuzz.unicode_general_category_t
of unicode- Return type:
Retrieves the General Category (gc) property of code point unicode.
New in version 0.9.2.
- HarfBuzz.unicode_mirroring(ufuncs, unicode)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structureunicode (
int
) – The code point to query
- Returns:
The #hb_codepoint_t of the Mirroring Glyph for unicode
- Return type:
Retrieves the Bi-directional Mirroring Glyph code point defined for code point unicode.
New in version 0.9.2.
- HarfBuzz.unicode_script(ufuncs, unicode)¶
- Parameters:
ufuncs (
HarfBuzz.unicode_funcs_t
) – The Unicode-functions structureunicode (
int
) – The code point to query
- Returns:
The
HarfBuzz.script_t
of unicode- Return type:
Retrieves the
HarfBuzz.script_t
script to which code point unicode belongs.New in version 0.9.2.
- HarfBuzz.variation_from_string(str)¶
- Parameters:
str (
bytes
) – a string to parse- Returns:
true
if str is successfully parsed,false
otherwise- variation:
the
HarfBuzz.variation_t
to initialize with the parsed values
- Return type:
(
int
, variation:HarfBuzz.variation_t
)
Parses a string into a
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
, orslnt=-7.5
.New in version 1.4.2.
- HarfBuzz.variation_to_string(variation)¶
- Parameters:
variation (
HarfBuzz.variation_t
) – anHarfBuzz.variation_t
to convert- Returns:
output string
- Return type:
buf: [
str
]
Converts an
HarfBuzz.variation_t
into aNULL
-terminated string in the format understood byHarfBuzz.variation_from_string
(). The client in responsible for allocating big enough size for buf, 128 bytes is more than enough.New in version 1.4.2.