901 bool fuzzy_sp =
false;
902 bool fuzzy_non =
false;
904 bool prev_gap_was_a_space =
false;
905 bool break_at_next_gap =
false;
907 C_OUTLINE_IT cout_it;
909 C_BLOB_IT cblob_it = &cblobs;
912 int32_t next_rep_char_word_right = INT32_MAX;
913 float repetition_spacing;
921 int16_t prev_gap = INT16_MAX;
922 int16_t current_gap = INT16_MAX;
923 int16_t next_gap = INT16_MAX;
924 int16_t prev_within_xht_gap = INT16_MAX;
925 int16_t current_within_xht_gap = INT16_MAX;
926 int16_t next_within_xht_gap = INT16_MAX;
927 int16_t word_count = 0;
931 if (!rep_char_it.empty ()) {
932 next_rep_char_word_right =
933 rep_char_it.data ()->bounding_box ().right ();
937 cblob_it.set_to_list (&cblobs);
940 WERD_IT word_it(&words);
943 prev_fuzzy_sp =
false;
944 prev_fuzzy_non =
false;
945 if (!box_it.empty ()) {
946 xstarts[0] = box_it.data ()->bounding_box ().left ();
947 if (xstarts[0] > next_rep_char_word_right) {
949 word = rep_char_it.extract ();
950 word_it.add_after_then_move (word);
960 repetition_spacing = find_mean_blob_spacing (word);
961 current_gap = box_it.data ()->bounding_box ().left () -
962 next_rep_char_word_right;
963 current_within_xht_gap = current_gap;
965 prev_blanks =
static_cast<uint8_t
>(floor (current_gap / row->
space_size));
972 tprintf (
"Repch wd at BOL(%d, %d). rep spacing %5.2f; Rgap:%d ",
973 box_it.data ()->bounding_box ().left (),
974 box_it.data ()->bounding_box ().bottom (),
975 repetition_spacing, current_gap);
976 prev_fuzzy_sp =
false;
977 prev_fuzzy_non =
false;
978 if (rep_char_it.empty ()) {
979 next_rep_char_word_right = INT32_MAX;
982 rep_char_it.forward ();
983 next_rep_char_word_right =
984 rep_char_it.data ()->bounding_box ().right ();
988 peek_at_next_gap(row,
992 next_within_xht_gap);
994 bblob = box_it.data ();
997 if (bblob->
cblob () !=
nullptr) {
998 cout_it.set_to_list (cblob_it.data ()->out_list ());
999 cout_it.move_to_last ();
1001 delete bblob->
cblob ();
1004 if (bblob->
cblob() !=
nullptr)
1005 cblob_it.add_after_then_move (bblob->
cblob ());
1006 prev_x = blob_box.
right ();
1009 bblob = box_it.data ();
1014 prev_gap = current_gap;
1015 prev_within_xht_gap = current_within_xht_gap;
1016 prev_blob_box = next_blob_box;
1017 current_gap = next_gap;
1018 current_within_xht_gap = next_within_xht_gap;
1019 peek_at_next_gap(row,
1023 next_within_xht_gap);
1025 int16_t prev_gap_arg = prev_gap;
1026 int16_t next_gap_arg = next_gap;
1028 prev_gap_arg = prev_within_xht_gap;
1029 next_gap_arg = next_within_xht_gap;
1032 if (blob_box.
left () > next_rep_char_word_right ||
1033 make_a_word_break(row, blob_box, prev_gap_arg, prev_blob_box,
1034 current_gap, current_within_xht_gap,
1035 next_blob_box, next_gap_arg,
1036 blanks, fuzzy_sp, fuzzy_non,
1037 prev_gap_was_a_space,
1038 break_at_next_gap) ||
1039 box_it.at_first()) {
1041 word =
new WERD (&cblobs, prev_blanks,
nullptr);
1043 word_it.add_after_then_move (word);
1051 else if (prev_fuzzy_non)
1055 if (blob_box.
left () > next_rep_char_word_right) {
1057 word = rep_char_it.extract ();
1058 word_it.add_after_then_move (word);
1061 repetition_spacing = find_mean_blob_spacing (word);
1063 current_within_xht_gap = current_gap;
1066 static_cast<uint8_t
>(floor (current_gap / row->
space_size));
1074 (
"Repch wd (%d,%d) rep gap %5.2f; Lgap:%d (%d blanks);",
1077 repetition_spacing, current_gap, blanks);
1085 blob_box.
left () - next_rep_char_word_right;
1087 blanks =
static_cast<uint8_t
>(current_gap / row->
space_size);
1094 tprintf (
" Rgap:%d (%d blanks)\n",
1095 current_gap, blanks);
1099 if (rep_char_it.empty ()) {
1100 next_rep_char_word_right = INT32_MAX;
1103 rep_char_it.forward ();
1104 next_rep_char_word_right =
1105 rep_char_it.data ()->bounding_box ().right ();
1109 if (box_it.at_first () && rep_char_it.empty ()) {
1112 xstarts[1] = prev_x;
1115 prev_blanks = blanks;
1116 prev_fuzzy_sp = fuzzy_sp;
1117 prev_fuzzy_non = fuzzy_non;
1122 while (!box_it.at_first ());
1125 while (!rep_char_it.empty ()) {
1126 word = rep_char_it.extract ();
1127 word_it.add_after_then_move (word);
1130 repetition_spacing = find_mean_blob_spacing (word);
1133 blanks =
static_cast<uint8_t
>(floor (current_gap / row->
space_size));
1141 "Repch wd at EOL (%d,%d). rep spacing %5.2f; Lgap:%d (%d blanks)\n",
1143 repetition_spacing, current_gap, blanks);
1149 if (rep_char_it.empty ()) {
1152 xstarts[1] = prev_x;
1155 rep_char_it.forward ();
1158 real_row =
new ROW (row,
1160 word_it.set_to_list (real_row->
word_list ());
1162 word_it.add_list_after (&words);
1166 tprintf (
"Row: Made %d words in row ((%d,%d)(%d,%d))\n",
@ W_FUZZY_NON
fuzzy nonspace
void set_blanks(uint8_t new_blanks)
TBOX bounding_box() const