> home > Custom Layer Boundary API

buffer_padded_box_of_pos

January 19th 2020
Compute the rectangle around a character at a particular byte position, relative to the top left corner of a given line

Signature

C++
Rect_f32
buffer_padded_box_of_pos(Application_Links* app,
                         Buffer_ID buffer_id,
                         f32 width,
                         Face_ID face_id,
                         i64 base_line,
                         i64 pos);

Parameters

app

the standard custom layer context pointer

buffer_id

the id of the buffer who's layout will be measured

width

the width parameter of the layout, passed to layout rules as a recommended wrap point

face_id

the face parameter of the layout, passed to layout rules as a recommended face

base_line

the line number of the line that serves as the relative starting point of the measurement

pos

the absolute byte index of the position to query

Return

the rectangle around a character in the layout that is closest to including the given query position in it's span, with coordinates set relative to the top left corner of the base line, on success, when the buffer exists and contains the base line and query position, cleared to zero otherwise

Details

Line numbers are 1 based.