tesseract  3.05.01
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_
 
int 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  char_spacing_(0),
104  leading_(0),
105  vertical_text_(false),
106  gravity_hint_strong_(false),
110  underline_style_(PANGO_UNDERLINE_SINGLE),
111  features_(NULL),
112  drop_uncovered_chars_(true),
114  add_ligatures_(false),
115  output_word_boxes_(false),
116  surface_(NULL),
117  cr_(NULL),
118  layout_(NULL),
119  start_box_(0),
120  page_(0),
121  box_padding_(0),
122  total_chars_(0),
123  font_index_(0),
124  last_offset_(0) {
125  pen_color_[0] = 0.0;
126  pen_color_[1] = 0.0;
127  pen_color_[2] = 0.0;
128  set_font(font_desc);
129  set_resolution(kDefaultOutputResolution);
130  page_boxes_ = NULL;
131 }
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 152 of file stringrenderer.cpp.

152  {
153  free(features_);
154  ClearBoxes();
155  FreePangoCairo();
156 }

Member Function Documentation

◆ ClearBoxes()

void tesseract::StringRenderer::ClearBoxes ( )

Definition at line 343 of file stringrenderer.cpp.

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

◆ ComputeClusterBoxes()

void tesseract::StringRenderer::ComputeClusterBoxes ( )
protected

Definition at line 468 of file stringrenderer.cpp.

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

703  {
704  string full_str;
705  const UNICHAR::const_iterator it_end = UNICHAR::end(str.c_str(),
706  str.length());
707  for (UNICHAR::const_iterator it = UNICHAR::begin(str.c_str(), str.length());
708  it != it_end; ++it) {
709  // Convert printable and non-space 7-bit ASCII characters to
710  // their fullwidth forms.
711  if (IsInterchangeValid7BitAscii(*it) && isprint(*it) && !isspace(*it)) {
712  // Convert by adding 0xFEE0 to the codepoint of 7-bit ASCII.
713  char32 full_char = *it + 0xFEE0;
714  full_str.append(EncodeAsUTF8(full_char));
715  } else {
716  full_str.append(it.utf8_data(), it.utf8_len());
717  }
718  }
719  return full_str;
720 }
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 723 of file stringrenderer.cpp.

723  {
724  string half_str;
725  UNICHAR::const_iterator it_end = UNICHAR::end(str.c_str(), str.length());
726  for (UNICHAR::const_iterator it = UNICHAR::begin(str.c_str(), str.length());
727  it != it_end; ++it) {
728  char32 half_char = FullwidthToHalfwidth(*it);
729  // Convert fullwidth Latin characters to their halfwidth forms
730  // only if halfwidth forms are printable and non-space 7-bit ASCII.
731  if (IsInterchangeValid7BitAscii(half_char) &&
732  isprint(half_char) && !isspace(half_char)) {
733  half_str.append(EncodeAsUTF8(half_char));
734  } else {
735  half_str.append(it.utf8_data(), it.utf8_len());
736  }
737  }
738  return half_str;
739 }
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 612 of file stringrenderer.cpp.

612  {
613  if (vertical_text_) {
614  const double rotation = - pango_gravity_to_rotation(
615  pango_context_get_base_gravity(pango_layout_get_context(layout_)));
618  0, boxchars->size(), boxchars);
619  } else {
621  }
622 }
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 285 of file stringrenderer.cpp.

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

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

◆ GetBoxes()

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

Definition at line 329 of file stringrenderer.cpp.

329  {
330  return boxchars_;
331 }
std::vector< BoxChar * > boxchars_

◆ GetBoxesStr()

string tesseract::StringRenderer::GetBoxesStr ( )

Definition at line 350 of file stringrenderer.cpp.

350  {
353 }
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 361 of file stringrenderer.cpp.

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

333  {
334  return page_boxes_;
335 }

◆ 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 158 of file stringrenderer.cpp.

158  {
159  FreePangoCairo();
160  surface_ = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, page_width_,
161  page_height_);
162  cr_ = cairo_create(surface_);
163  {
165  layout_ = pango_cairo_create_layout(cr_);
166  }
167 
168  if (vertical_text_) {
169  PangoContext* context = pango_layout_get_context(layout_);
170  pango_context_set_base_gravity(context, PANGO_GRAVITY_EAST);
171  if (gravity_hint_strong_) {
172  pango_context_set_gravity_hint(context, PANGO_GRAVITY_HINT_STRONG);
173  }
174  pango_layout_context_changed(layout_);
175  }
176 
178 }
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 680 of file stringrenderer.cpp.

680  {
681  string out_str;
682  const UNICHAR::const_iterator it_end = UNICHAR::end(text.c_str(),
683  text.length());
684  for (UNICHAR::const_iterator it = UNICHAR::begin(text.c_str(), text.length());
685  it != it_end; ++it) {
686  // Add the symbol to the output string.
687  out_str.append(it.utf8_data(), it.utf8_len());
688  // Check the next symbol.
689  UNICHAR::const_iterator next_it = it;
690  ++next_it;
691  bool next_char_is_boundary = (next_it == it_end || *next_it == ' ');
692  bool next_char_is_combiner = (next_it == it_end) ?
693  false : IsCombiner(*next_it);
694  if (*it != ' ' && *it != '\n' && !next_char_is_boundary &&
695  !next_char_is_combiner) {
696  out_str += kWordJoinerUTF8;
697  }
698  }
699  return out_str;
700 }
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 842 of file stringrenderer.cpp.

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

663  {
664  Pix *orig_pix = NULL;
665  int offset = RenderToImage(text, text_length, &orig_pix);
666  if (orig_pix) {
667  Pix* gray_pix = pixConvertTo8(orig_pix, false);
668  pixDestroy(&orig_pix);
669  *pix = pixThresholdToBinary(gray_pix, threshold);
670  pixDestroy(&gray_pix);
671  } else {
672  *pix = orig_pix;
673  }
674  return offset;
675 }
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 651 of file stringrenderer.cpp.

652  {
653  Pix *orig_pix = NULL;
654  int offset = RenderToImage(text, text_length, &orig_pix);
655  if (orig_pix) {
656  *pix = pixConvertTo8(orig_pix, false);
657  pixDestroy(&orig_pix);
658  }
659  return offset;
660 }
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 742 of file stringrenderer.cpp.

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

337  {
338  BoxChar::RotateBoxes(rotation, page_width_ / 2, page_height_ / 2,
339  start_box_, boxchars_.size(), &boxchars_);
340 }
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 133 of file stringrenderer.cpp.

133  {
134  bool success = font_.ParseFontDescriptionName(desc);
136  return success;
137 }
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 139 of file stringrenderer.cpp.

139  {
140  resolution_ = resolution;
141  font_.set_resolution(resolution);
142 }
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 148 of file stringrenderer.cpp.

148  {
149  underline_continuation_prob_ = min(max(frac, 0.0), 1.0);
150 }

◆ set_underline_start_prob()

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

Definition at line 144 of file stringrenderer.cpp.

144  {
145  underline_start_prob_ = min(max(frac, 0.0), 1.0);
146 }

◆ 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 180 of file stringrenderer.cpp.

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

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

624  {
625  string output_text;
626  const char* text = utf8_text->c_str();
627  int offset = 0;
628  int num_dropped = 0;
629  while (offset < utf8_text->length()) {
630  int space_len = SpanUTF8Whitespace(text + offset);
631  output_text.append(text + offset, space_len);
632  offset += space_len;
633  if (offset == utf8_text->length()) break;
634 
635  int word_len = SpanUTF8NotWhitespace(text + offset);
636  if (font_.CanRenderString(text + offset, word_len)) {
637  output_text.append(text + offset, word_len);
638  } else {
639  ++num_dropped;
640  }
641  offset += word_len;
642  }
643  utf8_text->swap(output_text);
644 
645  if (num_dropped > 0) {
646  tprintf("Stripped %d unrenderable words\n", num_dropped);
647  }
648  return num_dropped;
649 }
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 355 of file stringrenderer.cpp.

355  {
358 }
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_

int 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: