41 static void horizontal_cblob_projection(
C_BLOB *blob,
43 static void horizontal_coutline_projection(
C_OUTLINE *outline,
78 (
"Testing underline on blob at (%d,%d)->(%d,%d), base=%d\nOccs:",
83 horizontal_cblob_projection(blob, &projection);
86 if (occ <= blob_box.
top () && projection.
pile_count (occ) > desc_occ)
90 for (occ = baseline; occ <= baseline + xheight; occ++)
91 if (occ >= blob_box.
bottom () && occ <= blob_box.
top ()
96 for (occ = baseline + xheight + 1; occ <= blob_box.
top (); occ++)
100 tprintf (
"%d %d %d\n", desc_occ, x_occ, asc_occ);
102 if (desc_occ == 0 && x_occ == 0 && asc_occ == 0) {
103 tprintf (
"Bottom=%d, top=%d, base=%d, x=%d\n",
107 if (desc_occ > x_occ + x_occ
110 if (asc_occ > x_occ + x_occ
111 && asc_occ > blob_width * textord_underline_threshold)
124 static void horizontal_cblob_projection(
129 C_OUTLINE_IT out_it = blob->
out_list ();
131 for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
132 horizontal_coutline_projection (out_it.data (), stats);
144 static void horizontal_coutline_projection(
152 C_OUTLINE_IT out_it = outline->
child ();
156 for (stepindex = 0; stepindex < length; stepindex++) {
157 step = outline->
step (stepindex);
159 stats->
add (pos.
y (), pos.
x ());
161 else if (step.
y () < 0) {
162 stats->
add (pos.
y () - 1, -pos.
x ());
167 for (out_it.mark_cycle_pt (); !out_it.cycled_list (); out_it.forward ()) {
168 horizontal_coutline_projection (out_it.data (), stats);
#define double_VAR(name, val, comment)
const ICOORD & start_pos() const
void add(inT32 value, inT32 count)
double textord_underline_threshold
C_OUTLINE_LIST * out_list()
inT16 y() const
access_function
inT16 x() const
access function
bool set_range(inT32 min_bucket_value, inT32 max_bucket_value_plus_1)
TBOX bounding_box() const
inT32 pile_count(inT32 value) const
ICOORD step(int index) const
BOOL8 test_underline(BOOL8 testing_on, C_BLOB *blob, inT16 baseline, inT16 xheight)