21 #pragma warning(disable:4244) // Conversion warnings
44 #define EPAPER_EXT ".ep"
45 #define PAGE_YSIZE 3508
46 #define CTRL_INSET '\024' //dc4=text inset
47 #define CTRL_FONT '\016' //so=font change
48 #define CTRL_DEFAULT '\017' //si=default font
49 #define CTRL_SHIFT '\022' //dc2=x shift
50 #define CTRL_TAB '\011' //tab
51 #define CTRL_NEWLINE '\012' //newline
52 #define CTRL_HARDLINE '\015' //cr
67 pts = pixels * 72.0 / pix_res;
68 return (
inT32) (pts + 0.5);
74 const TBOX *target_word_box) {
82 block_of_last_word =
NULL;
83 while (page_res_it.
word () !=
NULL) {
90 FCOORD center_pt((current_word_box.
right()+current_word_box.
left())/2,(current_word_box.
bottom()+current_word_box.
top())/2);
91 if (!target_word_box->
contains(center_pt))
99 block_of_last_word != page_res_it.
block ()) {
100 block_of_last_word = page_res_it.
block ();
101 block_id = block_of_last_word->
block->
index();
120 nextword, nextblock), force_eol);
149 int ep_chars_index = 0;
169 txt_chs[txt_index] =
' ';
170 map_chs[txt_index++] =
'1';
171 ep_chars[ep_chars_index++] =
' ';
180 txt_chs[txt_index] = unrecognised;
182 map_chs[txt_index++] =
'1';
183 ep_chars[ep_chars_index++] = unrecognised;
186 map_chs[txt_index++] =
'0';
193 ep_chars[ep_chars_index++] = 1;
195 ep_chars[ep_chars_index++] = 1;
197 ep_chars[ep_chars_index++] = 2;
199 ep_chars[ep_chars_index++] = 1;
201 ep_chars[ep_chars_index++] = 1;
210 txt_chs[txt_index] =
'\n';
211 map_chs[txt_index++] =
'\n';
213 ep_chars[ep_chars_index++] = newline_type;
220 txt_chs[txt_index] =
'\0';
221 map_chs[txt_index] =
'\0';
222 ep_chars[ep_chars_index] =
'\0';
249 if (!blob_choices_it.empty())
delete blob_choices_it.extract();
274 tprintf (
"Dict word: \"%s\": %d\n",
279 repetition_code =
"|^~R";
280 wordstr_lengths =
"\001\001\001\001";
283 wordstr = &repetition_code;
289 word->
reject_map[i].setrej_minimal_rej_accept();
297 word->
reject_map[i].setrej_minimal_rej_accept();
325 if (next_word ==
NULL || next_block ==
NULL || block != next_block)
327 if (next_word->
space () > 0)
333 end_gap = block_box.
right () - word_box.
right ();
335 width = next_box.
right () - next_box.
left ();
354 if (i < word->reject_map.length()) {
379 for (i = 0; i < len; i++) {
381 word_res->
reject_map[i].setrej_minimal_rej_accept();
394 for (i = 0; i < len; ++i) {
397 word_res->
reject_map[i].setrej_minimal_rej_accept();
408 for (i = 0; i < len; ++i) {
411 word_res->
reject_map[i].setrej_minimal_rej_accept();
415 for (i = 0; i < len; i++) {
418 word_res->
reject_map[i].setrej_minimal_rej_accept();
420 word_res->
reject_map[i].setrej_minimal_rej_accept();
422 word_res->
reject_map[i].setrej_minimal_rej_accept();
431 for (i = 0; i < len; i++) {
435 word_res->
reject_map[i].setrej_minimal_rej_accept();
439 word_res->
reject_map[i].setrej_minimal_rej_accept();
451 for (i = 0; i < len; i++) {
457 word_res->
reject_map[i].setrej_minimal_rej_accept();
466 for (
int i = 0; i < word.
length(); ++i) {
476 for (
int i = 0; i < word.
length(); ++i) {
486 const char *lengths) {
489 if (*lengths == 1 && *s ==
'(')
493 ((*s ==
'$') || (*s ==
'.') || (*s ==
'+') || (*s ==
'-')))
496 for (; *s !=
'\0'; s += *(lengths++)) {
499 else if (prev_digit &&
500 (*lengths == 1 && ((*s ==
'.') || (*s ==
',') || (*s ==
'-'))))
502 else if (prev_digit && *lengths == 1 &&
503 (*(s + *lengths) ==
'\0') && ((*s ==
'%') || (*s ==
')')))
505 else if (prev_digit &&
506 *lengths == 1 && (*s ==
'%') &&
507 (*(lengths + 1) == 1 && *(s + *lengths) ==
')') &&
508 (*(s + *lengths + *(lengths + 1)) ==
'\0'))