Module util

Source
Expand description

utilities shared by various backends Code useful for multiple backends

Structs§

LayoutDefaults
A type backends can use to represent the default values for a TextLayout

Constants§

DEFAULT_FONT_SIZE
The default point size for text in piet.
DEFAULT_TEXT_COLOR
The default foreground text color.

Functions§

compute_blurred_rect
Generate image for a blurred rect, writing it into the provided buffer.
count_until_utf16
returns utf8 text position (code unit offset) at the given utf-16 text position
count_utf16
Counts the number of utf-16 code units in the given string. from xi-editor
expected_image_buffer_size
Returns the number of bytes needed to be read from the image buffer.
first_strong_rtl
A heurstic for text direction.
image_buffer_to_tightly_packed
Converts an image buffer to a tightly packed owned buffer.
line_number_for_position
Returns the index of the line containing this utf8 position, or the last line index if the position is out of bounds.
resolve_range
Resolves a RangeBounds into a range in the range 0..len.
size_for_blurred_rect
Calculate the size required paint a blurred rect.
trailing_nlf
If this string ends in a newline function (NLF) (5.8), return the length of the NLF in bytes.
unpremul
If x is a single (non-alpha) channel of a premultiplied color and a is the alpha channel, returns the corresponding channel of the unpremultiplied version of the color.
unpremultiply_rgba
Takes a buffer of premultiplied RGBA pixels and unpremultiplies them in place.