Tesseract  3.02
tesseract-ocr/ccmain/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

namespace  tesseract

Defines

#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)

Define 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.

                             {
  inT16 end_gap;                 //to right edge
  inT16 width;                   //of next word
  TBOX word_box;                  //bounding
  TBOX next_box;                  //next word
  TBOX block_box;                 //block bounding

  if (!word->flag (W_EOL))
    return FALSE;                //not end of line
  if (next_word == NULL || next_block == NULL || block != next_block)
    return CTRL_NEWLINE;
  if (next_word->space () > 0)
    return CTRL_HARDLINE;        //it is tabbed
  word_box = word->bounding_box ();
  next_box = next_word->bounding_box ();
  block_box = block->bounding_box ();
                                 //gap to eol
  end_gap = block_box.right () - word_box.right ();
  end_gap -= (inT32) block->space ();
  width = next_box.right () - next_box.left ();
  //      tprintf("end_gap=%d-%d=%d, width=%d-%d=%d, nl=%d\n",
  //              block_box.right(),word_box.right(),end_gap,
  //              next_box.right(),next_box.left(),width,
  //              end_gap>width ? CTRL_HARDLINE : CTRL_NEWLINE);
  return end_gap > width ? CTRL_HARDLINE : CTRL_NEWLINE;
}
inT32 pixels_to_pts ( inT32  pixels,
inT32  pix_res 
)

Definition at line 61 of file output.cpp.

                     {
  float pts;                     //converted value

  pts = pixels * 72.0 / pix_res;
  return (inT32) (pts + 0.5);    //round it
}