ui_access

module pkg::alloy::window::text_rangessource

What screen readers ask of a node's text, answered from its TextMap for every platform (decisions/F14.md, F14b): the unit holding an offset, moves by units, the boxes a range covers and the offset at a point. Offsets are bytes of the node's text on grapheme boundaries; each platform counts them its own way (unicode.alloy). Ranges are in the text's order, their boxes in the order they are drawn.

type TextUnitsource

exp type TextUnit = enum

What a screen reader moves by: a character is a grapheme, where the caret stops; a word runs to the next one's start, the spaces after it included; a line as drawn; a paragraph to a line break, the break included.

Variants

Character
Word
Line
Paragraph
Document

type Movedsource

exp type Moved = struct

Where a move ended, and how many units it went (negative backward): fewer than asked at the text's ends.

Fields

exp at: u32
exp count: i32

fn mapped_textsource

exp fn mapped_text(self node: &AccessNode) -> &[u8]

The text a node's map is of: a field's value, else its label.

fn endsource

exp fn end(self map: &TextMap) -> u32

The text's length, as the map has it.

fn clampedsource

exp fn clamped(self map: &TextMap, at: u32) -> u32

The offset moved back to a grapheme boundary, within the text: what a range made before an edit comes to.

fn unit_atsource

exp fn unit_at(self map: &TextMap, text: &[u8], at: u32, unit: TextUnit) -> [u32 : 2]

The unit holding the offset, as [start, end): at the text's end an empty character or word, and the last line or paragraph unless a line break ends the text, whose empty line follows it.

fn movedsource

exp fn moved(self map: &TextMap, text: &[u8], at: u32, unit: TextUnit, count: i32) -> Moved

The boundary count units on from the offset (back when negative), the text's ends stopping it.

fn line_ofsource

exp fn line_of(self map: &TextMap, at: u32) -> u64

The line holding the offset: a line's end is the next line's start, but the last line's and a line ended by a break's.

fn boxessource

exp fn boxes(self map: &TextMap, start: u32, end: u32) -> Vector<Area>

The boxes covering the range from start to end, in the node's pixels: one a line, more where the direction changes within one, from the left. An empty range is the caret's box, a pixel wide.

fn offset_atsource

exp fn offset_at(self map: &TextMap, x: f32, y: f32) -> u32

The grapheme boundary nearest the point, in the node's pixels, on the line at its height: a grapheme's start at its edge the line reads from, its end at the other.

fn grapheme_atsource

exp fn grapheme_at(self map: &TextMap, x: f32, y: f32) -> Option<u32>

The grapheme drawn at the point, by its start: none past the text.

fn visible_linessource

exp fn visible_lines(self map: &TextMap, height: f32) -> [u32 : 2]

The lines drawn within the height, from the top: what shows of a field.

fn TextMap::plainsource

exp fn TextMap::plain(text: &[u8], bounds: &Area) -> TextMap

A map for a text no layout was sent for (a combo box's value, a button's): a grapheme a character, one line over the node, no words.