tesseract  3.05.02
tesseract::StringRenderer Class Reference

#include <stringrenderer.h>

Public Member Functions

 StringRenderer (const 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, string *font_used, Pix **pix)
 
bool set_font (const string &desc)
 
void set_char_spacing (double 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 ()
 
string GetBoxesStr ()
 
void WriteAllBoxes (const string &filename)
 
int StripUnrenderableWords (string *utf8_text) const
 

Static Public Member Functions

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

Protected Member Functions

void InitPangoCairo ()
 
void FreePangoCairo ()
 
void SetLayoutProperties ()
 
void SetWordUnderlineAttributes (const string &page_text)
 
void ComputeClusterBoxes ()
 
void CorrectBoxPositionsToLayout (std::vector< BoxChar *> *boxchars)
 
bool GetClusterStrings (std::vector< 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]
 
double 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_
 
TessHashMap< char32, inT64char_map_
 
int total_chars_
 
int font_index_
 
int last_offset_
 

Detailed Description

Definition at line 48 of file stringrenderer.h.

Constructor & Destructor Documentation

◆ StringRenderer()

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

Definition at line 97 of file stringrenderer.cpp.

99  : page_width_(page_width),
100  page_height_(page_height),
101  h_margin_(50),
102  v_margin_(50),
103  pen_color_{0.0, 0.0, 0.0},
104  char_spacing_(0),
105  leading_(0),
106  vertical_text_(false),
107  gravity_hint_strong_(false),
111  underline_style_(PANGO_UNDERLINE_SINGLE),
112  features_(NULL),
113  drop_uncovered_chars_(true),
115  add_ligatures_(false),
116  output_word_boxes_(false),
117  surface_(NULL),
118  cr_(NULL),
119  layout_(NULL),
120  start_box_(0),
121  page_(0),
122  box_padding_(0),
123  page_boxes_(NULL),
124  total_chars_(0),
125  font_index_(0),
126  last_offset_(0) {
127  set_font(font_desc);
128  set_resolution(kDefaultOutputResolution);
129 }
cairo_surface_t * surface_
PangoUnderline underline_style_
bool set_font(const string &desc)
void set_resolution(const int resolution)

◆ ~StringRenderer()

tesseract::StringRenderer::~StringRenderer ( )

Definition at line 150 of file stringrenderer.cpp.

150  {
151  free(features_);
152  ClearBoxes();
153  FreePangoCairo();
154 }

Member Function Documentation

◆ ClearBoxes()

void tesseract::StringRenderer::ClearBoxes ( )

Definition at line 341 of file stringrenderer.cpp.

341  {
342  for (int i = 0; i < boxchars_.size(); ++i)
343  delete boxchars_[i];
344  boxchars_.clear();
345  boxaDestroy(&page_boxes_);
346 }
std::vector< BoxChar * > boxchars_

◆ ComputeClusterBoxes()

void tesseract::StringRenderer::ComputeClusterBoxes ( )
protected

Definition at line 466 of file stringrenderer.cpp.

466  {
467  const char* text = pango_layout_get_text(layout_);
468  PangoLayoutIter* cluster_iter = pango_layout_get_iter(layout_);
469 
470  // Do a first pass to store cluster start indexes.
471  vector<int> cluster_start_indices;
472  do {
473  cluster_start_indices.push_back(pango_layout_iter_get_index(cluster_iter));
474  tlog(3, "Added %d\n", cluster_start_indices.back());
475  } while (pango_layout_iter_next_cluster(cluster_iter));
476  pango_layout_iter_free(cluster_iter);
477  cluster_start_indices.push_back(strlen(text));
478  tlog(3, "Added last index %d\n", cluster_start_indices.back());
479  // Sort the indices and create a map from start to end indices.
480  sort(cluster_start_indices.begin(), cluster_start_indices.end());
481  map<int, int> cluster_start_to_end_index;
482  for (int i = 0; i < cluster_start_indices.size() - 1; ++i) {
483  cluster_start_to_end_index[cluster_start_indices[i]]
484  = cluster_start_indices[i + 1];
485  }
486 
487  // Iterate again to compute cluster boxes and their text with the obtained
488  // cluster extent information.
489  cluster_iter = pango_layout_get_iter(layout_);
490  // Store BoxChars* sorted by their byte start positions
491  map<int, BoxChar*> start_byte_to_box;
492  do {
493  PangoRectangle cluster_rect;
494  pango_layout_iter_get_cluster_extents(cluster_iter, &cluster_rect,
495  NULL);
496  pango_extents_to_pixels(&cluster_rect, NULL);
497  const int start_byte_index = pango_layout_iter_get_index(cluster_iter);
498  const int end_byte_index = cluster_start_to_end_index[start_byte_index];
499  string cluster_text = string(text + start_byte_index,
500  end_byte_index - start_byte_index);
501  if (!cluster_text.empty() && cluster_text[0] == '\n') {
502  tlog(2, "Skipping newlines at start of text.\n");
503  continue;
504  }
505  if (!cluster_rect.width || !cluster_rect.height ||
506  IsUTF8Whitespace(cluster_text.c_str())) {
507  tlog(2, "Skipping whitespace with boxdim (%d,%d) '%s'\n",
508  cluster_rect.width, cluster_rect.height, cluster_text.c_str());
509  BoxChar* boxchar = new BoxChar(" ", 1);
510  boxchar->set_page(page_);
511  start_byte_to_box[start_byte_index] = boxchar;
512  continue;
513  }
514  // Prepare a boxchar for addition at this byte position.
515  tlog(2, "[%d %d], %d, %d : start_byte=%d end_byte=%d : '%s'\n",
516  cluster_rect.x, cluster_rect.y,
517  cluster_rect.width, cluster_rect.height,
518  start_byte_index, end_byte_index,
519  cluster_text.c_str());
520  ASSERT_HOST_MSG(cluster_rect.width,
521  "cluster_text:%s start_byte_index:%d\n",
522  cluster_text.c_str(), start_byte_index);
523  ASSERT_HOST_MSG(cluster_rect.height,
524  "cluster_text:%s start_byte_index:%d\n",
525  cluster_text.c_str(), start_byte_index);
526  if (box_padding_) {
527  cluster_rect.x = max(0, cluster_rect.x - box_padding_);
528  cluster_rect.width += 2 * box_padding_;
529  cluster_rect.y = max(0, cluster_rect.y - box_padding_);
530  cluster_rect.height += 2 * box_padding_;
531  }
532  if (add_ligatures_) {
533  // Make sure the output box files have ligatured text in case the font
534  // decided to use an unmapped glyph.
535  cluster_text = LigatureTable::Get()->AddLigatures(cluster_text, NULL);
536  }
537  BoxChar* boxchar = new BoxChar(cluster_text.c_str(), cluster_text.size());
538  boxchar->set_page(page_);
539  boxchar->AddBox(cluster_rect.x, cluster_rect.y,
540  cluster_rect.width, cluster_rect.height);
541  start_byte_to_box[start_byte_index] = boxchar;
542  } while (pango_layout_iter_next_cluster(cluster_iter));
543  pango_layout_iter_free(cluster_iter);
544 
545  // There is a subtle bug in the cluster text reported by the PangoLayoutIter
546  // on ligatured characters (eg. The word "Lam-Aliph" in arabic). To work
547  // around this, we use text reported using the PangoGlyphIter which is
548  // accurate.
549  // TODO(ranjith): Revisit whether this is still needed in newer versions of
550  // pango.
551  vector<string> cluster_text;
552  if (GetClusterStrings(&cluster_text)) {
553  ASSERT_HOST(cluster_text.size() == start_byte_to_box.size());
554  int ind = 0;
555  for (map<int, BoxChar*>::iterator it = start_byte_to_box.begin();
556  it != start_byte_to_box.end(); ++it, ++ind) {
557  it->second->mutable_ch()->swap(cluster_text[ind]);
558  }
559  }
560 
561  // Append to the boxchars list in byte order.
562  vector<BoxChar*> page_boxchars;
563  page_boxchars.reserve(start_byte_to_box.size());
564  string last_ch;
565  for (map<int, BoxChar*>::const_iterator it = start_byte_to_box.begin();
566  it != start_byte_to_box.end(); ++it) {
567  if (it->second->ch() == kWordJoinerUTF8) {
568  // Skip zero-width joiner characters (ZWJs) here.
569  delete it->second;
570  } else {
571  page_boxchars.push_back(it->second);
572  }
573  }
574  CorrectBoxPositionsToLayout(&page_boxchars);
575 
577  for (map<int, BoxChar*>::iterator it = start_byte_to_box.begin();
578  it != start_byte_to_box.end(); ++it) {
579  // Convert fullwidth Latin characters to their halfwidth forms.
580  string half(ConvertFullwidthLatinToBasicLatin(it->second->ch()));
581  it->second->mutable_ch()->swap(half);
582  }
583  }
584 
585  // Merge the character boxes into word boxes if we are rendering n-grams.
586  if (output_word_boxes_) {
587  MergeBoxCharsToWords(&page_boxchars);
588  }
589 
590  boxchars_.insert(boxchars_.end(), page_boxchars.begin(), page_boxchars.end());
591 
592  // Compute the page bounding box
593  Box* page_box = NULL;
594  Boxa* all_boxes = NULL;
595  for (int i = 0; i < page_boxchars.size(); ++i) {
596  if (page_boxchars[i]->box() == NULL) continue;
597  if (all_boxes == NULL)
598  all_boxes = boxaCreate(0);
599  boxaAddBox(all_boxes, page_boxchars[i]->mutable_box(), L_CLONE);
600  }
601  if (all_boxes != NULL) {
602  boxaGetExtent(all_boxes, NULL, NULL, &page_box);
603  boxaDestroy(&all_boxes);
604  if (page_boxes_ == NULL) page_boxes_ = boxaCreate(0);
605  boxaAddBox(page_boxes_, page_box, L_INSERT);
606  }
607 }
std::vector< BoxChar * > boxchars_
#define tlog(level,...)
Definition: tlog.h:33
bool IsUTF8Whitespace(const char *text)
Definition: normstrngs.cpp:182
string AddLigatures(const string &str, const PangoFontInfo *font) const
#define ASSERT_HOST_MSG(x,...)
Definition: errcode.h:90
static string ConvertFullwidthLatinToBasicLatin(const string &text)
void CorrectBoxPositionsToLayout(std::vector< BoxChar *> *boxchars)
bool GetClusterStrings(std::vector< string > *cluster_text)
static LigatureTable * Get()
#define ASSERT_HOST(x)
Definition: errcode.h:84

◆ ConvertBasicLatinToFullwidthLatin()

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

Definition at line 701 of file stringrenderer.cpp.

701  {
702  string full_str;
703  const UNICHAR::const_iterator it_end = UNICHAR::end(str.c_str(),
704  str.length());
705  for (UNICHAR::const_iterator it = UNICHAR::begin(str.c_str(), str.length());
706  it != it_end; ++it) {
707  // Convert printable and non-space 7-bit ASCII characters to
708  // their fullwidth forms.
709  if (IsInterchangeValid7BitAscii(*it) && isprint(*it) && !isspace(*it)) {
710  // Convert by adding 0xFEE0 to the codepoint of 7-bit ASCII.
711  char32 full_char = *it + 0xFEE0;
712  full_str.append(EncodeAsUTF8(full_char));
713  } else {
714  full_str.append(it.utf8_data(), it.utf8_len());
715  }
716  }
717  return full_str;
718 }
static const_iterator end(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:204
bool IsInterchangeValid7BitAscii(const char32 ch)
Definition: normstrngs.cpp:232
static const_iterator begin(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:200
signed int char32
Definition: normstrngs.h:27

◆ ConvertFullwidthLatinToBasicLatin()

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

Definition at line 721 of file stringrenderer.cpp.

721  {
722  string half_str;
723  UNICHAR::const_iterator it_end = UNICHAR::end(str.c_str(), str.length());
724  for (UNICHAR::const_iterator it = UNICHAR::begin(str.c_str(), str.length());
725  it != it_end; ++it) {
726  char32 half_char = FullwidthToHalfwidth(*it);
727  // Convert fullwidth Latin characters to their halfwidth forms
728  // only if halfwidth forms are printable and non-space 7-bit ASCII.
729  if (IsInterchangeValid7BitAscii(half_char) &&
730  isprint(half_char) && !isspace(half_char)) {
731  half_str.append(EncodeAsUTF8(half_char));
732  } else {
733  half_str.append(it.utf8_data(), it.utf8_len());
734  }
735  }
736  return half_str;
737 }
static const_iterator end(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:204
bool IsInterchangeValid7BitAscii(const char32 ch)
Definition: normstrngs.cpp:232
static const_iterator begin(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:200
char32 FullwidthToHalfwidth(const char32 ch)
Definition: normstrngs.cpp:239
signed int char32
Definition: normstrngs.h:27

◆ CorrectBoxPositionsToLayout()

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

Definition at line 610 of file stringrenderer.cpp.

610  {
611  if (vertical_text_) {
612  const double rotation = - pango_gravity_to_rotation(
613  pango_context_get_base_gravity(pango_layout_get_context(layout_)));
616  0, boxchars->size(), boxchars);
617  } else {
619  }
620 }
static void TranslateBoxes(int xshift, int yshift, vector< BoxChar *> *boxes)
Definition: boxchar.cpp:52
static void RotateBoxes(float rotation, int xcenter, int ycenter, int start_box, int end_box, vector< BoxChar *> *boxes)
Definition: boxchar.cpp:272

◆ FindFirstPageBreakOffset()

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

Definition at line 283 of file stringrenderer.cpp.

284  {
285  if (!text_length) return 0;
286  const int max_height = (page_height_ - 2 * v_margin_);
287  const int max_width = (page_width_ - 2 * h_margin_);
288  const int max_layout_height = vertical_text_ ? max_width : max_height;
289 
290  UNICHAR::const_iterator it = UNICHAR::begin(text, text_length);
291  const UNICHAR::const_iterator it_end = UNICHAR::end(text, text_length);
292  const int kMaxUnicodeBufLength = 15000;
293  for (int i = 0; i < kMaxUnicodeBufLength && it != it_end; ++it, ++i);
294  int buf_length = it.utf8_data() - text;
295  tlog(1, "len = %d buf_len = %d\n", text_length, buf_length);
296  pango_layout_set_text(layout_, text, buf_length);
297 
298  PangoLayoutIter* line_iter = NULL;
299  { // Fontconfig caches some info here that is not freed before exit.
301  line_iter = pango_layout_get_iter(layout_);
302  }
303  bool first_page = true;
304  int page_top = 0;
305  int offset = buf_length;
306  do {
307  // Get bounding box of the current line
308  PangoRectangle line_ink_rect;
309  pango_layout_iter_get_line_extents(line_iter, &line_ink_rect, NULL);
310  pango_extents_to_pixels(&line_ink_rect, NULL);
311  PangoLayoutLine* line = pango_layout_iter_get_line_readonly(line_iter);
312  if (first_page) {
313  page_top = line_ink_rect.y;
314  first_page = false;
315  }
316  int line_bottom = line_ink_rect.y + line_ink_rect.height;
317  if (line_bottom - page_top > max_layout_height) {
318  offset = line->start_index;
319  tlog(1, "Found offset = %d\n", offset);
320  break;
321  }
322  } while (pango_layout_iter_next_line(line_iter));
323  pango_layout_iter_free(line_iter);
324  return offset;
325 }
const char * utf8_data() const
Definition: unichar.h:130
#define tlog(level,...)
Definition: tlog.h:33
static const_iterator end(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:204
static const_iterator begin(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:200
#define DISABLE_HEAP_LEAK_CHECK
Definition: util.h:63

◆ font()

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

Definition at line 130 of file stringrenderer.h.

130  {
131  return font_;
132  }

◆ FreePangoCairo()

void tesseract::StringRenderer::FreePangoCairo ( )
protected

Definition at line 222 of file stringrenderer.cpp.

222  {
223  if (layout_) {
224  g_object_unref(layout_);
225  layout_ = NULL;
226  }
227  if (cr_) {
228  cairo_destroy(cr_);
229  cr_ = NULL;
230  }
231  if (surface_) {
232  cairo_surface_destroy(surface_);
233  surface_ = NULL;
234  }
235 }
cairo_surface_t * surface_

◆ GetBoxes()

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

Definition at line 327 of file stringrenderer.cpp.

327  {
328  return boxchars_;
329 }
std::vector< BoxChar * > boxchars_

◆ GetBoxesStr()

string tesseract::StringRenderer::GetBoxesStr ( )

Definition at line 348 of file stringrenderer.cpp.

348  {
351 }
std::vector< BoxChar * > boxchars_
static string GetTesseractBoxStr(int height, const vector< BoxChar *> &boxes)
Definition: boxchar.cpp:300
static void PrepareToWrite(vector< BoxChar *> *boxes)
Definition: boxchar.cpp:66

◆ GetClusterStrings()

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

Definition at line 359 of file stringrenderer.cpp.

359  {
360  map<int, string> start_byte_to_text;
361  PangoLayoutIter* run_iter = pango_layout_get_iter(layout_);
362  const char* full_text = pango_layout_get_text(layout_);
363  do {
364  PangoLayoutRun* run = pango_layout_iter_get_run_readonly(run_iter);
365  if (!run) {
366  // End of line NULL run marker
367  tlog(2, "Found end of line marker\n");
368  continue;
369  }
370  PangoGlyphItemIter cluster_iter;
371  gboolean have_cluster;
372  for (have_cluster = pango_glyph_item_iter_init_start(&cluster_iter,
373  run, full_text);
374  have_cluster;
375  have_cluster = pango_glyph_item_iter_next_cluster(&cluster_iter)) {
376  const int start_byte_index = cluster_iter.start_index;
377  const int end_byte_index = cluster_iter.end_index;
378  string text = string(full_text + start_byte_index,
379  end_byte_index - start_byte_index);
380  if (IsUTF8Whitespace(text.c_str())) {
381  tlog(2, "Found whitespace\n");
382  text = " ";
383  }
384  tlog(2, "start_byte=%d end_byte=%d : '%s'\n", start_byte_index,
385  end_byte_index, text.c_str());
386  if (add_ligatures_) {
387  // Make sure the output box files have ligatured text in case the font
388  // decided to use an unmapped glyph.
389  text = LigatureTable::Get()->AddLigatures(text, NULL);
390  }
391  start_byte_to_text[start_byte_index] = text;
392  }
393  } while (pango_layout_iter_next_run(run_iter));
394  pango_layout_iter_free(run_iter);
395 
396  cluster_text->clear();
397  for (map<int, string>::const_iterator it = start_byte_to_text.begin();
398  it != start_byte_to_text.end(); ++it) {
399  cluster_text->push_back(it->second);
400  }
401  return !cluster_text->empty();
402 }
#define tlog(level,...)
Definition: tlog.h:33
bool IsUTF8Whitespace(const char *text)
Definition: normstrngs.cpp:182
string AddLigatures(const string &str, const PangoFontInfo *font) const
static LigatureTable * Get()

◆ GetPageBoxes()

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

Definition at line 331 of file stringrenderer.cpp.

331  {
332  return page_boxes_;
333 }

◆ h_margin()

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

Definition at line 133 of file stringrenderer.h.

133 { return h_margin_; }

◆ InitPangoCairo()

void tesseract::StringRenderer::InitPangoCairo ( )
protected

Definition at line 156 of file stringrenderer.cpp.

156  {
157  FreePangoCairo();
158  surface_ = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, page_width_,
159  page_height_);
160  cr_ = cairo_create(surface_);
161  {
163  layout_ = pango_cairo_create_layout(cr_);
164  }
165 
166  if (vertical_text_) {
167  PangoContext* context = pango_layout_get_context(layout_);
168  pango_context_set_base_gravity(context, PANGO_GRAVITY_EAST);
169  if (gravity_hint_strong_) {
170  pango_context_set_gravity_hint(context, PANGO_GRAVITY_HINT_STRONG);
171  }
172  pango_layout_context_changed(layout_);
173  }
174 
176 }
cairo_surface_t * surface_
#define DISABLE_HEAP_LEAK_CHECK
Definition: util.h:63

◆ InsertWordJoiners()

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

Definition at line 678 of file stringrenderer.cpp.

678  {
679  string out_str;
680  const UNICHAR::const_iterator it_end = UNICHAR::end(text.c_str(),
681  text.length());
682  for (UNICHAR::const_iterator it = UNICHAR::begin(text.c_str(), text.length());
683  it != it_end; ++it) {
684  // Add the symbol to the output string.
685  out_str.append(it.utf8_data(), it.utf8_len());
686  // Check the next symbol.
687  UNICHAR::const_iterator next_it = it;
688  ++next_it;
689  bool next_char_is_boundary = (next_it == it_end || *next_it == ' ');
690  bool next_char_is_combiner = (next_it == it_end) ?
691  false : IsCombiner(*next_it);
692  if (*it != ' ' && *it != '\n' && !next_char_is_boundary &&
693  !next_char_is_combiner) {
694  out_str += kWordJoinerUTF8;
695  }
696  }
697  return out_str;
698 }
static const_iterator end(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:204
static const_iterator begin(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:200

◆ RenderAllFontsToImage()

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

Definition at line 840 of file stringrenderer.cpp.

842  {
843  *image = NULL;
844  // Select a suitable font to render the title with.
845  const char kTitleTemplate[] = "%s : %d hits = %.2f%%, raw = %d = %.2f%%";
846  string title_font;
847  if (!FontUtils::SelectFont(kTitleTemplate, strlen(kTitleTemplate),
848  &title_font, NULL)) {
849  tprintf("WARNING: Could not find a font to render image title with!\n");
850  title_font = "Arial";
851  }
852  title_font += " 8";
853  tlog(1, "Selected title font: %s\n", title_font.c_str());
854  if (font_used) font_used->clear();
855 
856  string orig_font = font_.DescriptionName();
857  if (char_map_.empty()) {
858  total_chars_ = 0;
859  // Fill the hash table and use that for computing which fonts to use.
860  for (UNICHAR::const_iterator it = UNICHAR::begin(text, text_length);
861  it != UNICHAR::end(text, text_length); ++it) {
862  ++total_chars_;
863  ++char_map_[*it];
864  }
865  tprintf("Total chars = %d\n", total_chars_);
866  }
867  const vector<string>& all_fonts = FontUtils::ListAvailableFonts();
868  for (int i = font_index_; i < all_fonts.size(); ++i) {
869  ++font_index_;
870  int raw_score = 0;
871  int ok_chars = FontUtils::FontScore(char_map_, all_fonts[i], &raw_score,
872  NULL);
873  if (ok_chars > 0 && ok_chars >= total_chars_ * min_coverage) {
874  set_font(all_fonts[i]);
875  int offset = RenderToBinaryImage(text, text_length, 128, image);
876  ClearBoxes(); // Get rid of them as they are garbage.
877  const int kMaxTitleLength = 1024;
878  char title[kMaxTitleLength];
879  snprintf(title, kMaxTitleLength, kTitleTemplate,
880  all_fonts[i].c_str(), ok_chars,
881  100.0 * ok_chars / total_chars_, raw_score,
882  100.0 * raw_score / char_map_.size());
883  tprintf("%s\n", title);
884  // This is a good font! Store the offset to return once we've tried all
885  // the fonts.
886  if (offset) {
887  last_offset_ = offset;
888  if (font_used) *font_used = all_fonts[i];
889  }
890  // Add the font to the image.
891  set_font(title_font);
892  v_margin_ /= 8;
893  Pix* title_image = NULL;
894  RenderToBinaryImage(title, strlen(title), 128, &title_image);
895  pixOr(*image, *image, title_image);
896  pixDestroy(&title_image);
897 
898  v_margin_ *= 8;
899  set_font(orig_font);
900  // We return the real offset only after cycling through the list of fonts.
901  return 0;
902  } else {
903  tprintf("Font %s failed with %d hits = %.2f%%\n",
904  all_fonts[i].c_str(), ok_chars, 100.0 * ok_chars / total_chars_);
905  }
906  }
907  font_index_ = 0;
908  char_map_.clear();
909  return last_offset_ == 0 ? -1 : last_offset_;
910 }
TessHashMap< char32, inT64 > char_map_
#define tlog(level,...)
Definition: tlog.h:33
int RenderToBinaryImage(const char *text, int text_length, int threshold, Pix **pix)
static int FontScore(const TessHashMap< char32, inT64 > &ch_map, const string &fontname, int *raw_score, std::vector< bool > *ch_flags)
static const_iterator end(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:204
static const_iterator begin(const char *utf8_str, const int byte_length)
Definition: unichar.cpp:200
static bool SelectFont(const char *utf8_word, const int utf8_len, string *font_name, std::vector< string > *graphemes)
#define tprintf(...)
Definition: tprintf.h:31
bool set_font(const string &desc)
static const std::vector< string > & ListAvailableFonts()

◆ RenderToBinaryImage()

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

Definition at line 660 of file stringrenderer.cpp.

661  {
662  Pix *orig_pix = NULL;
663  int offset = RenderToImage(text, text_length, &orig_pix);
664  if (orig_pix) {
665  Pix* gray_pix = pixConvertTo8(orig_pix, false);
666  pixDestroy(&orig_pix);
667  *pix = pixThresholdToBinary(gray_pix, threshold);
668  pixDestroy(&gray_pix);
669  } else {
670  *pix = orig_pix;
671  }
672  return offset;
673 }
int RenderToImage(const char *text, int text_length, Pix **pix)

◆ RenderToGrayscaleImage()

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

Definition at line 649 of file stringrenderer.cpp.

650  {
651  Pix *orig_pix = NULL;
652  int offset = RenderToImage(text, text_length, &orig_pix);
653  if (orig_pix) {
654  *pix = pixConvertTo8(orig_pix, false);
655  pixDestroy(&orig_pix);
656  }
657  return offset;
658 }
int RenderToImage(const char *text, int text_length, Pix **pix)

◆ RenderToImage()

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

Definition at line 740 of file stringrenderer.cpp.

741  {
742  if (pix && *pix) pixDestroy(pix);
743  InitPangoCairo();
744 
745  const int page_offset = FindFirstPageBreakOffset(text, text_length);
746  if (!page_offset) {
747  return 0;
748  }
749  start_box_ = boxchars_.size();
750 
751  if (!vertical_text_) {
752  // Translate by the specified margin
753  cairo_translate(cr_, h_margin_, v_margin_);
754  } else {
755  // Vertical text rendering is achieved by a two-step process of first
756  // performing regular horizontal layout with character orientation set to
757  // EAST, and then translating and rotating the layout before rendering onto
758  // the desired image surface. The settings required for the former step are
759  // done within InitPangoCairo().
760  //
761  // Translate to the top-right margin of page
762  cairo_translate(cr_, page_width_ - h_margin_, v_margin_);
763  // Rotate the layout
764  double rotation = - pango_gravity_to_rotation(
765  pango_context_get_base_gravity(pango_layout_get_context(layout_)));
766  tlog(2, "Rotating by %f radians\n", rotation);
767  cairo_rotate(cr_, rotation);
768  pango_cairo_update_layout(cr_, layout_);
769  }
770  string page_text(text, page_offset);
772  // Convert Basic Latin to their fullwidth forms.
773  page_text = ConvertBasicLatinToFullwidthLatin(page_text);
774  }
776  StripUnrenderableWords(&page_text);
777  }
778  if (drop_uncovered_chars_ &&
779  !font_.CoversUTF8Text(page_text.c_str(), page_text.length())) {
780  int num_dropped = font_.DropUncoveredChars(&page_text);
781  if (num_dropped) {
782  tprintf("WARNING: Dropped %d uncovered characters\n", num_dropped);
783  }
784  }
785  if (add_ligatures_) {
786  // Add ligatures wherever possible, including custom ligatures.
787  page_text = LigatureTable::Get()->AddLigatures(page_text, &font_);
788  }
789  if (underline_start_prob_ > 0) {
790  SetWordUnderlineAttributes(page_text);
791  }
792 
793  pango_layout_set_text(layout_, page_text.c_str(), page_text.length());
794 
795  if (pix) {
796  // Set a white background for the target image surface.
797  cairo_set_source_rgb(cr_, 1.0, 1.0, 1.0); // sets drawing colour to white
798  // Fill the surface with the active colour (if you don't do this, you will
799  // be given a surface with a transparent background to draw on)
800  cairo_paint(cr_);
801  // Set the ink color to black
802  cairo_set_source_rgb(cr_, pen_color_[0], pen_color_[1], pen_color_[2]);
803  // If the target surface or transformation properties of the cairo instance
804  // have changed, update the pango layout to reflect this
805  pango_cairo_update_layout(cr_, layout_);
806  {
807  DISABLE_HEAP_LEAK_CHECK; // for Fontconfig
808  // Draw the pango layout onto the cairo surface
809  pango_cairo_show_layout(cr_, layout_);
810  }
812  }
814  FreePangoCairo();
815  // Update internal state variables.
816  ++page_;
817  return page_offset;
818 }
static string ConvertBasicLatinToFullwidthLatin(const string &text)
std::vector< BoxChar * > boxchars_
#define tlog(level,...)
Definition: tlog.h:33
int StripUnrenderableWords(string *utf8_text) const
bool CoversUTF8Text(const char *utf8_text, int byte_length) const
string AddLigatures(const string &str, const PangoFontInfo *font) const
int DropUncoveredChars(string *utf8_text) const
int FindFirstPageBreakOffset(const char *text, int text_length)
#define tprintf(...)
Definition: tprintf.h:31
cairo_surface_t * surface_
Pix * CairoARGB32ToPixFormat(cairo_surface_t *surface)
static LigatureTable * Get()
#define DISABLE_HEAP_LEAK_CHECK
Definition: util.h:63
void SetWordUnderlineAttributes(const string &page_text)

◆ RotatePageBoxes()

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

Definition at line 335 of file stringrenderer.cpp.

335  {
336  BoxChar::RotateBoxes(rotation, page_width_ / 2, page_height_ / 2,
337  start_box_, boxchars_.size(), &boxchars_);
338 }
std::vector< BoxChar * > boxchars_
static void RotateBoxes(float rotation, int xcenter, int ycenter, int start_box, int end_box, vector< BoxChar *> *boxes)
Definition: boxchar.cpp:272

◆ set_add_ligatures()

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

Definition at line 115 of file stringrenderer.h.

115  {
116  add_ligatures_ = add_ligatures;
117  }

◆ set_box_padding()

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

Definition at line 100 of file stringrenderer.h.

100  {
101  box_padding_ = val;
102  }

◆ set_char_spacing()

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

Definition at line 67 of file stringrenderer.h.

67  {
68  char_spacing_ = char_spacing;
69  }

◆ set_drop_uncovered_chars()

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

Definition at line 103 of file stringrenderer.h.

103  {
104  drop_uncovered_chars_ = val;
105  }

◆ set_features()

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

Definition at line 93 of file stringrenderer.h.

93  {
94  free(features_);
95  features_ = strdup(features);
96  }

◆ set_font()

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

Definition at line 131 of file stringrenderer.cpp.

131  {
132  bool success = font_.ParseFontDescriptionName(desc);
134  return success;
135 }
bool ParseFontDescriptionName(const string &name)
void set_resolution(const int resolution)

◆ set_gravity_hint_strong()

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

Definition at line 77 of file stringrenderer.h.

77  {
78  gravity_hint_strong_ = gravity_hint_strong;
79  }

◆ set_h_margin()

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

Definition at line 124 of file stringrenderer.h.

124  {
126  }

◆ set_leading()

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

Definition at line 70 of file stringrenderer.h.

70  {
71  leading_ = leading;
72  }

◆ set_output_word_boxes()

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

Definition at line 109 of file stringrenderer.h.

109  {
110  output_word_boxes_ = val;
111  }

◆ set_page()

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

Definition at line 97 of file stringrenderer.h.

97  {
98  page_ = page;
99  }

◆ set_pen_color()

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

Definition at line 119 of file stringrenderer.h.

119  {
120  pen_color_[0] = r;
121  pen_color_[1] = g;
122  pen_color_[2] = b;
123  }

◆ set_render_fullwidth_latin()

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

Definition at line 80 of file stringrenderer.h.

80  {
81  render_fullwidth_latin_ = render_fullwidth_latin;
82  }

◆ set_resolution()

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

Definition at line 137 of file stringrenderer.cpp.

137  {
138  resolution_ = resolution;
139  font_.set_resolution(resolution);
140 }
void set_resolution(const int resolution)

◆ set_strip_unrenderable_words()

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

Definition at line 106 of file stringrenderer.h.

106  {
108  }

◆ set_underline_continuation_prob()

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

Definition at line 146 of file stringrenderer.cpp.

146  {
147  underline_continuation_prob_ = min(max(frac, 0.0), 1.0);
148 }

◆ set_underline_start_prob()

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

Definition at line 142 of file stringrenderer.cpp.

142  {
143  underline_start_prob_ = min(max(frac, 0.0), 1.0);
144 }

◆ set_underline_style()

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

Definition at line 90 of file stringrenderer.h.

90  {
91  underline_style_ = style;
92  }
PangoUnderline underline_style_

◆ set_v_margin()

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

Definition at line 127 of file stringrenderer.h.

127  {
129  }

◆ set_vertical_text()

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

Definition at line 74 of file stringrenderer.h.

74  {
75  vertical_text_ = vertical_text;
76  }

◆ SetLayoutProperties()

void tesseract::StringRenderer::SetLayoutProperties ( )
protected

Definition at line 178 of file stringrenderer.cpp.

178  {
179  string font_desc = font_.DescriptionName();
180  // Specify the font via a description name
181  PangoFontDescription *desc =
182  pango_font_description_from_string(font_desc.c_str());
183  // Assign the font description to the layout
184  pango_layout_set_font_description(layout_, desc);
185  pango_font_description_free(desc); // free the description
186  pango_cairo_context_set_resolution(pango_layout_get_context(layout_),
187  resolution_);
188 
189  int max_width = page_width_ - 2 * h_margin_;
190  int max_height = page_height_ - 2 * v_margin_;
191  tlog(3, "max_width = %d, max_height = %d\n", max_width, max_height);
192  if (vertical_text_) {
193  swap(max_width, max_height);
194  }
195  pango_layout_set_width(layout_, max_width * PANGO_SCALE);
196  pango_layout_set_wrap(layout_, PANGO_WRAP_WORD);
197 
198  // Adjust character spacing
199  PangoAttrList* attr_list = pango_attr_list_new();
200  if (char_spacing_) {
201  PangoAttribute* spacing_attr = pango_attr_letter_spacing_new(
202  static_cast<int>(char_spacing_ * PANGO_SCALE + 0.5));
203  spacing_attr->start_index = 0;
204  spacing_attr->end_index = static_cast<guint>(-1);
205  pango_attr_list_change(attr_list, spacing_attr);
206  }
207 #if (PANGO_VERSION_MAJOR == 1 && PANGO_VERSION_MINOR >= 38)
208  if (add_ligatures_) {
209  set_features("liga, clig, dlig, hlig");
210  PangoAttribute* feature_attr = pango_attr_font_features_new(features_);
211  pango_attr_list_change(attr_list, feature_attr);
212  }
213 #endif
214  pango_layout_set_attributes(layout_, attr_list);
215  pango_attr_list_unref(attr_list);
216  // Adjust line spacing
217  if (leading_) {
218  pango_layout_set_spacing(layout_, leading_ * PANGO_SCALE);
219  }
220 }
#define tlog(level,...)
Definition: tlog.h:33
void set_features(const char *features)

◆ SetWordUnderlineAttributes()

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

Definition at line 237 of file stringrenderer.cpp.

237  {
238  if (underline_start_prob_ == 0) return;
239  PangoAttrList* attr_list = pango_layout_get_attributes(layout_);
240 
241  const char* text = page_text.c_str();
242  int offset = 0;
243  TRand rand;
244  bool started_underline = false;
245  PangoAttribute* und_attr = NULL;
246 
247  while (offset < page_text.length()) {
248  offset += SpanUTF8Whitespace(text + offset);
249  if (offset == page_text.length()) break;
250 
251  int word_start = offset;
252  int word_len = SpanUTF8NotWhitespace(text + offset);
253  offset += word_len;
254  if (started_underline) {
255  // Should we continue the underline to the next word?
256  if (RandBool(underline_continuation_prob_, &rand)) {
257  // Continue the current underline to this word.
258  und_attr->end_index = word_start + word_len;
259  } else {
260  // Otherwise end the current underline attribute at the end of the
261  // previous word.
262  pango_attr_list_insert(attr_list, und_attr);
263  started_underline = false;
264  und_attr = NULL;
265  }
266  }
267  if (!started_underline && RandBool(underline_start_prob_, &rand)) {
268  // Start a new underline attribute
269  und_attr = pango_attr_underline_new(underline_style_);
270  und_attr->start_index = word_start;
271  und_attr->end_index = word_start + word_len;
272  started_underline = true;
273  }
274  }
275  // Finish the current underline attribute at the end of the page.
276  if (started_underline) {
277  und_attr->end_index = page_text.length();
278  pango_attr_list_insert(attr_list, und_attr);
279  }
280 }
int SpanUTF8NotWhitespace(const char *text)
Definition: normstrngs.cpp:197
int SpanUTF8Whitespace(const char *text)
Definition: normstrngs.cpp:186
PangoUnderline underline_style_

◆ StripUnrenderableWords()

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

Definition at line 622 of file stringrenderer.cpp.

622  {
623  string output_text;
624  const char* text = utf8_text->c_str();
625  int offset = 0;
626  int num_dropped = 0;
627  while (offset < utf8_text->length()) {
628  int space_len = SpanUTF8Whitespace(text + offset);
629  output_text.append(text + offset, space_len);
630  offset += space_len;
631  if (offset == utf8_text->length()) break;
632 
633  int word_len = SpanUTF8NotWhitespace(text + offset);
634  if (font_.CanRenderString(text + offset, word_len)) {
635  output_text.append(text + offset, word_len);
636  } else {
637  ++num_dropped;
638  }
639  offset += word_len;
640  }
641  utf8_text->swap(output_text);
642 
643  if (num_dropped > 0) {
644  tprintf("Stripped %d unrenderable words\n", num_dropped);
645  }
646  return num_dropped;
647 }
bool CanRenderString(const char *utf8_word, int len, std::vector< string > *graphemes) const
int SpanUTF8NotWhitespace(const char *text)
Definition: normstrngs.cpp:197
int SpanUTF8Whitespace(const char *text)
Definition: normstrngs.cpp:186
#define tprintf(...)
Definition: tprintf.h:31

◆ v_margin()

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

Definition at line 134 of file stringrenderer.h.

134 { return v_margin_; }

◆ WriteAllBoxes()

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

Definition at line 353 of file stringrenderer.cpp.

353  {
356 }
std::vector< BoxChar * > boxchars_
static void PrepareToWrite(vector< BoxChar *> *boxes)
Definition: boxchar.cpp:66
static void WriteTesseractBoxFile(const string &name, int height, const vector< BoxChar *> &boxes)
Definition: boxchar.cpp:293

Member Data Documentation

◆ add_ligatures_

bool tesseract::StringRenderer::add_ligatures_
protected

Definition at line 195 of file stringrenderer.h.

◆ box_padding_

int tesseract::StringRenderer::box_padding_
protected

Definition at line 208 of file stringrenderer.h.

◆ boxchars_

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

Definition at line 207 of file stringrenderer.h.

◆ char_map_

TessHashMap<char32, inT64> tesseract::StringRenderer::char_map_
protected

Definition at line 213 of file stringrenderer.h.

◆ char_spacing_

double tesseract::StringRenderer::char_spacing_
protected

Definition at line 183 of file stringrenderer.h.

◆ cr_

cairo_t* tesseract::StringRenderer::cr_
protected

Definition at line 199 of file stringrenderer.h.

◆ drop_uncovered_chars_

bool tesseract::StringRenderer::drop_uncovered_chars_
protected

Definition at line 193 of file stringrenderer.h.

◆ features_

char* tesseract::StringRenderer::features_
protected

Definition at line 191 of file stringrenderer.h.

◆ font_

PangoFontInfo tesseract::StringRenderer::font_
protected

Definition at line 178 of file stringrenderer.h.

◆ font_index_

int tesseract::StringRenderer::font_index_
protected

Definition at line 215 of file stringrenderer.h.

◆ gravity_hint_strong_

bool tesseract::StringRenderer::gravity_hint_strong_
protected

Definition at line 186 of file stringrenderer.h.

◆ h_margin_

int tesseract::StringRenderer::h_margin_
protected

Definition at line 180 of file stringrenderer.h.

◆ last_offset_

int tesseract::StringRenderer::last_offset_
protected

Definition at line 216 of file stringrenderer.h.

◆ layout_

PangoLayout* tesseract::StringRenderer::layout_
protected

Definition at line 200 of file stringrenderer.h.

◆ leading_

int tesseract::StringRenderer::leading_
protected

Definition at line 184 of file stringrenderer.h.

◆ output_word_boxes_

bool tesseract::StringRenderer::output_word_boxes_
protected

Definition at line 196 of file stringrenderer.h.

◆ page_

int tesseract::StringRenderer::page_
protected

Definition at line 204 of file stringrenderer.h.

◆ page_boxes_

Boxa* tesseract::StringRenderer::page_boxes_
protected

Definition at line 210 of file stringrenderer.h.

◆ page_height_

int tesseract::StringRenderer::page_height_
protected

Definition at line 180 of file stringrenderer.h.

◆ page_width_

int tesseract::StringRenderer::page_width_
protected

Definition at line 180 of file stringrenderer.h.

◆ pen_color_

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

Definition at line 182 of file stringrenderer.h.

◆ render_fullwidth_latin_

bool tesseract::StringRenderer::render_fullwidth_latin_
protected

Definition at line 187 of file stringrenderer.h.

◆ resolution_

int tesseract::StringRenderer::resolution_
protected

Definition at line 184 of file stringrenderer.h.

◆ start_box_

int tesseract::StringRenderer::start_box_
protected

Definition at line 203 of file stringrenderer.h.

◆ strip_unrenderable_words_

bool tesseract::StringRenderer::strip_unrenderable_words_
protected

Definition at line 194 of file stringrenderer.h.

◆ surface_

cairo_surface_t* tesseract::StringRenderer::surface_
protected

Definition at line 198 of file stringrenderer.h.

◆ total_chars_

int tesseract::StringRenderer::total_chars_
protected

Definition at line 214 of file stringrenderer.h.

◆ underline_continuation_prob_

double tesseract::StringRenderer::underline_continuation_prob_
protected

Definition at line 189 of file stringrenderer.h.

◆ underline_start_prob_

double tesseract::StringRenderer::underline_start_prob_
protected

Definition at line 188 of file stringrenderer.h.

◆ underline_style_

PangoUnderline tesseract::StringRenderer::underline_style_
protected

Definition at line 190 of file stringrenderer.h.

◆ v_margin_

int tesseract::StringRenderer::v_margin_
protected

Definition at line 180 of file stringrenderer.h.

◆ vertical_text_

bool tesseract::StringRenderer::vertical_text_
protected

Definition at line 185 of file stringrenderer.h.


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