# pdic2c.pl

## Location

`$NitroSDK/tools/bin/pdic2c.pl`

## Description

`pdic2c.pl` is a sample tool that takes text format pattern data obtained by running the character recognition demo `characterRecognition-2` and converts it into C source files that can be used directly by the program.

## How to use pdic2c

### Start Up Command

`% perl pdic2c.pl REGULARIZE_SIZE [PROTOTYPEFILE]`

The text data contained in the file specified as the `PROTOTYPEFILE` is interpreted as sample character dictionary data and a C source file that can be used directly by the program, is output as standard output. The regularized size of the output data is specified in `REGULAR_SIZE`. `PROTOTYPEFILE` can be omitted. When it is, the data is read from standard input.

### Character Dictionary Text Data Fonts

line ::= "PatternName" Kind Correction NormalizeSize '|' stroke+
stroke ::= point+ '|'
point ::= '(' X ',' Y ')'

Format | Meaning | Details
"Pattern Name" | Item Name | This is the name of the characters shown in this item. Code values are assigned starting at 0 in the order that the names appear and the correspondence between the code and the name are output as a `PatternName` matrix.
Kind | Type of Character | This is the value that is output to the `PRCPrototypeEntry` kind.
Correction | Corrected Value | This is the value that is output to the `PRCPrototypeEntry` correction.
NormalizeSize | Normalize Size | For this item, the values assume a bounding box so that the upper left is (0, 0) and lower right is (NormalizeSize-1, NormalizeSize-1). When these differ from the arguments of `pdic2c.pl`, output will take place after the coordinate values that follow this item have been enlarged or reduced to match the size of the argument.
"|" | Break | The vertical line indicates that the pen left the paper once and the line stopped.
(X, Y) | Coordinates | This indicates the pattern coordinates. Please be careful to note that, in order to align with the screen coordinates, that the upper left is (0, 0).
# ... | Comments | These are interpreted as explicit comments and are read and discarded without doing anything.

Scenarios for the use of this tool include the character recognition sample demo `characterRecognition-2` in which the pattern data output as debug output when the Y button is pressed is cut and pasted and text format character sample data are created. By passing that test file to `pdic2c.pl`, it is possible to generate source code for the list of character samples used with character recognition API.

A small part of the first half of the output file is a header file for other source code that uses the character list, the second half is a `.c` file that has the specific data, so please split the file in the right places as you write over it.

## See Also

`Character Recognition Sample Demo characterRecognition-2`

## Revision History

10/28/2004 Changed regularize to normalize.
06/30/2004 Initial version.