1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>pdic2c.pl</TITLE>
8<LINK rel="stylesheet" href="../css/nitro.css" type="text/css">
9<STYLE type="text/css">
10<!--
11.sample_source{
12  background-color : #e8e8e8;
13}
14H3{
15  color : teal;
16}
17.command_list{
18  margin-bottom : 16pt;
19}
20.command_desc{
21  }
22.command_item{
23  margin-top : 16pt;
24  background-color : #e8e8e8;
25}
26.blockquoted_table {
27  border : 1px;
28  width : 80%;
29}
30TD,TH{
31  border-color	: #c0d8d8;
32  padding       : 1pt 4pt 1pt 4pt;
33  border-width  : 1px;
34  border-style  : solid;
35}
36-->
37</STYLE>
38</HEAD>
39<BODY>
40<H1 align="left">pdic2c.pl <IMG src="../image/NTR.gif" align="middle"><IMG src="../image/TWL.gif" align="middle"></H1>
41<H2>Description</H2>
42<P><code>pdic2c.pl</code> is a sample tool that converts text format pattern data obtained by running the character recognition demo <a href="../demos/prc/prcdemos.html"><code>characterRecognition-2</code></a> into C source files that can be used directly by the program.</P>
43<H2>Using the Tool</H2>
44<H3>Start Command</H3>
45<P><CODE>% perl pdic2c.pl [-ch] [-C OUTPUT_SOURCE] [-H OUTPUT_HEADER] [-i INCLUDE_FILE] [-p PREFIX] NORMALIZE_SIZE [PATTERN_FILES]...</CODE></P>
46<P>The text data contained in the files specified in <code>PATTERN_FILES</code> is interpreted as sample character dictionary data. The C source file and the header are consecutively output as standard output. The normalized size of the output data is specified in <code>NORMALIZE_SIZE</code>. <code>PATTERN_FILES</code> can be omitted. When it is, the data is read from standard input.</P>
47<P>When either <CODE>-c, -h</CODE> is specified as an option, either the source file or the header file is output. When it's unspecified, both are output. Also, if each of the <CODE>-C, -H</CODE> options are specified, instead of regular output, it is possible to specify the source file name and header file name of the output destination.</P>
48<P>There is a code in the source file that #includes the header file. The path name is specified with the <CODE>-i</CODE> option. When there is no <CODE>-i</CODE> option, only the file name part of the path name that is specified by the <CODE>-H</CODE> option is used. When nothing is specified, <CODE>patternDict.h</CODE> is used.</P>
49<P>The <CODE>-p</CODE> option can be used to specify the prefix attached to the identifier in the generated source file.</P>
50
51<H3>Character Dictionary Text Data Fonts</H3>
52<P><CODE>pdic2c.pl</CODE> interprets text data as one item per line on the basis of the following forms:</P>
53<PRE>line   ::= &quot;PatternName&quot; Kind Correction NormalizeSize '|' stroke+
54  stroke ::= point+ '|'
55  point  ::= '(' X ',' Y ')'
56</PRE>
57<TABLE border="1">
58  <TBODY>
59    <TR>
60      <TH>Format</TH>
61      <TH>Description</TH>
62      <TH>Details</TH>
63    </TR>
64    <TR>
65      <TD><CODE>&quot;Pattern Name&quot;</CODE></TD>
66      <TD>Item Name</TD>
67      <TD>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 <code>PatternName</code> matrix.</TD>
68    </TR>
69    <TR>
70      <TD><CODE>Kind</CODE></TD>
71      <TD>Type of Character</TD>
72      <TD>This is the value that is output to the <a href="../prc/recognize/PRCPrototypeEntry.html"><code>PRCPrototypeEntry</code></a> kind.</TD>
73    </TR>
74    <TR>
75      <TD><CODE>Correction</CODE></TD>
76      <TD>Corrected Value</TD>
77      <TD>This is the value that is output to the   <a href="../prc/recognize/PRCPrototypeEntry.html"><code>PRCPrototypeEntry</code></a> correction.</TD>
78    </TR>
79    <TR>
80      <TD><CODE>NormalizeSize</CODE></TD>
81      <TD>Normalize Size</TD>
82      <TD>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 <code>pdic2c.pl</code>, output will take place after the coordinate values  that follow this item have been enlarged or reduced to match the size of the argument.</TD>
83    </TR>
84    <TR>
85      <TD><CODE>'|'</CODE></TD>
86      <TD>Break</TD>
87      <TD>The vertical line indicates that the pen left the paper once and the line stopped.</TD>
88    </TR>
89    <TR>
90      <TD><CODE>(X, Y)</CODE></TD>
91      <TD>Coordinates</TD>
92      <TD>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).</TD>
93    </TR>
94    <TR>
95      <TD># ...</TD>
96      <TD>Comment</TD>
97      <TD>This is interpreted as an explicit comment row and it reads it and discards it without doing anything.
98    </TD>
99    </TR>
100  </TBODY>
101</TABLE>
102<P>Scenarios for the use of this tool include the character recognition sample demo <a href="../demos/prc/prcdemos.html"><code>characterRecognition-2</code></a> 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 <code>pdic2c.pl</code>, it is possible to generate source code for the list of character samples used with character recognition API.
103</P>
104<P>When all are sent to standard output, the first half is a header file for other source codes using a figure list, and the second half is a source file containing concrete data. Divide and rewrite them accordingly when you use them.</P>
105<H2>Location</H2>
106<P><CODE>$TwlSDK/tools/bin/pdic2c.pl</CODE></P>
107<H2>See Also</H2>
108<P><CODE><A href="../demos/prc/prcdemos.html">Character Recognition Sample Demo characterRecognition-2</A></CODE></P>
109<H2>Revision History</H2>
110<P>
1112005/10/04 Noted addition of arguments.<BR> 2004/10/28 Changed regularize to normalize.<BR> 2004/06/30 Initial version.
112</P>
113<hr><p>CONFIDENTIAL</p></body>
114</HTML>