32 #define EPAPER_EXT ".ep" 33 #define PAGE_YSIZE 3508 34 #define CTRL_INSET '\024' //dc4=text inset 35 #define CTRL_FONT '\016' //so=font change 36 #define CTRL_DEFAULT '\017' //si=default font 37 #define CTRL_SHIFT '\022' //dc2=x shift 38 #define CTRL_TAB '\011' //tab 39 #define CTRL_NEWLINE '\012' //newline 40 #define CTRL_HARDLINE '\015' //cr 45 const TBOX *target_word_box) {
52 block_of_last_word =
nullptr;
53 while (page_res_it.
word () !=
nullptr) {
56 if (target_word_box) {
59 (current_word_box.
right() + current_word_box.
left()) / 2,
60 (current_word_box.
bottom() + current_word_box.
top()) / 2);
61 if (!target_word_box->
contains(center_pt)) {
67 block_of_last_word != page_res_it.
block ()) {
68 block_of_last_word = page_res_it.
block ();
87 nextword, nextblock), force_eol);
111 bool need_reject =
false;
189 tprintf (
"Dict word: \"%s\": %d\n",
198 word->
reject_map[i].setrej_minimal_rej_accept();
206 word->
reject_map[i].setrej_minimal_rej_accept();
234 if (next_word ==
nullptr || next_block ==
nullptr || block != next_block)
236 if (next_word->
space () > 0)
242 end_gap = block_box.
right () - word_box.
right ();
243 end_gap -= (int32_t) block->
space ();
244 width = next_box.
right () - next_box.
left ();
263 if (i < word->reject_map.length()) {
288 for (i = 0; i < len; i++) {
290 word_res->
reject_map[i].setrej_minimal_rej_accept();
303 for (i = 0; i < len; ++i) {
306 word_res->
reject_map[i].setrej_minimal_rej_accept();
317 for (i = 0; i < len; ++i) {
320 word_res->
reject_map[i].setrej_minimal_rej_accept();
324 for (i = 0; i < len; i++) {
327 word_res->
reject_map[i].setrej_minimal_rej_accept();
329 word_res->
reject_map[i].setrej_minimal_rej_accept();
331 word_res->
reject_map[i].setrej_minimal_rej_accept();
340 for (i = 0; i < len; i++) {
344 word_res->
reject_map[i].setrej_minimal_rej_accept();
348 word_res->
reject_map[i].setrej_minimal_rej_accept();
360 for (i = 0; i < len; i++) {
366 word_res->
reject_map[i].setrej_minimal_rej_accept();
375 for (
int i = 0; i < word.
length(); ++i) {
385 for (
int i = 0; i < word.
length(); ++i) {
395 const char* lengths) {
396 bool prev_digit =
false;
398 if (*lengths == 1 && *s ==
'(')
402 ((*s ==
'$') || (*s ==
'.') || (*s ==
'+') || (*s ==
'-')))
405 for (; *s !=
'\0'; s += *(lengths++)) {
408 else if (prev_digit &&
409 (*lengths == 1 && ((*s ==
'.') || (*s ==
',') || (*s ==
'-'))))
411 else if (prev_digit && *lengths == 1 &&
412 (*(s + *lengths) ==
'\0') && ((*s ==
'%') || (*s ==
')')))
414 else if (prev_digit &&
415 *lengths == 1 && (*s ==
'%') &&
416 (*(lengths + 1) == 1 && *(s + *lengths) ==
')') &&
417 (*(s + *lengths + *(lengths + 1)) ==
'\0'))
void set_unlv_suspects(WERD_RES *word)
int16_t space() const
return spacing
BLOCK_RES * block() const
bool acceptable_number_string(const char *s, const char *lengths)
void MergeAdjacentBlobs(int index)
bool tessedit_minimal_rejection
bool tessedit_zero_kelvin_rejection
int dict_word(const WERD_CHOICE &word)
bool tessedit_rejection_debug
bool eq(UNICHAR_ID unichar_id, const char *const unichar_repr) const
bool write_results_empty_block
const char * string() const
TBOX bounding_box() const
const UNICHARSET * unicharset() const
bool suspect_constrain_1Il
bool tessedit_word_for_word
BLOCK_RES * next_block() const
int16_t count_alphas(const WERD_CHOICE &word)
bool tessedit_zero_rejection
UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
double suspect_accept_rating
bool get_isalpha(UNICHAR_ID unichar_id) const
void write_results(PAGE_RES_IT &page_res_it, char newline_type, bool force_eol)
char determine_newline_type(WERD *word, BLOCK *block, WERD *next_word, BLOCK *next_block)
WERD_RES * restart_page()
bool flag(WERD_FLAGS mask) const
const STRING & unichar_lengths() const
bool unlv_tilde_crunching
bool get_isdigit(UNICHAR_ID unichar_id) const
bool tessedit_write_block_separators
CRUNCH_MODE unlv_crunch_mode
int16_t safe_dict_word(const WERD_RES *werd_res)
WERD_RES * next_word() const
bool last_char_was_newline
double suspect_rating_per_ch
UNICHAR_ID unichar_id(int index) const
DLLSYM void tprintf(const char *format,...)
UNICHAR_ID get_rep_char(WERD_RES *word)
ACCEPTABLE_WERD_TYPE acceptable_word_string(const UNICHARSET &char_set, const char *s, const char *lengths)
const STRING debug_string() const
bool contains(const FCOORD pt) const
const UNICHARSET * uch_set
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
const STRING & unichar_string() const
bool check_debug_pt(WERD_RES *word, int location)
int16_t count_alphanums(const WERD_CHOICE &word)
bool tessedit_write_rep_codes
WERD_CHOICE * best_choice
bool tilde_crunch_written
void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box)