39 int parent_path_length,
41 float max_char_wh_ratio,
48 if (debug_level > 0) {
49 tprintf(
"AssociateUtils::ComputeStats() for col=%d, row=%d%s\n",
50 col, row, fixed_pitch ?
" (fixed pitch)" :
"");
54 if (fixed_pitch && denorm !=
NULL && denorm->
row() !=
NULL) {
61 normalizing_height = denorm->
y_scale() *
64 if (debug_level > 0) {
65 tprintf(
"normalizing height = %g (scale %g xheight %g ascenders %g)\n",
72 if (debug_level)
tprintf(
"wh_ratio %g\n", wh_ratio);
73 if (wh_ratio > max_char_wh_ratio) stats->
bad_shape =
true;
92 float right_gap = 0.0f;
99 tprintf(
"right_gap %g right_seam %g\n",
102 if (right_gap < kMinGap || right_seam->priority > 0.0
f) {
114 if (parent_stats !=
NULL) {
125 tprintf(
"full_wh_ratio %g full_wh_ratio_total %g full_wh_ratio_var %g\n",
136 if (col == 0 && end_row && wh_ratio > max_char_wh_ratio) {
145 int start_blob,
int last_blob) {
147 for (
int x = start_blob * 2; x <= last_blob * 2; x++)
148 result += width_record->
widths[x];
155 float max_char_wh_ratio) {
157 if (norm_width > max_char_wh_ratio) cost += norm_width;
159 cost += norm_width * norm_width;
161 if (norm_width+right_gap < 0.5
f && !end_pos) {
162 cost += 1.0f - (norm_width + right_gap);