RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
a11y_shaped_text.h File Reference

Optional accessibility geometry for shaped/bidi text. More...

#include "a11y.h"
#include "text_shape.h"

Functions

int rmgui_a11y_text_selection (const rmgui_text_shaped_t *text, size_t start, size_t end, rmgui_rect_t *rects, size_t capacity, size_t *count)
 Logical UTF-8 byte range [start,end) in a borrowed shaped layout.
int rmgui_a11y_text_offset (const rmgui_text_shaped_t *text, int x, int y, size_t *offset, rmgui_text_affinity_t *affinity)
 Maps coordinates relative to the text origin to a logical UTF-8 byte offset and edge affinity, never a visual index or UTF-16 position.

Detailed Description

Optional accessibility geometry for shaped/bidi text.

Function Documentation

◆ rmgui_a11y_text_selection()

int rmgui_a11y_text_selection ( const rmgui_text_shaped_t * text,
size_t start,
size_t end,
rmgui_rect_t * rects,
size_t capacity,
size_t * count )

Logical UTF-8 byte range [start,end) in a borrowed shaped layout.

Both endpoints must be scalar/maximal-subpart boundaries in the original input; byte interiors are refused even for empty ranges. Malformed UTF-8 follows core shaping's U+FFFD maximal-subpart boundaries, not continuation-byte tests. A ligature intersected by the range is selected as a whole. Delegates rmgui_text_selection: one rectangle per contiguous visual piece per line, in paint order, relative to the text origin, font_px+2 high. NULL rects queries count (capacity ignored); empty ranges produce no rects. Returns 0 on success, -1 for invalid input/bounds or insufficient capacity, without changing rects or count on refusal. count must be non-NULL. No allocation; requires a current, unmodified rmgui_text_shaped_t result.

◆ rmgui_a11y_text_offset()

int rmgui_a11y_text_offset ( const rmgui_text_shaped_t * text,
int x,
int y,
size_t * offset,
rmgui_text_affinity_t * affinity )

Maps coordinates relative to the text origin to a logical UTF-8 byte offset and edge affinity, never a visual index or UTF-16 position.

Delegates rmgui_text_hit: nearest visual cluster edge on the selected line; ties choose the earlier visual edge, positions outside the layout clamp to its edges. Ligature interiors map to an outer edge; empty text maps to offset 0/AFTER. Returns 0 on success, -1 for invalid arguments with both outputs unchanged. Both outputs must be non-NULL. Borrows the current shaped result; no allocation. Existing field-based rmgui_a11y_text_range/line helpers remain unchanged.