{
stats->Clear();
if (debug_level > 0) {
tprintf(
"AssociateUtils::ComputeStats() for col=%d, row=%d%s\n",
col, row, fixed_pitch ? " (fixed pitch)" : "");
}
if (fixed_pitch && denorm !=
NULL && denorm->
row() !=
NULL) {
} else {
normalizing_height = denorm->
y_scale() *
}
if (debug_level > 0) {
tprintf(
"normalizing height = %g (scale %g xheight %g ascenders %g)\n",
}
}
float wh_ratio =
if (debug_level)
tprintf(
"wh_ratio %g\n", wh_ratio);
if (wh_ratio > max_char_wh_ratio) stats->bad_shape = true;
if (fixed_pitch) {
if (col > 0) {
float left_gap =
if (debug_level) {
}
stats->bad_shape = true;
}
}
float right_gap = 0.0f;
if (!end_row) {
right_gap =
if (debug_level) {
tprintf(
"right_gap %g right_seam %g\n",
}
if (right_gap < kMinGap || right_seam->priority > 0.0
f) {
stats->bad_shape = true;
if (right_gap <
kMinGap) stats->bad_fixed_pitch_right_gap =
true;
}
}
stats->full_wh_ratio = wh_ratio + right_gap;
if (parent_stats !=
NULL) {
stats->full_wh_ratio_total =
(parent_stats->full_wh_ratio_total + stats->full_wh_ratio);
float mean =
stats->full_wh_ratio_total / static_cast<float>(parent_path_length+1);
stats->full_wh_ratio_var =
parent_stats->full_wh_ratio_var + pow(mean-stats->full_wh_ratio, 2);
} else {
stats->full_wh_ratio_total = stats->full_wh_ratio;
}
if (debug_level) {
tprintf(
"full_wh_ratio %g full_wh_ratio_total %g full_wh_ratio_var %g\n",
stats->full_wh_ratio, stats->full_wh_ratio_total,
stats->full_wh_ratio_var);
}
stats->shape_cost =
if (col == 0 && end_row && wh_ratio > max_char_wh_ratio) {
stats->shape_cost += 10;
}
stats->shape_cost += stats->full_wh_ratio_var;
if (debug_level)
tprintf(
"shape_cost %g\n", stats->shape_cost);
}
}