Skip to content

Commit

Permalink
Merge pull request #2971 from poke1024/rowattr
Browse files Browse the repository at this point in the history
Add RowAttributes getter to PageIterator
  • Loading branch information
stweil authored Apr 12, 2021
2 parents 97079fa + 3e74c1e commit 3cedf19
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 0 additions & 8 deletions src/ccmain/ltrresultiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,6 @@ float LTRResultIterator::Confidence(PageIteratorLevel level) const {
return 0.0f;
}

void LTRResultIterator::RowAttributes(float* row_height, float* descenders,
float* ascenders) const {
*row_height = it_->row()->row->x_height() + it_->row()->row->ascenders() -
it_->row()->row->descenders();
*descenders = it_->row()->row->descenders();
*ascenders = it_->row()->row->ascenders();
}

// Returns the font attributes of the current word. If iterating at a higher
// level object than words, eg textlines, then this will return the
// attributes of the first word in that textline.
Expand Down
4 changes: 0 additions & 4 deletions src/ccmain/ltrresultiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ class TESS_API LTRResultIterator : public PageIterator {
// The number should be interpreted as a percent probability. (0.0f-100.0f)
float Confidence(PageIteratorLevel level) const;

// Returns the attributes of the current row.
void RowAttributes(float* row_height, float* descenders,
float* ascenders) const;

// ============= Functions that refer to words only ============.

// Returns the font attributes of the current word. If iterating at a higher
Expand Down
8 changes: 8 additions & 0 deletions src/ccmain/pageiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,14 @@ bool PageIterator::Baseline(PageIteratorLevel level,
return true;
}

void PageIterator::RowAttributes(float* row_height, float* descenders,
float* ascenders) const {
*row_height = it_->row()->row->x_height() + it_->row()->row->ascenders() -
it_->row()->row->descenders();
*descenders = it_->row()->row->descenders();
*ascenders = it_->row()->row->ascenders();
}

void PageIterator::Orientation(tesseract::Orientation *orientation,
tesseract::WritingDirection *writing_direction,
tesseract::TextlineOrder *textline_order,
Expand Down
4 changes: 4 additions & 0 deletions src/ccmain/pageiterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ class TESS_API PageIterator {
bool Baseline(PageIteratorLevel level,
int* x1, int* y1, int* x2, int* y2) const;

// Returns the attributes of the current row.
void RowAttributes(float* row_height, float* descenders,
float* ascenders) const;

/**
* Returns orientation for the block the iterator points to.
* orientation, writing_direction, textline_order: see publictypes.h
Expand Down

0 comments on commit 3cedf19

Please sign in to comment.