tesseract  4.00.00dev
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

◆ CTRL_DEFAULT

#define CTRL_DEFAULT   '\017'

Definition at line 44 of file output.cpp.

◆ CTRL_FONT

#define CTRL_FONT   '\016'

Definition at line 43 of file output.cpp.

◆ CTRL_HARDLINE

#define CTRL_HARDLINE   '\015'

Definition at line 48 of file output.cpp.

◆ CTRL_INSET

#define CTRL_INSET   '\024'

Definition at line 42 of file output.cpp.

◆ CTRL_NEWLINE

#define CTRL_NEWLINE   '\012'

Definition at line 47 of file output.cpp.

◆ CTRL_SHIFT

#define CTRL_SHIFT   '\022'

Definition at line 45 of file output.cpp.

◆ CTRL_TAB

#define CTRL_TAB   '\011'

Definition at line 46 of file output.cpp.

◆ EPAPER_EXT

#define EPAPER_EXT   ".ep"

Definition at line 40 of file output.cpp.

◆ PAGE_YSIZE

#define PAGE_YSIZE   3508

Definition at line 41 of file output.cpp.

Function Documentation

◆ determine_newline_type()

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 245 of file output.cpp.

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

◆ pixels_to_pts()

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 }
int32_t inT32
Definition: host.h:38