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);
static void ComputeStats(int col, int row, const AssociateStats *parent_stats, int parent_path_length, bool fixed_pitch, float max_char_wh_ratio, const DENORM *denorm, CHUNKS_RECORD *chunks_record, int debug_level, AssociateStats *stats)
static const float kMinGap
static int GetChunksWidth(WIDTH_RECORD *width_record, int start_blob, int last_blob)
static float FixedPitchWidthCost(float norm_width, float right_gap, bool end_pos, float max_char_wh_ratio)
static int GetChunksGap(WIDTH_RECORD *width_record, int last_chunk)
DLLSYM void tprintf(const char *format,...)
bool bad_fixed_pitch_right_gap
static const float kMaxFixedPitchCharAspectRatio
WIDTH_RECORD * chunk_widths
float full_wh_ratio_total
#define array_value(a, i)