39 ICOORDELT_LIST chop_cells;
41 BLOBNBOX_LIST residual_underlines;
42 C_OUTLINE_LIST left_coutlines;
43 C_OUTLINE_LIST right_coutlines;
44 ICOORDELT_IT cell_it = &chop_cells;
47 BLOBNBOX_IT ru_it = &residual_underlines;
52 for (under_it.mark_cycle_pt(); !under_it.cycled_list(); under_it.forward()) {
53 u_line = under_it.extract();
61 cell_it.set_to_list(&chop_cells);
62 for (cell_it.mark_cycle_pt(); !cell_it.cycled_list(); cell_it.forward()) {
63 chop_coord = cell_it.data()->x();
67 if (!left_coutlines.empty()) {
68 ru_it.add_after_then_move(
new BLOBNBOX(
new C_BLOB(&left_coutlines)));
70 chop_coord = cell_it.data()->y();
73 if (!left_coutlines.empty()) {
78 delete cell_it.extract();
80 if (!right_coutlines.empty()) {
83 if (!left_coutlines.empty()) {
84 ru_it.add_after_then_move(
new BLOBNBOX(
new C_BLOB(&left_coutlines)));
90 ru_it.move_to_first();
91 for (ru_it.mark_cycle_pt(); !ru_it.cycled_list(); ru_it.forward()) {
92 under_it.add_after_then_move(ru_it.extract());
108 TO_ROW_IT row_it = rows;
115 bestover =
static_cast<float>(-INT32_MAX);
116 if (row_it.empty()) {
120 row_it.mark_cycle_pt();
128 !row_it.cycled_list()) {
138 if (overlap > bestover) {
162 float baseline_offset,
163 ICOORDELT_LIST *chop_cells
168 ICOORDELT_IT cell_it = chop_cells;
177 for (out_it.mark_cycle_pt(); !out_it.cycled_list(); out_it.forward()) {
179 &middle_proj, &upper_proj);
182 for (
auto x = blob_box.
left();
x < blob_box.
right();
x++) {
189 cell_it.add_after_then_move(
new ICOORDELT(blob_chop));
206 float baseline_offset,
213 int16_t lower_y, upper_y;
216 C_OUTLINE_IT out_it = outline->
child();
220 for (stepindex = 0; stepindex < length; stepindex++) {
221 step = outline->
step(stepindex);
223 lower_y =
static_cast<int16_t
>(floor(
baseline->y(pos.
x()) + baseline_offset + 0.5));
224 upper_y =
static_cast<int16_t
>(floor(
baseline->y(pos.
x()) + baseline_offset + xheight + 0.5));
225 if (pos.
y() >= lower_y) {
226 lower_proj->
add(pos.
x(), -lower_y);
227 if (pos.
y() >= upper_y) {
228 middle_proj->
add(pos.
x(), lower_y - upper_y);
229 upper_proj->
add(pos.
x(), upper_y - pos.
y());
231 middle_proj->
add(pos.
x(), lower_y - pos.
y());
234 lower_proj->
add(pos.
x(), -pos.
y());
236 }
else if (step.
x() < 0) {
237 lower_y =
static_cast<int16_t
>(floor(
baseline->y(pos.
x() - 1) + baseline_offset + 0.5));
239 static_cast<int16_t
>(floor(
baseline->y(pos.
x() - 1) + baseline_offset + xheight + 0.5));
240 if (pos.
y() >= lower_y) {
241 lower_proj->
add(pos.
x() - 1, lower_y);
242 if (pos.
y() >= upper_y) {
243 middle_proj->
add(pos.
x() - 1, upper_y - lower_y);
244 upper_proj->
add(pos.
x() - 1, pos.
y() - upper_y);
246 middle_proj->
add(pos.
x() - 1, pos.
y() - lower_y);
249 lower_proj->
add(pos.
x() - 1, pos.
y());
255 for (out_it.mark_cycle_pt(); !out_it.cycled_list(); out_it.forward()) {
257 middle_proj, upper_proj);
#define BOOL_VAR(name, val, comment)
#define double_VAR(name, val, comment)
int textord_fp_chop_error
void split_to_blob(BLOBNBOX *blob, int16_t chop_coord, float pitch_error, C_OUTLINE_LIST *left_coutlines, C_OUTLINE_LIST *right_coutlines)
bool textord_restore_underlines
void restore_underlined_blobs(TO_BLOCK *block)
double textord_underline_offset
void vertical_cunderline_projection(C_OUTLINE *outline, QSPLINE *baseline, float xheight, float baseline_offset, STATS *lower_proj, STATS *middle_proj, STATS *upper_proj)
OVERLAP_STATE most_overlapping_row(TO_ROW_IT *row_it, TO_ROW *&best_row, float top, float bottom, float rowsize, bool testing_blob)
void find_underlined_blobs(BLOBNBOX *u_line, QSPLINE *baseline, float xheight, float baseline_offset, ICOORDELT_LIST *chop_cells)
const TBOX & bounding_box() const
void insert_blob(BLOBNBOX *blob)
int32_t pathlength() const
ICOORD step(int index) const
const ICOORD & start_pos() const
TDimension y() const
access_function
TDimension x() const
access function
TDimension bottom() const
void add(int32_t value, int32_t count)
int32_t pile_count(int32_t value) const
C_OUTLINE_LIST * out_list()