scribblealloc, recognize – character recognition|
Rune recognize(Scribble *);
The scribble library implements simple character recognition.
All characters are drawn using a single stroke of the pen (mouse
button 1) as on a palmtop computer. A reference card is in /sys/src/libscribble/quickref.gif.
The library is not really intended for standalone use. Its primary use is by the scribble graphical control (see control(2)).
Scribblealloc allocates and returns an appropriately initialized
There are three such groups: letters, digits, and punctuation. The current group is encoded in the curCharSet field of the Scribble structure. Special strokes are recognized to switch between groups. In addition, the charater recognized is influenced by mode parameters and modifies them. These are identified by the capsLock, puncShift, tmpShift, and ctrlShift fields of the Scribble structure. When puncShift is non–zero, the character is recognized in the punctuation character set. Similarly, when the character recognized is printable and ctrlShift is set, the associated control character is returned as if the control key were depressed, and when the character is a letter and capsLock or tmpShift is set, the upper–case version is returned. The puncShift and tmpShift flags are turned off once a character has been recognized; the others are left set.
The character to be recognized is encoded as an array of pen_points in the ps field. To allow easy drawing of the stroke as it is drawn, the pt and ppasize fields are available to the application code for storing an array of points for a call to poly (see draw(2)).
Recognize recognizes the character provided in the ps field of
the Scribble structure; it returns the rune or zero if nothing
/sys/src/libscribble/quickref.gif serves as a quick reference
/sys/lib/scribble/classifiers contains the stroke definitions.
This library is adapted from software reproduced by permission:
Graffiti.c is based on the file Scribble.c copyrighted by Keith
Portions of the software Copyright © 1994 by Sun Microsystems Computer Company.
Portions of the software Copyright © 2000 by Compaq Computer Corporation.
Keyboard and prompter in bitsyload(1), draw(2), control(2)|