Permalink
Browse files

Make font size estimation work with the lstm engine (#1173)

**Partial** fix for issue #1074
  • Loading branch information...
amitdo authored and zdenop committed Oct 20, 2017
1 parent fb359fc commit ad5ee18415bf59b9f5d1fd1806cb3aad3f18f381
Showing with 6 additions and 6 deletions.
  1. +6 −6 ccmain/ltrresultiterator.cpp
@@ -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;
@@ -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;
}

0 comments on commit ad5ee18

Please sign in to comment.