902 bool fuzzy_sp =
false;
903 bool fuzzy_non =
false;
905 bool prev_gap_was_a_space =
false;
906 bool break_at_next_gap =
false;
908 C_OUTLINE_IT cout_it;
910 C_BLOB_IT cblob_it = &cblobs;
913 int32_t next_rep_char_word_right = INT32_MAX;
914 float repetition_spacing;
922 int16_t prev_gap = INT16_MAX;
923 int16_t current_gap = INT16_MAX;
924 int16_t next_gap = INT16_MAX;
925 int16_t prev_within_xht_gap = INT16_MAX;
926 int16_t current_within_xht_gap = INT16_MAX;
927 int16_t next_within_xht_gap = INT16_MAX;
928 int16_t word_count = 0;
932 if (!rep_char_it.empty ()) {
933 next_rep_char_word_right =
934 rep_char_it.data ()->bounding_box ().right ();
938 cblob_it.set_to_list (&cblobs);
941 WERD_IT word_it(&words);
944 prev_fuzzy_sp =
false;
945 prev_fuzzy_non =
false;
946 if (!box_it.empty ()) {
947 xstarts[0] = box_it.data ()->bounding_box ().left ();
948 if (xstarts[0] > next_rep_char_word_right) {
950 word = rep_char_it.extract ();
951 word_it.add_after_then_move (word);
961 repetition_spacing = find_mean_blob_spacing (word);
962 current_gap = box_it.data ()->bounding_box ().left () -
963 next_rep_char_word_right;
964 current_within_xht_gap = current_gap;
966 prev_blanks = (uint8_t) floor (current_gap / row->
space_size);
973 tprintf (
"Repch wd at BOL(%d, %d). rep spacing %5.2f; Rgap:%d ",
974 box_it.data ()->bounding_box ().left (),
975 box_it.data ()->bounding_box ().bottom (),
976 repetition_spacing, current_gap);
977 prev_fuzzy_sp =
false;
978 prev_fuzzy_non =
false;
979 if (rep_char_it.empty ()) {
980 next_rep_char_word_right = INT32_MAX;
983 rep_char_it.forward ();
984 next_rep_char_word_right =
985 rep_char_it.data ()->bounding_box ().right ();
989 peek_at_next_gap(row,
993 next_within_xht_gap);
995 bblob = box_it.data ();
998 if (bblob->
cblob () !=
nullptr) {
999 cout_it.set_to_list (cblob_it.data ()->out_list ());
1000 cout_it.move_to_last ();
1002 delete bblob->
cblob ();
1005 if (bblob->
cblob() !=
nullptr)
1006 cblob_it.add_after_then_move (bblob->
cblob ());
1007 prev_x = blob_box.
right ();
1010 bblob = box_it.data ();
1015 prev_gap = current_gap;
1016 prev_within_xht_gap = current_within_xht_gap;
1017 prev_blob_box = next_blob_box;
1018 current_gap = next_gap;
1019 current_within_xht_gap = next_within_xht_gap;
1020 peek_at_next_gap(row,
1024 next_within_xht_gap);
1026 int16_t prev_gap_arg = prev_gap;
1027 int16_t next_gap_arg = next_gap;
1029 prev_gap_arg = prev_within_xht_gap;
1030 next_gap_arg = next_within_xht_gap;
1033 if (blob_box.
left () > next_rep_char_word_right ||
1034 make_a_word_break(row, blob_box, prev_gap_arg, prev_blob_box,
1035 current_gap, current_within_xht_gap,
1036 next_blob_box, next_gap_arg,
1037 blanks, fuzzy_sp, fuzzy_non,
1038 prev_gap_was_a_space,
1039 break_at_next_gap) ||
1040 box_it.at_first()) {
1042 word =
new WERD (&cblobs, prev_blanks,
nullptr);
1044 word_it.add_after_then_move (word);
1052 else if (prev_fuzzy_non)
1056 if (blob_box.
left () > next_rep_char_word_right) {
1058 word = rep_char_it.extract ();
1059 word_it.add_after_then_move (word);
1062 repetition_spacing = find_mean_blob_spacing (word);
1064 current_within_xht_gap = current_gap;
1067 (uint8_t) floor (current_gap / row->
space_size);
1075 (
"Repch wd (%d,%d) rep gap %5.2f; Lgap:%d (%d blanks);",
1078 repetition_spacing, current_gap, blanks);
1086 blob_box.
left () - next_rep_char_word_right;
1088 blanks = (uint8_t) (current_gap / row->
space_size);
1095 tprintf (
" Rgap:%d (%d blanks)\n",
1096 current_gap, blanks);
1100 if (rep_char_it.empty ()) {
1101 next_rep_char_word_right = INT32_MAX;
1104 rep_char_it.forward ();
1105 next_rep_char_word_right =
1106 rep_char_it.data ()->bounding_box ().right ();
1110 if (box_it.at_first () && rep_char_it.empty ()) {
1113 xstarts[1] = prev_x;
1116 prev_blanks = blanks;
1117 prev_fuzzy_sp = fuzzy_sp;
1118 prev_fuzzy_non = fuzzy_non;
1123 while (!box_it.at_first ());
1126 while (!rep_char_it.empty ()) {
1127 word = rep_char_it.extract ();
1128 word_it.add_after_then_move (word);
1131 repetition_spacing = find_mean_blob_spacing (word);
1134 blanks = (uint8_t) floor (current_gap / row->
space_size);
1142 "Repch wd at EOL (%d,%d). rep spacing %5.2f; Lgap:%d (%d blanks)\n",
1144 repetition_spacing, current_gap, blanks);
1150 if (rep_char_it.empty ()) {
1153 xstarts[1] = prev_x;
1156 rep_char_it.forward ();
1159 real_row =
new ROW (row,
1161 word_it.set_to_list (real_row->
word_list ());
1163 word_it.add_list_after (&words);
1167 tprintf (
"Row: Made %d words in row ((%d,%d)(%d,%d))\n",
TBOX bounding_box() const
void set_flag(WERD_FLAGS mask, bool value)
bool joined_to_prev() const
void set_blanks(uint8_t new_blanks)
bool tosp_only_use_xht_gaps
TBOX bounding_box() const
DLLSYM void tprintf(const char *format,...)
void recalc_bounding_box()
C_OUTLINE_LIST * out_list()
const TBOX & bounding_box() const
BLOBNBOX_LIST * blob_list()