| 1372 | } |
| 1373 | |
| 1374 | static void AddBoxTohOCR(const ResultIterator* it, PageIteratorLevel level, |
| 1375 | STRING* hocr_str) { |
| 1376 | int left, top, right, bottom; |
| 1377 | it->BoundingBox(level, &left, &top, &right, &bottom); |
| 1378 | // This is the only place we use double quotes instead of single quotes, |
| 1379 | // but it may too late to change for consistency |
| 1380 | hocr_str->add_str_int(" title=\"bbox ", left); |
| 1381 | hocr_str->add_str_int(" ", top); |
| 1382 | hocr_str->add_str_int(" ", right); |
| 1383 | hocr_str->add_str_int(" ", bottom); |
| 1384 | // Add baseline coordinates & heights for textlines only. |
| 1385 | if (level == RIL_TEXTLINE) { |
| 1386 | AddBaselineCoordsTohOCR(it, level, hocr_str); |
| 1387 | // add custom height measures |
| 1388 | float row_height, descenders, ascenders; // row attributes |
| 1389 | it->RowAttributes(&row_height, &descenders, &ascenders); |
| 1390 | // TODO(rays): Do we want to limit these to a single decimal place? |
| 1391 | hocr_str->add_str_double("; x_size ", row_height); |
| 1392 | hocr_str->add_str_double("; x_descenders ", descenders * -1); |
| 1393 | hocr_str->add_str_double("; x_ascenders ", ascenders); |
| 1394 | } |
| 1395 | *hocr_str += "\">"; |
| 1396 | } |
| 1397 | |
| 1398 | static void AddBoxToTSV(const PageIterator* it, PageIteratorLevel level, |
| 1399 | STRING* hocr_str) { |
no test coverage detected