Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RowAttributes getter to PageIterator #2971

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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