tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
tesseract::StringRenderer Class Reference

#include <stringrenderer.h>

Collaboration diagram for tesseract::StringRenderer:

Public Member Functions

 StringRenderer (const std::string &font_desc, int page_width, int page_height)
 
 ~StringRenderer ()
 
int RenderToImage (const char *text, int text_length, Pix **pix)
 
int RenderToGrayscaleImage (const char *text, int text_length, Pix **pix)
 
int RenderToBinaryImage (const char *text, int text_length, int threshold, Pix **pix)
 
int RenderAllFontsToImage (double min_coverage, const char *text, int text_length, std::string *font_used, Pix **pix)
 
bool set_font (const std::string &desc)
 
void set_char_spacing (int char_spacing)
 
void set_leading (int leading)
 
void set_resolution (const int resolution)
 
void set_vertical_text (bool vertical_text)
 
void set_gravity_hint_strong (bool gravity_hint_strong)
 
void set_render_fullwidth_latin (bool render_fullwidth_latin)
 
void set_underline_start_prob (const double frac)
 
void set_underline_continuation_prob (const double frac)
 
void set_underline_style (const PangoUnderline style)
 
void set_features (const char *features)
 
void set_page (int page)
 
void set_box_padding (int val)
 
void set_drop_uncovered_chars (bool val)
 
void set_strip_unrenderable_words (bool val)
 
void set_output_word_boxes (bool val)
 
void set_add_ligatures (bool add_ligatures)
 
void set_pen_color (double r, double g, double b)
 
void set_h_margin (const int h_margin)
 
void set_v_margin (const int v_margin)
 
const PangoFontInfofont () const
 
int h_margin () const
 
int v_margin () const
 
const std::vector< BoxChar * > & GetBoxes () const
 
Boxa * GetPageBoxes () const
 
void RotatePageBoxes (float rotation)
 
void ClearBoxes ()
 
std::string GetBoxesStr ()
 
void WriteAllBoxes (const std::string &filename)
 
int StripUnrenderableWords (std::string *utf8_text) const
 

Static Public Member Functions

static std::string InsertWordJoiners (const std::string &text)
 
static std::string ConvertBasicLatinToFullwidthLatin (const std::string &text)
 
static std::string ConvertFullwidthLatinToBasicLatin (const std::string &text)
 

Protected Member Functions

void InitPangoCairo ()
 
void FreePangoCairo ()
 
void SetLayoutProperties ()
 
void SetWordUnderlineAttributes (const std::string &page_text)
 
void ComputeClusterBoxes ()
 
void CorrectBoxPositionsToLayout (std::vector< BoxChar *> *boxchars)
 
bool GetClusterStrings (std::vector< std::string > *cluster_text)
 
int FindFirstPageBreakOffset (const char *text, int text_length)
 

Protected Attributes

PangoFontInfo font_
 
int page_width_
 
int page_height_
 
int h_margin_
 
int v_margin_
 
double pen_color_ [3]
 
int char_spacing_
 
int leading_
 
int resolution_
 
bool vertical_text_
 
bool gravity_hint_strong_
 
bool render_fullwidth_latin_
 
double underline_start_prob_
 
double underline_continuation_prob_
 
PangoUnderline underline_style_
 
char * features_
 
bool drop_uncovered_chars_
 
bool strip_unrenderable_words_
 
bool add_ligatures_
 
bool output_word_boxes_
 
cairo_surface_t * surface_
 
cairo_t * cr_
 
PangoLayout * layout_
 
int start_box_
 
int page_
 
std::vector< BoxChar * > boxchars_
 
int box_padding_
 
Boxa * page_boxes_
 
std::unordered_map< char32, int64_t > char_map_
 
int total_chars_
 
unsigned int font_index_
 
int last_offset_
 

Private Member Functions

 StringRenderer (const StringRenderer &)
 
void operator= (const StringRenderer &)
 

Constructor & Destructor Documentation

◆ StringRenderer() [1/2]

tesseract::StringRenderer::StringRenderer ( const std::string &  font_desc,
int  page_width,
int  page_height 
)

◆ ~StringRenderer()

tesseract::StringRenderer::~StringRenderer ( )

◆ StringRenderer() [2/2]

tesseract::StringRenderer::StringRenderer ( const StringRenderer )
private

Member Function Documentation

◆ ClearBoxes()

void tesseract::StringRenderer::ClearBoxes ( )

◆ ComputeClusterBoxes()

void tesseract::StringRenderer::ComputeClusterBoxes ( )
protected

◆ ConvertBasicLatinToFullwidthLatin()

std::string tesseract::StringRenderer::ConvertBasicLatinToFullwidthLatin ( const std::string &  text)
static

◆ ConvertFullwidthLatinToBasicLatin()

std::string tesseract::StringRenderer::ConvertFullwidthLatinToBasicLatin ( const std::string &  text)
static

◆ CorrectBoxPositionsToLayout()

void tesseract::StringRenderer::CorrectBoxPositionsToLayout ( std::vector< BoxChar *> *  boxchars)
protected

◆ FindFirstPageBreakOffset()

int tesseract::StringRenderer::FindFirstPageBreakOffset ( const char *  text,
int  text_length 
)
protected

◆ font()

const PangoFontInfo& tesseract::StringRenderer::font ( ) const
inline

◆ FreePangoCairo()

void tesseract::StringRenderer::FreePangoCairo ( )
protected

◆ GetBoxes()

const std::vector< BoxChar * > & tesseract::StringRenderer::GetBoxes ( ) const

◆ GetBoxesStr()

std::string tesseract::StringRenderer::GetBoxesStr ( )

◆ GetClusterStrings()

bool tesseract::StringRenderer::GetClusterStrings ( std::vector< std::string > *  cluster_text)
protected

◆ GetPageBoxes()

Boxa * tesseract::StringRenderer::GetPageBoxes ( ) const

◆ h_margin()

int tesseract::StringRenderer::h_margin ( ) const
inline

◆ InitPangoCairo()

void tesseract::StringRenderer::InitPangoCairo ( )
protected

◆ InsertWordJoiners()

std::string tesseract::StringRenderer::InsertWordJoiners ( const std::string &  text)
static

◆ operator=()

void tesseract::StringRenderer::operator= ( const StringRenderer )
private

◆ RenderAllFontsToImage()

int tesseract::StringRenderer::RenderAllFontsToImage ( double  min_coverage,
const char *  text,
int  text_length,
std::string *  font_used,
Pix **  pix 
)

◆ RenderToBinaryImage()

int tesseract::StringRenderer::RenderToBinaryImage ( const char *  text,
int  text_length,
int  threshold,
Pix **  pix 
)

◆ RenderToGrayscaleImage()

int tesseract::StringRenderer::RenderToGrayscaleImage ( const char *  text,
int  text_length,
Pix **  pix 
)

◆ RenderToImage()

int tesseract::StringRenderer::RenderToImage ( const char *  text,
int  text_length,
Pix **  pix 
)

◆ RotatePageBoxes()

void tesseract::StringRenderer::RotatePageBoxes ( float  rotation)

◆ set_add_ligatures()

void tesseract::StringRenderer::set_add_ligatures ( bool  add_ligatures)
inline

◆ set_box_padding()

void tesseract::StringRenderer::set_box_padding ( int  val)
inline

◆ set_char_spacing()

void tesseract::StringRenderer::set_char_spacing ( int  char_spacing)
inline

◆ set_drop_uncovered_chars()

void tesseract::StringRenderer::set_drop_uncovered_chars ( bool  val)
inline

◆ set_features()

void tesseract::StringRenderer::set_features ( const char *  features)
inline

◆ set_font()

bool tesseract::StringRenderer::set_font ( const std::string &  desc)

◆ set_gravity_hint_strong()

void tesseract::StringRenderer::set_gravity_hint_strong ( bool  gravity_hint_strong)
inline

◆ set_h_margin()

void tesseract::StringRenderer::set_h_margin ( const int  h_margin)
inline

◆ set_leading()

void tesseract::StringRenderer::set_leading ( int  leading)
inline

◆ set_output_word_boxes()

void tesseract::StringRenderer::set_output_word_boxes ( bool  val)
inline

◆ set_page()

void tesseract::StringRenderer::set_page ( int  page)
inline

◆ set_pen_color()

void tesseract::StringRenderer::set_pen_color ( double  r,
double  g,
double  b 
)
inline

◆ set_render_fullwidth_latin()

void tesseract::StringRenderer::set_render_fullwidth_latin ( bool  render_fullwidth_latin)
inline

◆ set_resolution()

void tesseract::StringRenderer::set_resolution ( const int  resolution)

◆ set_strip_unrenderable_words()

void tesseract::StringRenderer::set_strip_unrenderable_words ( bool  val)
inline

◆ set_underline_continuation_prob()

void tesseract::StringRenderer::set_underline_continuation_prob ( const double  frac)

◆ set_underline_start_prob()

void tesseract::StringRenderer::set_underline_start_prob ( const double  frac)

◆ set_underline_style()

void tesseract::StringRenderer::set_underline_style ( const PangoUnderline  style)
inline

◆ set_v_margin()

void tesseract::StringRenderer::set_v_margin ( const int  v_margin)
inline

◆ set_vertical_text()

void tesseract::StringRenderer::set_vertical_text ( bool  vertical_text)
inline

◆ SetLayoutProperties()

void tesseract::StringRenderer::SetLayoutProperties ( )
protected

◆ SetWordUnderlineAttributes()

void tesseract::StringRenderer::SetWordUnderlineAttributes ( const std::string &  page_text)
protected

◆ StripUnrenderableWords()

int tesseract::StringRenderer::StripUnrenderableWords ( std::string *  utf8_text) const

◆ v_margin()

int tesseract::StringRenderer::v_margin ( ) const
inline

◆ WriteAllBoxes()

void tesseract::StringRenderer::WriteAllBoxes ( const std::string &  filename)

Member Data Documentation

◆ add_ligatures_

bool tesseract::StringRenderer::add_ligatures_
protected

◆ box_padding_

int tesseract::StringRenderer::box_padding_
protected

◆ boxchars_

std::vector<BoxChar*> tesseract::StringRenderer::boxchars_
protected

◆ char_map_

std::unordered_map<char32, int64_t> tesseract::StringRenderer::char_map_
protected

◆ char_spacing_

int tesseract::StringRenderer::char_spacing_
protected

◆ cr_

cairo_t* tesseract::StringRenderer::cr_
protected

◆ drop_uncovered_chars_

bool tesseract::StringRenderer::drop_uncovered_chars_
protected

◆ features_

char* tesseract::StringRenderer::features_
protected

◆ font_

PangoFontInfo tesseract::StringRenderer::font_
protected

◆ font_index_

unsigned int tesseract::StringRenderer::font_index_
protected

◆ gravity_hint_strong_

bool tesseract::StringRenderer::gravity_hint_strong_
protected

◆ h_margin_

int tesseract::StringRenderer::h_margin_
protected

◆ last_offset_

int tesseract::StringRenderer::last_offset_
protected

◆ layout_

PangoLayout* tesseract::StringRenderer::layout_
protected

◆ leading_

int tesseract::StringRenderer::leading_
protected

◆ output_word_boxes_

bool tesseract::StringRenderer::output_word_boxes_
protected

◆ page_

int tesseract::StringRenderer::page_
protected

◆ page_boxes_

Boxa* tesseract::StringRenderer::page_boxes_
protected

◆ page_height_

int tesseract::StringRenderer::page_height_
protected

◆ page_width_

int tesseract::StringRenderer::page_width_
protected

◆ pen_color_

double tesseract::StringRenderer::pen_color_[3]
protected

◆ render_fullwidth_latin_

bool tesseract::StringRenderer::render_fullwidth_latin_
protected

◆ resolution_

int tesseract::StringRenderer::resolution_
protected

◆ start_box_

int tesseract::StringRenderer::start_box_
protected

◆ strip_unrenderable_words_

bool tesseract::StringRenderer::strip_unrenderable_words_
protected

◆ surface_

cairo_surface_t* tesseract::StringRenderer::surface_
protected

◆ total_chars_

int tesseract::StringRenderer::total_chars_
protected

◆ underline_continuation_prob_

double tesseract::StringRenderer::underline_continuation_prob_
protected

◆ underline_start_prob_

double tesseract::StringRenderer::underline_start_prob_
protected

◆ underline_style_

PangoUnderline tesseract::StringRenderer::underline_style_
protected

◆ v_margin_

int tesseract::StringRenderer::v_margin_
protected

◆ vertical_text_

bool tesseract::StringRenderer::vertical_text_
protected

The documentation for this class was generated from the following files: