Skip to content

Commit ad5ee18

Browse files
amitdozdenop
authored andcommitted
Make font size estimation work with the lstm engine (#1173)
**Partial** fix for issue #1074
1 parent fb359fc commit ad5ee18

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

ccmain/ltrresultiterator.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,12 @@ const char* LTRResultIterator::WordFontAttributes(bool* is_bold,
169169
bool* is_smallcaps,
170170
int* pointsize,
171171
int* font_id) const {
172+
float row_height = it_->row()->row->x_height() +
173+
it_->row()->row->ascenders() - it_->row()->row->descenders();
174+
// Convert from pixels to printers points.
175+
*pointsize = scaled_yres_ > 0
176+
? static_cast<int>(row_height * kPointsPerInch / scaled_yres_ + 0.5)
177+
: 0;
172178
if (it_->word() == NULL) return NULL; // Already at the end!
173179
if (it_->word()->fontinfo == NULL) {
174180
*font_id = -1;
@@ -182,12 +188,6 @@ const char* LTRResultIterator::WordFontAttributes(bool* is_bold,
182188
*is_monospace = font_info.is_fixed_pitch();
183189
*is_serif = font_info.is_serif();
184190
*is_smallcaps = it_->word()->small_caps;
185-
float row_height = it_->row()->row->x_height() +
186-
it_->row()->row->ascenders() - it_->row()->row->descenders();
187-
// Convert from pixels to printers points.
188-
*pointsize = scaled_yres_ > 0
189-
? static_cast<int>(row_height * kPointsPerInch / scaled_yres_ + 0.5)
190-
: 0;
191191

192192
return font_info.name;
193193
}

0 commit comments

Comments
 (0)