bidi-resolved-levels is a built-in function in `C source code'.

(bidi-resolved-levels &optional VPOS)

Return the resolved bidirectional levels of characters at VPOS.

The resolved levels are produced by the Emacs bidi reordering engine
that implements the UBA, the Unicode Bidirectional Algorithm. Please
read the Unicode Standard Annex 9 (UAX#9) for background information
about these levels.

VPOS is the zero-based number of the current window's screen line
for which to produce the resolved levels. If VPOS is nil or omitted,
it defaults to the screen line of point. If the window displays a
header line, VPOS of zero will report on the header line, and first
line of text in the window will have VPOS of 1.

Value is an array of resolved levels, indexed by glyph number.
Glyphs are numbered from zero starting from the beginning of the
screen line, i.e. the left edge of the window for left-to-right lines
and from the right edge for right-to-left lines. The resolved levels
are produced only for the window's text area; text in display margins
is not included.

If the selected window's display is not up-to-date, or if the specified
screen line does not display text, this function returns nil. It is
highly recommended to bind this function to some simple key, like F8,
in order to avoid these problems.

This function exists mainly for testing the correctness of the
Emacs UBA implementation, in particular with the test suite.