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) {
85 FCOORD center_pt((current_word_box.
right()+current_word_box.
left())/2,(current_word_box.
bottom()+current_word_box.
top())/2);
86 if (!target_word_box->
contains(center_pt))
94 block_of_last_word != page_res_it.
block ()) {
95 block_of_last_word = page_res_it.
block ();
114 nextword, nextblock), force_eol);
216 tprintf (
"Dict word: \"%s\": %d\n",
225 word->
reject_map[i].setrej_minimal_rej_accept();
233 word->
reject_map[i].setrej_minimal_rej_accept();
261 if (next_word ==
NULL || next_block ==
NULL || block != next_block)
263 if (next_word->
space () > 0)
269 end_gap = block_box.
right () - word_box.
right ();
271 width = next_box.
right () - next_box.
left ();
290 if (i < word->reject_map.length()) {
315 for (i = 0; i < len; i++) {
317 word_res->
reject_map[i].setrej_minimal_rej_accept();
330 for (i = 0; i < len; ++i) {
333 word_res->
reject_map[i].setrej_minimal_rej_accept();
344 for (i = 0; i < len; ++i) {
347 word_res->
reject_map[i].setrej_minimal_rej_accept();
351 for (i = 0; i < len; i++) {
354 word_res->
reject_map[i].setrej_minimal_rej_accept();
356 word_res->
reject_map[i].setrej_minimal_rej_accept();
358 word_res->
reject_map[i].setrej_minimal_rej_accept();
367 for (i = 0; i < len; i++) {
371 word_res->
reject_map[i].setrej_minimal_rej_accept();
375 word_res->
reject_map[i].setrej_minimal_rej_accept();
387 for (i = 0; i < len; i++) {
393 word_res->
reject_map[i].setrej_minimal_rej_accept();
402 for (
int i = 0; i < word.
length(); ++i) {
412 for (
int i = 0; i < word.
length(); ++i) {
422 const char *lengths) {
425 if (*lengths == 1 && *s ==
'(')
429 ((*s ==
'$') || (*s ==
'.') || (*s ==
'+') || (*s ==
'-')))
432 for (; *s !=
'\0'; s += *(lengths++)) {
435 else if (prev_digit &&
436 (*lengths == 1 && ((*s ==
'.') || (*s ==
',') || (*s ==
'-'))))
438 else if (prev_digit && *lengths == 1 &&
439 (*(s + *lengths) ==
'\0') && ((*s ==
'%') || (*s ==
')')))
441 else if (prev_digit &&
442 *lengths == 1 && (*s ==
'%') &&
443 (*(lengths + 1) == 1 && *(s + *lengths) ==
')') &&
444 (*(s + *lengths + *(lengths + 1)) ==
'\0'))
inT16 count_alphas(const WERD_CHOICE &word)
const UNICHAR_ID unichar_to_id(const char *const unichar_repr) const
char determine_newline_type(WERD *word, BLOCK *block, WERD *next_word, BLOCK *next_block)
inT32 pixels_to_pts(inT32 pixels, inT32 pix_res)
bool eq(UNICHAR_ID unichar_id, const char *const unichar_repr) const
WERD_CHOICE * best_choice
bool tessedit_zero_kelvin_rejection
void output_pass(PAGE_RES_IT &page_res_it, const TBOX *target_word_box)
const STRING & unichar_lengths() const
TBOX bounding_box() const
bool tessedit_word_for_word
int dict_word(const WERD_CHOICE &word)
bool tessedit_rejection_debug
inT16 safe_dict_word(const WERD_RES *werd_res)
void write_results(PAGE_RES_IT &page_res_it, char newline_type, BOOL8 force_eol)
double suspect_accept_rating
inT16 count_alphanums(const WERD_CHOICE &word)
const STRING & unichar_string() const
BLOCK_RES * block() const
const UNICHARSET * unicharset() const
bool get_isdigit(UNICHAR_ID unichar_id) const
bool tessedit_zero_rejection
WERD_RES * restart_page()
BOOL8 acceptable_number_string(const char *s, const char *lengths)
BOOL8 check_debug_pt(WERD_RES *word, int location)
const UNICHAR_ID unichar_id(int index) const
const UNICHARSET * uch_set
bool unlv_tilde_crunching
const STRING debug_string() const
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
UNICHAR_ID get_rep_char(WERD_RES *word)
bool write_results_empty_block
ACCEPTABLE_WERD_TYPE acceptable_word_string(const UNICHARSET &char_set, const char *s, const char *lengths)
BLOCK_RES * next_block() const
void set_unlv_suspects(WERD_RES *word)
bool get_isalpha(UNICHAR_ID unichar_id) const
bool tilde_crunch_written
double suspect_rating_per_ch
bool suspect_constrain_1Il
WERD_RES * next_word() const
void MergeAdjacentBlobs(int index)
BOOL8 flag(WERD_FLAGS mask) const
bool tessedit_write_rep_codes
bool contains(const FCOORD pt) const
CRUNCH_MODE unlv_crunch_mode
bool tessedit_write_block_separators
bool last_char_was_newline
bool tessedit_minimal_rejection
inT16 space() const
return spacing
const char * string() const