Skip to content

Commit

Permalink
Make font size estimation work with the lstm engine (#1173)
Browse files Browse the repository at this point in the history
**Partial** fix for issue #1074
  • Loading branch information
amitdo authored and zdenop committed Oct 20, 2017
1 parent fb359fc commit ad5ee18
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ccmain/ltrresultiterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,12 @@ const char* LTRResultIterator::WordFontAttributes(bool* is_bold,
bool* is_smallcaps,
int* pointsize,
int* font_id) const {
float row_height = it_->row()->row->x_height() +
it_->row()->row->ascenders() - it_->row()->row->descenders();
// Convert from pixels to printers points.
*pointsize = scaled_yres_ > 0
? static_cast<int>(row_height * kPointsPerInch / scaled_yres_ + 0.5)
: 0;
if (it_->word() == NULL) return NULL; // Already at the end!
if (it_->word()->fontinfo == NULL) {
*font_id = -1;
Expand All @@ -182,12 +188,6 @@ const char* LTRResultIterator::WordFontAttributes(bool* is_bold,
*is_monospace = font_info.is_fixed_pitch();
*is_serif = font_info.is_serif();
*is_smallcaps = it_->word()->small_caps;
float row_height = it_->row()->row->x_height() +
it_->row()->row->ascenders() - it_->row()->row->descenders();
// Convert from pixels to printers points.
*pointsize = scaled_yres_ > 0
? static_cast<int>(row_height * kPointsPerInch / scaled_yres_ + 0.5)
: 0;

return font_info.name;
}
Expand Down

0 comments on commit ad5ee18

Please sign in to comment.