29 #ifndef TESSERACT_TRAINING_STRINGRENDERER_H_ 30 #define TESSERACT_TRAINING_STRINGRENDERER_H_ 33 #include <unordered_map> 38 #include "pango/pango-layout.h" 39 #include "pango/pangocairo.h" 45 # define strdup(s) _strdup(s) 54 StringRenderer(
const std::string& font_desc,
int page_width,
int page_height);
60 int RenderToImage(
const char* text,
int text_length, Pix** pix);
68 int text_length, std::string* font_used, Pix** pix);
70 bool set_font(
const std::string& desc);
141 const std::vector<BoxChar*>&
GetBoxes()
const;
227 #endif // THIRD_PARTY_TESSERACT_TRAINING_STRINGRENDERER_H_
bool GetClusterStrings(std::vector< std::string > *cluster_text)
static std::string ConvertFullwidthLatinToBasicLatin(const std::string &text)
int RenderAllFontsToImage(double min_coverage, const char *text, int text_length, std::string *font_used, Pix **pix)
int RenderToGrayscaleImage(const char *text, int text_length, Pix **pix)
PangoUnderline underline_style_
void set_underline_continuation_prob(const double frac)
static std::string InsertWordJoiners(const std::string &text)
void set_underline_style(const PangoUnderline style)
void set_vertical_text(bool vertical_text)
cairo_surface_t * surface_
void set_gravity_hint_strong(bool gravity_hint_strong)
const std::vector< BoxChar * > & GetBoxes() const
void RotatePageBoxes(float rotation)
double underline_continuation_prob_
Boxa * GetPageBoxes() const
void set_render_fullwidth_latin(bool render_fullwidth_latin)
void set_output_word_boxes(bool val)
void set_drop_uncovered_chars(bool val)
void set_add_ligatures(bool add_ligatures)
void set_box_padding(int val)
std::unordered_map< char32, int64_t > char_map_
void SetLayoutProperties()
int FindFirstPageBreakOffset(const char *text, int text_length)
void set_resolution(const int resolution)
bool strip_unrenderable_words_
static std::string ConvertBasicLatinToFullwidthLatin(const std::string &text)
std::string GetBoxesStr()
void set_strip_unrenderable_words(bool val)
void WriteAllBoxes(const std::string &filename)
std::vector< BoxChar * > boxchars_
void set_v_margin(const int v_margin)
bool set_font(const std::string &desc)
void set_leading(int leading)
void SetWordUnderlineAttributes(const std::string &page_text)
void set_underline_start_prob(const double frac)
void set_features(const char *features)
void CorrectBoxPositionsToLayout(std::vector< BoxChar *> *boxchars)
StringRenderer(const std::string &font_desc, int page_width, int page_height)
void set_pen_color(double r, double g, double b)
bool gravity_hint_strong_
double underline_start_prob_
int StripUnrenderableWords(std::string *utf8_text) const
int RenderToBinaryImage(const char *text, int text_length, int threshold, Pix **pix)
void set_char_spacing(int char_spacing)
void set_h_margin(const int h_margin)
bool render_fullwidth_latin_
const PangoFontInfo & font() const
int RenderToImage(const char *text, int text_length, Pix **pix)
void ComputeClusterBoxes()
bool drop_uncovered_chars_