1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

fixed a line merging bug

This commit is contained in:
Lu Wang 2012-08-31 23:46:59 +08:00
parent 5cf5a1c725
commit d12b8d086b

View File

@ -190,6 +190,9 @@ void HTMLRenderer::check_state_change(GfxState * state)
* TODO, writing mode, set dx and solve dy * TODO, writing mode, set dx and solve dy
*/ */
bool merged = false;
if(_tm_equal(old_ctm, cur_ctm, 4))
{
double dy = cur_ty - draw_ty; double dy = cur_ty - draw_ty;
double tdx = old_ctm[4] - cur_ctm[4] - cur_ctm[2] * dy; double tdx = old_ctm[4] - cur_ctm[4] - cur_ctm[2] * dy;
double tdy = old_ctm[5] - cur_ctm[5] - cur_ctm[3] * dy; double tdy = old_ctm[5] - cur_ctm[5] - cur_ctm[3] * dy;
@ -200,11 +203,13 @@ void HTMLRenderer::check_state_change(GfxState * state)
{ {
draw_tx += tdx / cur_ctm[0]; draw_tx += tdx / cur_ctm[0];
draw_ty += dy; draw_ty += dy;
merged = true;
} }
else if (abs(cur_ctm[1]) > EPS) else if (abs(cur_ctm[1]) > EPS)
{ {
draw_tx += tdy / cur_ctm[1]; draw_tx += tdy / cur_ctm[1];
draw_ty += dy; draw_ty += dy;
merged = true;
} }
else else
{ {
@ -213,17 +218,17 @@ void HTMLRenderer::check_state_change(GfxState * state)
// free // free
draw_tx = cur_tx; draw_tx = cur_tx;
draw_ty += dy; draw_ty += dy;
merged = true;
} }
else // else fail
}
}
//else no solution
}
// else force new lien
if(!merged)
{ {
// fail
new_line_status = max(new_line_status, LineStatus::DIV);
}
}
}
else
{
// no solution
new_line_status = max(new_line_status, LineStatus::DIV); new_line_status = max(new_line_status, LineStatus::DIV);
} }
} }