@@ -209,7 +209,18 @@ char* TessBaseAPI::GetAltoText(ETEXT_DESC* monitor, int page_number) {
209
209
if (grapheme && grapheme[0 ] != 0 ) {
210
210
alto_str << HOcrEscape (grapheme.get ()).c_str ();
211
211
}
212
- alto_str << " \" />" ;
212
+ alto_str << " \" >" ;
213
+ ChoiceIterator choice_it (*res_it);
214
+ do {
215
+ int vc = choice_it.Confidence ();
216
+ alto_str << " \n\t\t\t\t\t\t\t\t\t <Variant VC=\" 0." << vc << " \" " ;
217
+ alto_str << " CONTENT=\" " ;
218
+ const char * variant = choice_it.GetUTF8Text ();
219
+ if (variant && variant[0 ] != 0 )
220
+ alto_str << HOcrEscape (variant).c_str ();
221
+ alto_str << " \" />" ;
222
+ } while (choice_it.Next ());
223
+ alto_str << " \n\t\t\t\t\t\t\t\t </Glyph>" ;
213
224
res_it->Next (RIL_SYMBOL);
214
225
215
226
scnt++;
@@ -227,8 +238,12 @@ char* TessBaseAPI::GetAltoText(ETEXT_DESC* monitor, int page_number) {
227
238
int vpos = top;
228
239
res_it->BoundingBox (RIL_WORD, &left, &top, &right, &bottom);
229
240
int width = left - hpos;
230
- alto_str << " <SP WIDTH=\" " << width << " \" VPOS=\" " << vpos
231
- << " \" HPOS=\" " << hpos << " \" />\n " ;
241
+ int height = bottom - top;
242
+ alto_str << " \n\t\t\t\t\t\t\t <SP" ;
243
+ alto_str << " HPOS=\" " << hpos << " \" " ;
244
+ alto_str << " VPOS=\" " << vpos << " \" " ;
245
+ alto_str << " WIDTH=\" " << width << " \" " ;
246
+ alto_str << " HEIGHT=\" " << height << " \" />\n " ;
232
247
}
233
248
234
249
if (last_word_in_tblock) {
0 commit comments