Skip to content

Instantly share code, notes, and snippets.

@pvorb
Created April 2, 2014 12:16
Show Gist options
  • Save pvorb/9932956 to your computer and use it in GitHub Desktop.
Save pvorb/9932956 to your computer and use it in GitHub Desktop.
// BASELINE INFORMATION
if (level == PageIteratorLevel::RIL_TEXTLINE) {
int x1, y1, x2, y2;
it->Baseline(level, &x1, &y1, &x2, &y2);
int p0;
float p1;
p0 = bottom - y1;
p1 = ((float) (y1 - y2)) / (x2 - x1);
int f_size;
if (p1 > 0) f_size = 8;
else f_size = 9;
*hocr_str += "; baseline ";
char p1_str[9];
snprintf(p1_str, f_size - 1, "%f", p1);
p1_str[f_size - 1] = '\0';
*hocr_str += p1_str;
hocr_str->add_str_int(" ", p0);
}
// /BASELINE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment