Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
output.cpp File Reference
#include "mfcpch.h"
#include <string.h>
#include <ctype.h>
#include "helpers.h"
#include "tfacep.h"
#include "tessvars.h"
#include "control.h"
#include "secname.h"
#include "reject.h"
#include "docqual.h"
#include "output.h"
#include "bestfirst.h"
#include "globals.h"
#include "tesseractclass.h"

Go to the source code of this file.

Namespaces

 tesseract
 

Macros

#define EPAPER_EXT   ".ep"
 
#define PAGE_YSIZE   3508
 
#define CTRL_INSET   '\024'
 
#define CTRL_FONT   '\016'
 
#define CTRL_DEFAULT   '\017'
 
#define CTRL_SHIFT   '\022'
 
#define CTRL_TAB   '\011'
 
#define CTRL_NEWLINE   '\012'
 
#define CTRL_HARDLINE   '\015'
 

Functions

inT32 pixels_to_pts (inT32 pixels, inT32 pix_res)
 
char determine_newline_type (WERD *word, BLOCK *block, WERD *next_word, BLOCK *next_block)
 

Macro Definition Documentation

#define CTRL_DEFAULT   '\017'

Definition at line 48 of file output.cpp.

#define CTRL_FONT   '\016'

Definition at line 47 of file output.cpp.

#define CTRL_HARDLINE   '\015'

Definition at line 52 of file output.cpp.

#define CTRL_INSET   '\024'

Definition at line 46 of file output.cpp.

#define CTRL_NEWLINE   '\012'

Definition at line 51 of file output.cpp.

#define CTRL_SHIFT   '\022'

Definition at line 49 of file output.cpp.

#define CTRL_TAB   '\011'

Definition at line 50 of file output.cpp.

#define EPAPER_EXT   ".ep"

Definition at line 44 of file output.cpp.

#define PAGE_YSIZE   3508

Definition at line 45 of file output.cpp.

Function Documentation

char determine_newline_type ( WERD word,
BLOCK block,
WERD next_word,
BLOCK next_block 
)

test line ends

Parameters
wordword to do
blockcurrent block
next_wordnext word
next_blockblock of next word

Definition at line 311 of file output.cpp.

316  {
317  inT16 end_gap; //to right edge
318  inT16 width; //of next word
319  TBOX word_box; //bounding
320  TBOX next_box; //next word
321  TBOX block_box; //block bounding
322 
323  if (!word->flag (W_EOL))
324  return FALSE; //not end of line
325  if (next_word == NULL || next_block == NULL || block != next_block)
326  return CTRL_NEWLINE;
327  if (next_word->space () > 0)
328  return CTRL_HARDLINE; //it is tabbed
329  word_box = word->bounding_box ();
330  next_box = next_word->bounding_box ();
331  block_box = block->bounding_box ();
332  //gap to eol
333  end_gap = block_box.right () - word_box.right ();
334  end_gap -= (inT32) block->space ();
335  width = next_box.right () - next_box.left ();
336  // tprintf("end_gap=%d-%d=%d, width=%d-%d=%d, nl=%d\n",
337  // block_box.right(),word_box.right(),end_gap,
338  // next_box.right(),next_box.left(),width,
339  // end_gap>width ? CTRL_HARDLINE : CTRL_NEWLINE);
340  return end_gap > width ? CTRL_HARDLINE : CTRL_NEWLINE;
341 }
TBOX bounding_box()
Definition: werd.cpp:164
#define NULL
Definition: host.h:144
#define CTRL_HARDLINE
Definition: output.cpp:52
inT16 left() const
Definition: rect.h:67
uinT8 space()
Definition: werd.h:104
int inT32
Definition: host.h:102
Definition: rect.h:29
#define FALSE
Definition: capi.h:28
inT16 right() const
Definition: rect.h:74
BOOL8 flag(WERD_FLAGS mask) const
Definition: werd.h:122
inT16 space() const
return spacing
Definition: ocrblock.h:103
short inT16
Definition: host.h:100
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
Definition: pdblock.h:70
Definition: werd.h:36
#define CTRL_NEWLINE
Definition: output.cpp:51
inT32 pixels_to_pts ( inT32  pixels,
inT32  pix_res 
)

Definition at line 61 of file output.cpp.

64  {
65  float pts; //converted value
66 
67  pts = pixels * 72.0 / pix_res;
68  return (inT32) (pts + 0.5); //round it
69 }
int inT32
Definition: host.h:102