Skip to content
pixi-silk
GitHub repository
Function

resolveLevels

import { resolveLevels } from 'pixi-silk/text/bidi';
function resolveLevels(
   types: readonly BidiClass[], 
   level: 0 | 1, 
   chars?: readonly string[]
): number[];

Embedding levels of one paragraph, one per unit, in logical order (UAX #9 rules X1 to X10, W1 to W7, N0 to N2, I1 and I2). types are the original types. chars are the units’ text, used to pair brackets (N0). Even levels run left to right, odd ones right to left. Embedding controls and boundary neutrals take the level of the unit before them.

Parameters#

ParameterType
typesreadonly BidiClass[]
level0 | 1
chars?readonly string[]

Returns#

number[]