Skip to content
joining_forms

joining_forms

Mojo function 🡭

joining_forms

fn def joining_forms(codepoints: List[Int]) -> List[Int]

The contextual form each character of a run is eligible for, one per codepoint.

A character joins to the neighbor on a given side when both are willing: the neighbor must be able to join on the side that faces it, and the character itself must be able to join on that side. R joins only to what precedes it, L only to what follows, D and C to both. Transparent characters are skipped when looking for a neighbor, so a vowel mark between two letters leaves their join intact.

The forms follow: a D joined on both sides is medial, joined only to what precedes it final, only to what follows initial, and otherwise isolated. R and L have only two of those available. Everything else – marks, tatweel, digits, non-Arabic text – gets _FORM_NONE.

Args:

  • codepoints (List[Int]): A run’s codepoints, in logical order.

Returns:

List[Int]: One _FORM_* value per codepoint.