FLTK Compose-Character Sequences

The Fl_Input widget lets you type all the characters in the standard ISO-8859-1 character set. Most fonts will display these characters correctly.

To insert them, type the [compose] key and then one or two characters. The two characters can be in either order. The [compose] key is any of: Ctrl+Q, the righthand control key, or any key your X server calls XK_Multi_key.

KeysChar KeysChar KeysChar KeysChar KeysChar KeysChar
spacenbsp * A` D- a` d-
! +- A' N~ a' n~
% 2 A^ O` a^ o`
# 3 A~ O' a~ o'
$ ' A: O^ a: o^
y= u A* O~ a* o~
| p AE O: ae o:
& . C, x c, -:
: , E` O/ e` o/
c 1 E' U` e' u`
a o E^ U' e^ u'
<< >> E: U^ e: u^
~ 14 I` U: i` u:
- 12 I' Y' i' y'
r 34 I^ TH i^ th
_ ? I: ss i: y:

For instance, to type "" type [compose][a]['] or [compose]['][a].

The character "nbsp" (non-breaking space) is typed by using [compose][space].

The single-character sequences may be followed by a space if necessary to remove ambiguity. For instance, if you really want to type "~" rather than "" you must type [compose][a][space][~].

If you wish to use the compose function in your own code, your widget's handle() method must call fl_compose() in response to FL_KEYPRESS events:

int fl_compose(int state, char c, int &del, char *buffer, int &ins)

Starts or adds a single ASCII character to a compose sequence. This will return the number of old bytes to delete and a set of new bytes to insert, and a new state value. If this returns zero you can ignore the result (which just says to insert the character unchanged) and handle the keystroke yourself.

state

Must either be the return value of the last call to fl_compose() or zero to start a new compose sequence. Be sure to reset to zero if the user ever moves the cursor.

c

Is the ASCII character that the user typed.

del

Is set to the number of bytes to delete backwards. This will always be less or equal to the ins from the last call to fl_compose(), and will be zero if state is zero.

buffer

Will have the first ins bytes set to the data to insert and display (it is not nul-terminated).

ins

ins will be the number of characters to insert.