#include <ocrrow.h>
List of all members.
Public Member Functions |
| ROW () |
| ROW (inT32 spline_size, inT32 *xstarts, double *coeffs, float x_height, float ascenders, float descenders, inT16 kern, inT16 space) |
| ROW (TO_ROW *row, inT16 kern, inT16 space) |
WERD_LIST * | word_list () |
float | base_line (float xpos) const |
float | x_height () const |
void | set_x_height (float new_xheight) |
inT32 | kern () const |
float | body_size () const |
void | set_body_size (float new_size) |
inT32 | space () const |
float | ascenders () const |
float | descenders () const |
TBOX | bounding_box () const |
void | set_lmargin (inT16 lmargin) |
void | set_rmargin (inT16 rmargin) |
inT16 | lmargin () const |
inT16 | rmargin () const |
void | set_has_drop_cap (bool has) |
bool | has_drop_cap () const |
void | set_para (PARA *p) |
PARA * | para () const |
void | recalc_bounding_box () |
void | move (const ICOORD vec) |
void | print (FILE *fp) |
void | plot (ScrollView *window, ScrollView::Color colour) |
void | plot (ScrollView *window) |
void | plot_baseline (ScrollView *window, ScrollView::Color colour) |
ROW & | operator= (const ROW &source) |
Friends |
void | tweak_row_baseline (ROW *, double, double) |
Detailed Description
Definition at line 32 of file ocrrow.h.
Constructor & Destructor Documentation
ROW::ROW |
( |
inT32 |
spline_size, |
|
|
inT32 * |
xstarts, |
|
|
double * |
coeffs, |
|
|
float |
x_height, |
|
|
float |
ascenders, |
|
|
float |
descenders, |
|
|
inT16 |
kern, |
|
|
inT16 |
space |
|
) |
| |
Definition at line 67 of file ocrrow.cpp.
: para_(NULL) {
kerning = kern;
spacing = space;
xheight = to_row->xheight;
bodysize = to_row->body_size;
ascrise = to_row->ascrise;
descdrop = to_row->descdrop;
baseline = to_row->baseline;
has_drop_cap_ = false;
lmargin_ = 0;
rmargin_ = 0;
}
Member Function Documentation
float ROW::ascenders |
( |
| ) |
const [inline] |
float ROW::base_line |
( |
float |
xpos | ) |
const [inline] |
float ROW::body_size |
( |
| ) |
const [inline] |
TBOX ROW::bounding_box |
( |
| ) |
const [inline] |
float ROW::descenders |
( |
| ) |
const [inline] |
bool ROW::has_drop_cap |
( |
| ) |
const [inline] |
Definition at line 105 of file ocrrow.h.
{
return has_drop_cap_;
}
inT32 ROW::kern |
( |
| ) |
const [inline] |
inT16 ROW::lmargin |
( |
| ) |
const [inline] |
void ROW::move |
( |
const ICOORD |
vec | ) |
|
Definition at line 138 of file ocrrow.cpp.
{
WERD_IT it(&words);
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ())
it.data ()->move (vec);
bound_box.move (vec);
baseline.move (vec);
}
ROW & ROW::operator= |
( |
const ROW & |
source | ) |
|
Definition at line 218 of file ocrrow.cpp.
{
this->ELIST_LINK::operator= (source);
kerning = source.kerning;
spacing = source.spacing;
xheight = source.xheight;
bodysize = source.bodysize;
ascrise = source.ascrise;
descdrop = source.descdrop;
if (!words.empty ())
words.clear ();
baseline = source.baseline;
bound_box = source.bound_box;
has_drop_cap_ = source.has_drop_cap_;
lmargin_ = source.lmargin_;
rmargin_ = source.rmargin_;
para_ = source.para_;
return *this;
}
PARA* ROW::para |
( |
| ) |
const [inline] |
Definition at line 178 of file ocrrow.cpp.
{
WERD *word;
WERD_IT it = &words;
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
word = it.data ();
word->plot (window, colour);
}
}
Definition at line 199 of file ocrrow.cpp.
{
WERD *word;
WERD_IT it = &words;
for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
word = it.data ();
word->plot (window);
}
}
void ROW::print |
( |
FILE * |
fp | ) |
|
Definition at line 157 of file ocrrow.cpp.
{
tprintf("Kerning= %d\n", kerning);
tprintf("Spacing= %d\n", spacing);
bound_box.print();
tprintf("Xheight= %f\n", xheight);
tprintf("Ascrise= %f\n", ascrise);
tprintf("Descdrop= %f\n", descdrop);
tprintf("has_drop_cap= %d\n", has_drop_cap_);
tprintf("lmargin= %d, rmargin= %d\n", lmargin_, rmargin_);
}
void ROW::recalc_bounding_box |
( |
| ) |
|
inT16 ROW::rmargin |
( |
| ) |
const [inline] |
void ROW::set_body_size |
( |
float |
new_size | ) |
[inline] |
void ROW::set_has_drop_cap |
( |
bool |
has | ) |
[inline] |
void ROW::set_lmargin |
( |
inT16 |
lmargin | ) |
[inline] |
void ROW::set_para |
( |
PARA * |
p | ) |
[inline] |
void ROW::set_rmargin |
( |
inT16 |
rmargin | ) |
[inline] |
void ROW::set_x_height |
( |
float |
new_xheight | ) |
[inline] |
Definition at line 64 of file ocrrow.h.
{
xheight = new_xheight;
}
inT32 ROW::space |
( |
| ) |
const [inline] |
WERD_LIST* ROW::word_list |
( |
| ) |
[inline] |
float ROW::x_height |
( |
| ) |
const [inline] |
Friends And Related Function Documentation
void tweak_row_baseline |
( |
ROW * |
, |
|
|
double |
, |
|
|
double |
|
|
) |
| [friend] |
Definition at line 680 of file tordmain.cpp.
{
TBOX blob_box;
C_BLOB *blob;
WERD *word;
inT32 blob_count;
inT32 src_index;
inT32 dest_index;
inT32 *xstarts;
double *coeffs;
float ydiff;
float x_centre;
WERD_IT word_it = row->word_list ();
C_BLOB_IT blob_it;
blob_count = 0;
for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ()) {
word = word_it.data ();
blob_count += word->cblob_list ()->length ();
}
if (blob_count == 0)
return;
xstarts =
(inT32 *) alloc_mem ((blob_count + row->baseline.segments + 1) *
sizeof (inT32));
coeffs =
(double *) alloc_mem ((blob_count + row->baseline.segments) * 3 *
sizeof (double));
src_index = 0;
dest_index = 0;
xstarts[0] = row->baseline.xcoords[0];
for (word_it.mark_cycle_pt (); !word_it.cycled_list (); word_it.forward ()) {
word = word_it.data ();
blob_it.set_to_list (word->cblob_list ());
for (blob_it.mark_cycle_pt (); !blob_it.cycled_list ();
blob_it.forward ()) {
blob = blob_it.data ();
blob_box = blob->bounding_box ();
x_centre = (blob_box.left () + blob_box.right ()) / 2.0;
ydiff = blob_box.bottom () - row->base_line (x_centre);
if (ydiff < 0)
ydiff = -ydiff / row->x_height ();
else
ydiff = ydiff / row->x_height ();
if (ydiff < blshift_maxshift
&& blob_box.height () / row->x_height () > blshift_xfraction) {
if (xstarts[dest_index] >= x_centre)
xstarts[dest_index] = blob_box.left ();
coeffs[dest_index * 3] = 0;
coeffs[dest_index * 3 + 1] = 0;
coeffs[dest_index * 3 + 2] = blob_box.bottom ();
dest_index++;
xstarts[dest_index] = blob_box.right () + 1;
}
else {
if (xstarts[dest_index] <= x_centre) {
while (row->baseline.xcoords[src_index + 1] <= x_centre
&& src_index < row->baseline.segments - 1) {
if (row->baseline.xcoords[src_index + 1] >
xstarts[dest_index]) {
coeffs[dest_index * 3] =
row->baseline.quadratics[src_index].a;
coeffs[dest_index * 3 + 1] =
row->baseline.quadratics[src_index].b;
coeffs[dest_index * 3 + 2] =
row->baseline.quadratics[src_index].c;
dest_index++;
xstarts[dest_index] =
row->baseline.xcoords[src_index + 1];
}
src_index++;
}
coeffs[dest_index * 3] =
row->baseline.quadratics[src_index].a;
coeffs[dest_index * 3 + 1] =
row->baseline.quadratics[src_index].b;
coeffs[dest_index * 3 + 2] =
row->baseline.quadratics[src_index].c;
dest_index++;
xstarts[dest_index] = row->baseline.xcoords[src_index + 1];
}
}
}
}
while (src_index < row->baseline.segments
&& row->baseline.xcoords[src_index + 1] <= xstarts[dest_index])
src_index++;
while (src_index < row->baseline.segments) {
coeffs[dest_index * 3] = row->baseline.quadratics[src_index].a;
coeffs[dest_index * 3 + 1] = row->baseline.quadratics[src_index].b;
coeffs[dest_index * 3 + 2] = row->baseline.quadratics[src_index].c;
dest_index++;
src_index++;
xstarts[dest_index] = row->baseline.xcoords[src_index];
}
row->baseline = QSPLINE (dest_index, xstarts, coeffs);
free_mem(xstarts);
free_mem(coeffs);
}
The documentation for this class was generated from the following files: