Parser: Maps Raw Data to Recognized Characters

Parser is a Microsoft(R) Windows(TM) for Pen Computing
program that demonstrates how to parse the symbol element
(SYE) array of the symbol graph (SYG) structure using
symbol values (SYVs) and symbol correspondence (SYC)
arrays where appropriate. The purpose of the program is to
determine the strokes associated with the recognized
characters.

Parser is designed around three main components of Windows
for Pen Computing: the "best guess" array of SYVs, the
HPENDATA structure, and the SYE in the SYG structure.

During a single recognition session, the "ink" (vector-
based x,y coordinates of the user's input) is stored in
the HPENDATA structure of the RCRESULT structure. The
lpsyv field of the RCRESULT structure also contains the
"best guess" array of symbol values that the system thinks
the ink represents. This array can be used in conjunction
with the SYE array and the SYC structure to isolate
individual characters in the ink and associate them with
their corresponding ink strokes (or partial strokes) in
the HPENDATA structure. SYGs, SYVs, SYEs, and SYC
structures are typically the most difficult and confusing
components of the pen architecture. These structures are
interrelated, and it is necessary to parse one array while
another array is being similarly parsed. The Parser
program provides a clear and fairly simple demonstration
of the parsing mechanism. For more information on SYGs,
SYVs, SYEs, and SYCs, see the Windows for Pen Computing
online help system or the Windows version 3.1 Software
Development Kit (SDK) "Microsoft Windows for Pen
Computing: Programmer's Reference" manual.

Parser has the same architecture as the View sample
application on the Microsoft Developer Network CD. View
demonstrates slow drawing, automatic positioning of text
strings returned as the "best guess" from the recognizer,
and dynamically sizing the text string with a matching
TrueType(R) font. The View sample returns a TrueType text
string based on the entire HPENDATA structure, and uses
the bounding rectangle of the entire ink data to size the
font for the string. Parser, on the other hand, walks the
SYE array of the SYG structure looking for the iSyc values
so the SYC structure can be used to find the individual
data strokes for the characters in the HPENDATA structure.
For example, the letter "t" will typically consist of two
strokes, although the strokes are not necessarily
sequential in the HPENDATA structure--for example, the
user can cross the "t" after writing other characters. The
SYC references both strokes and gives an index into the
HPENDATA to retrieve them.

Once Parser associates the "best guess" array of symbol
values to the raw data in the HPENDATA structure, it uses
the raw data points to determine the size of the user's
input, and selects a TrueType font. The size and position
of each individual character the user enters is
independent of all other characters and is displayed as
such.

Parser currently displays a maximum of 10 characters (as
text), regardless of how many characters the user has
entered. You can remove this limitation by adjusting the
MAXCHARMAP value in the CONVERT.H file. When you select
DisplayAsText, Parser displays the SYE array in the upper-
left corner of the client area so the user can see the
results of the recognition process.

 Parser was built and tested under Microsoft Windows
version 3.1. The program requires PENWIN.DLL, which can be
found in both Microsoft Windows for Pen Computing and the
Microsoft Windows version 3.1 SDK. Parser also requires
the TrueType Arial font.

KEYWORDS: PR-CD2; DuplicatePenData; MetricScalePenData;
FIsGesture; _fstrnlen; _fstrncpy; OffsetPenData;
GetPenDataStroke; SymbolToCharacter; FIsAppGesture;
RedisplayPenData; GetPointsFromPenData; GetPenDataInfo;
BeginEnumStrokes; CreatePenData; AddPointsPenData;
_fmemcpy; EndEnumStrokes; DestroyPenData; IsPenEvent;
InitRC; Recognize
