Chapter 37. Bi-directional text

Index

Bi-directional text input

LibCXXW displays bi-directional text and provides several means for controlling how bi-directional text gets displayed.

A text label's primary direction gets set from its default Unicode bi-directional rendering order. Use the x::w::label_config's optional x::w::bidi direction to explicitly override a label's rendering direction, when necessary.

Input fields' rendering direction gets set the same way. Use x::w::input_field_config's x::w::bidi direction to explicitly override the input field's rendering direction.

Bi-directional text input

Bi-directional text placed into an input fields loses all of its original isolation and override markers (if any). Its original Unicode Unicode isolation and override markers get applied as part of interpreting the bi-directional text's appearance. The resulting bi-directional text gets edited directly, with its isolation and override markers stripped off.

Retrieved contents of the input field may or may not include replacement markers, depending on the requested x::w::bidi_format directional_format. get() and get_unicode() use this x::w::input_field_config, setting by default. An optional x::w::bidi_format parameter get() and get_unicode() overrides this default.

Input field search callback threads have their x::w::bidi_format come from the input field's input_field_search's search_format. The default search_format value is none.

New direction of text entered into an input field comes from each character's default rendering direction. Alt-Cursor-Left and Alt-Cursor-Right override the default rendering direction of the typed in text going forward. Pressing the same key combination turns off the directional override. A small tooltip is displayed while text direction override is in effect:

Bi-directional text input

In this example the normal text was typed in first, then the cursor got backed up to the open parenthesis; then Alt-Cursor-Left followed by Hello world.