[][src]Module piet::util

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 sie 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

first_strong_rtl

A heurstic for text direction; returns true if, while enumerating characters in this string, a character in the 'R' (strong right-to-left) category is encountered before any character in the 'L' (strong left-to-right) category is.

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
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.