> home > Custom Layer Boundary API

buffer_pos_from_relative_character

January 19th 2020
Compute the byte position associated with the start of a particular character specified relative to the first character of a particular line

Signature

C++
i64
buffer_pos_from_relative_character(Application_Links* app,
                                   Buffer_ID buffer_id,
                                   f32 width,
                                   Face_ID face_id,
                                   i64 base_line,
                                   i64 relative_character);

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

relative_character

the relative character index of the query character, based at the first character of base line

Return

the byte index associated with the start of the character specified by the the base_line and relative_character parameters on success, when the buffer exists and contains the base line, zero otherwise

Details

Line numbers are 1 based.