All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
output.cpp File Reference
#include <string.h>
#include <ctype.h>
#include "helpers.h"
#include "tessvars.h"
#include "control.h"
#include "reject.h"
#include "docqual.h"
#include "output.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 44 of file output.cpp.

#define CTRL_FONT   '\016'

Definition at line 43 of file output.cpp.

#define CTRL_HARDLINE   '\015'

Definition at line 48 of file output.cpp.

#define CTRL_INSET   '\024'

Definition at line 42 of file output.cpp.

#define CTRL_NEWLINE   '\012'

Definition at line 47 of file output.cpp.

#define CTRL_SHIFT   '\022'

Definition at line 45 of file output.cpp.

#define CTRL_TAB   '\011'

Definition at line 46 of file output.cpp.

#define EPAPER_EXT   ".ep"

Definition at line 40 of file output.cpp.

#define PAGE_YSIZE   3508

Definition at line 41 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 247 of file output.cpp.

252  {
253  inT16 end_gap; //to right edge
254  inT16 width; //of next word
255  TBOX word_box; //bounding
256  TBOX next_box; //next word
257  TBOX block_box; //block bounding
258 
259  if (!word->flag (W_EOL))
260  return FALSE; //not end of line
261  if (next_word == NULL || next_block == NULL || block != next_block)
262  return CTRL_NEWLINE;
263  if (next_word->space () > 0)
264  return CTRL_HARDLINE; //it is tabbed
265  word_box = word->bounding_box ();
266  next_box = next_word->bounding_box ();
267  block_box = block->bounding_box ();
268  //gap to eol
269  end_gap = block_box.right () - word_box.right ();
270  end_gap -= (inT32) block->space ();
271  width = next_box.right () - next_box.left ();
272  // tprintf("end_gap=%d-%d=%d, width=%d-%d=%d, nl=%d\n",
273  // block_box.right(),word_box.right(),end_gap,
274  // next_box.right(),next_box.left(),width,
275  // end_gap>width ? CTRL_HARDLINE : CTRL_NEWLINE);
276  return end_gap > width ? CTRL_HARDLINE : CTRL_NEWLINE;
277 }
#define CTRL_NEWLINE
Definition: output.cpp:47
TBOX bounding_box() const
Definition: werd.cpp:160
inT16 right() const
Definition: rect.h:75
Definition: werd.h:36
inT16 left() const
Definition: rect.h:68
void bounding_box(ICOORD &bottom_left, ICOORD &top_right) const
get box
Definition: pdblock.h:67
#define CTRL_HARDLINE
Definition: output.cpp:48
#define FALSE
Definition: capi.h:29
Definition: rect.h:30
uinT8 space()
Definition: werd.h:104
BOOL8 flag(WERD_FLAGS mask) const
Definition: werd.h:128
#define NULL
Definition: host.h:144
inT16 space() const
return spacing
Definition: ocrblock.h:102
short inT16
Definition: host.h:100
int inT32
Definition: host.h:102
inT32 pixels_to_pts ( inT32  pixels,
inT32  pix_res 
)

Definition at line 57 of file output.cpp.

60  {
61  float pts; //converted value
62 
63  pts = pixels * 72.0 / pix_res;
64  return (inT32) (pts + 0.5); //round it
65 }
int inT32
Definition: host.h:102