Tesseract
3.02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ocrrow.h
Go to the documentation of this file.
1
/**********************************************************************
2
* File: ocrrow.h (Formerly row.h)
3
* Description: Code for the ROW class.
4
* Author: Ray Smith
5
* Created: Tue Oct 08 15:58:04 BST 1991
6
*
7
* (C) Copyright 1991, Hewlett-Packard Ltd.
8
** Licensed under the Apache License, Version 2.0 (the "License");
9
** you may not use this file except in compliance with the License.
10
** You may obtain a copy of the License at
11
** http://www.apache.org/licenses/LICENSE-2.0
12
** Unless required by applicable law or agreed to in writing, software
13
** distributed under the License is distributed on an "AS IS" BASIS,
14
** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
** See the License for the specific language governing permissions and
16
** limitations under the License.
17
*
18
**********************************************************************/
19
20
#ifndef OCRROW_H
21
#define OCRROW_H
22
23
#include <stdio.h>
24
25
#include "
quspline.h
"
26
#include "
werd.h
"
27
28
class
TO_ROW
;
29
30
class
PARA
;
31
32
class
ROW
:
public
ELIST_LINK
33
{
34
friend
void
tweak_row_baseline
(
ROW
*,
double
,
double
);
35
public
:
36
ROW
() {
37
}
//empty constructor
38
ROW
(
//constructor
39
inT32
spline_size,
//no of segments
40
inT32
*xstarts,
//segment boundaries
41
double
*coeffs,
//coefficients //ascender size
42
float
x_height
,
43
float
ascenders
,
44
float
descenders
,
//descender size
45
inT16
kern
,
//char gap
46
inT16
space
);
//word gap
47
ROW
(
//constructor
48
TO_ROW
*row,
//textord row
49
inT16
kern
,
//char gap
50
inT16
space
);
//word gap
51
52
WERD_LIST *
word_list
() {
//get words
53
return
&words;
54
}
55
56
float
base_line
(
//compute baseline
57
float
xpos)
const
{
//at the position
58
//get spline value
59
return
(
float
) baseline.
y
(xpos);
60
}
61
float
x_height
()
const
{
//return x height
62
return
xheight;
63
}
64
void
set_x_height
(
float
new_xheight) {
// set x height
65
xheight = new_xheight;
66
}
67
inT32
kern
()
const
{
//return kerning
68
return
kerning;
69
}
70
float
body_size
()
const
{
//return body size
71
return
bodysize;
72
}
73
void
set_body_size
(
float
new_size) {
// set body size
74
bodysize = new_size;
75
}
76
inT32
space
()
const
{
//return spacing
77
return
spacing;
78
}
79
float
ascenders
()
const
{
//return size
80
return
ascrise;
81
}
82
float
descenders
()
const
{
//return size
83
return
descdrop;
84
}
85
TBOX
bounding_box
()
const
{
//return bounding box
86
return
bound_box;
87
}
88
89
void
set_lmargin
(
inT16
lmargin
) {
90
lmargin_ =
lmargin
;
91
}
92
void
set_rmargin
(
inT16
rmargin
) {
93
rmargin_ =
rmargin
;
94
}
95
inT16
lmargin
()
const
{
96
return
lmargin_;
97
}
98
inT16
rmargin
()
const
{
99
return
rmargin_;
100
}
101
102
void
set_has_drop_cap
(
bool
has) {
103
has_drop_cap_ = has;
104
}
105
bool
has_drop_cap
()
const
{
106
return
has_drop_cap_;
107
}
108
109
void
set_para
(
PARA
*p) {
110
para_ = p;
111
}
112
PARA
*
para
()
const
{
113
return
para_;
114
}
115
116
void
recalc_bounding_box
();
//recalculate BB
117
118
void
move
(
// reposition row
119
const
ICOORD
vec);
// by vector
120
121
void
print
(
//print
122
FILE *fp);
//file to print on
123
124
#ifndef GRAPHICS_DISABLED
125
void
plot
(
//draw one
126
ScrollView
* window,
//window to draw in
127
ScrollView::Color
colour);
//uniform colour
128
void
plot
(
//draw one
129
ScrollView
* window);
//in rainbow colours
130
131
void
plot_baseline
(
//draw the baseline
132
ScrollView
* window,
//window to draw in
133
ScrollView::Color
colour) {
//colour to draw
134
//draw it
135
baseline.
plot
(window, colour);
136
}
137
#endif // GRAPHICS_DISABLED
138
ROW
&
operator=
(
const
ROW
& source);
139
140
private
:
141
inT32
kerning;
//inter char gap
142
inT32
spacing;
//inter word gap
143
TBOX
bound_box;
//bounding box
144
float
xheight;
//height of line
145
float
ascrise;
//size of ascenders
146
float
descdrop;
//-size of descenders
147
float
bodysize;
//CJK character size. (equals to
148
//xheight+ascrise by default)
149
WERD_LIST words;
//words
150
QSPLINE
baseline;
//baseline spline
151
152
// These get set after blocks have been determined.
153
bool
has_drop_cap_;
154
inT16
lmargin_;
// Distance to left polyblock margin.
155
inT16
rmargin_;
// Distance to right polyblock margin.
156
157
// This gets set during paragraph analysis.
158
PARA
*para_;
// Paragraph of which this row is part.
159
};
160
161
ELISTIZEH
(
ROW
)
162
#endif
mnt
data
src
tesseract-ocr
ccstruct
ocrrow.h
Generated on Thu Nov 1 2012 20:19:44 for Tesseract by
1.8.1