21 #pragma warning(disable:4244) // Conversion warnings 40 #define EPAPER_EXT ".ep" 41 #define PAGE_YSIZE 3508 42 #define CTRL_INSET '\024' //dc4=text inset 43 #define CTRL_FONT '\016' //so=font change 44 #define CTRL_DEFAULT '\017' //si=default font 45 #define CTRL_SHIFT '\022' //dc2=x shift 46 #define CTRL_TAB '\011' //tab 47 #define CTRL_NEWLINE '\012' //newline 48 #define CTRL_HARDLINE '\015' //cr 63 pts = pixels * 72.0 / pix_res;
64 return (
inT32) (pts + 0.5);
70 const TBOX *target_word_box) {
77 block_of_last_word = NULL;
78 while (page_res_it.
word () != NULL) {
81 if (target_word_box) {
84 (current_word_box.
right() + current_word_box.
left()) / 2,
85 (current_word_box.
bottom() + current_word_box.
top()) / 2);
86 if (!target_word_box->
contains(center_pt)) {
92 block_of_last_word != page_res_it.
block ()) {
93 block_of_last_word = page_res_it.
block ();
112 nextword, nextblock), force_eol);
214 tprintf (
"Dict word: \"%s\": %d\n",
223 word->
reject_map[i].setrej_minimal_rej_accept();
231 word->
reject_map[i].setrej_minimal_rej_accept();
259 if (next_word == NULL || next_block == NULL || block != next_block)
261 if (next_word->
space () > 0)
267 end_gap = block_box.
right () - word_box.
right ();
269 width = next_box.
right () - next_box.
left ();
288 if (i < word->reject_map.length()) {
313 for (i = 0; i < len; i++) {
315 word_res->
reject_map[i].setrej_minimal_rej_accept();
328 for (i = 0; i < len; ++i) {
331 word_res->
reject_map[i].setrej_minimal_rej_accept();
342 for (i = 0; i < len; ++i) {
345 word_res->
reject_map[i].setrej_minimal_rej_accept();
349 for (i = 0; i < len; i++) {
352 word_res->
reject_map[i].setrej_minimal_rej_accept();
354 word_res->
reject_map[i].setrej_minimal_rej_accept();
356 word_res->
reject_map[i].setrej_minimal_rej_accept();
365 for (i = 0; i < len; i++) {
369 word_res->
reject_map[i].setrej_minimal_rej_accept();
373 word_res->
reject_map[i].setrej_minimal_rej_accept();
385 for (i = 0; i < len; i++) {
391 word_res->
reject_map[i].setrej_minimal_rej_accept();
400 for (
int i = 0; i < word.
length(); ++i) {
410 for (
int i = 0; i < word.
length(); ++i) {
420 const char *lengths) {
423 if (*lengths == 1 && *s ==
'(')
427 ((*s ==
'$') || (*s ==
'.') || (*s ==
'+') || (*s ==
'-')))
430 for (; *s !=
'\0'; s += *(lengths++)) {
433 else if (prev_digit &&
434 (*lengths == 1 && ((*s ==
'.') || (*s ==
',') || (*s ==
'-'))))
436 else if (prev_digit && *lengths == 1 &&
437 (*(s + *lengths) ==
'\0') && ((*s ==
'%') || (*s ==
')')))
439 else if (prev_digit &&
440 *lengths == 1 && (*s ==
'%') &&
441 (*(lengths + 1) == 1 && *(s + *lengths) ==
')') &&
442 (*(s + *lengths + *(lengths + 1)) ==
'\0'))
WERD_RES * next_word() const
CRUNCH_MODE unlv_crunch_mode
bool eq(UNICHAR_ID unichar_id, const char *const unichar_repr) const
double suspect_accept_rating
bool get_isalpha(UNICHAR_ID unichar_id) const
const STRING & unichar_string() const
bool suspect_constrain_1Il
UNICHAR_ID unichar_id(int index) const
void MergeAdjacentBlobs(int index)
UNICHAR_ID get_rep_char(WERD_RES *word)
bool tilde_crunch_written
bool tessedit_zero_rejection
bool tessedit_word_for_word
ACCEPTABLE_WERD_TYPE acceptable_word_string(const UNICHARSET &char_set, const char *s, const char *lengths)
WERD_RES * restart_page()
bool tessedit_minimal_rejection
WERD_CHOICE * best_choice
inT16 count_alphanums(const WERD_CHOICE &word)
bool tessedit_write_block_separators
const UNICHARSET * unicharset() const
inT16 count_alphas(const WERD_CHOICE &word)
const char * string() const
BOOL8 acceptable_number_string(const char *s, const char *lengths)
inT32 pixels_to_pts(inT32 pixels, inT32 pix_res)
bool contains(const FCOORD pt) const
BOOL8 flag(WERD_FLAGS mask) const
bool write_results_empty_block
bool tessedit_rejection_debug
bool last_char_was_newline
BLOCK_RES * block() const
double suspect_rating_per_ch
UNICHAR_ID TESS_API unichar_to_id(const char *const unichar_repr) const
bool unlv_tilde_crunching
void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box)
const UNICHARSET * uch_set
int dict_word(const WERD_CHOICE &word)
void write_results(PAGE_RES_IT &page_res_it, char newline_type, BOOL8 force_eol)
bool tessedit_write_rep_codes
inT16 safe_dict_word(const WERD_RES *werd_res)
const STRING & unichar_lengths() const
bool get_isdigit(UNICHAR_ID unichar_id) const
inT16 space() const
return spacing
BOOL8 check_debug_pt(WERD_RES *word, int location)
bool tessedit_zero_kelvin_rejection
const STRING debug_string() const
void set_unlv_suspects(WERD_RES *word)
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
TBOX bounding_box() const
BLOCK_RES * next_block() const
char determine_newline_type(WERD *word, BLOCK *block, WERD *next_word, BLOCK *next_block)