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,40 +190,45 @@ void HTMLRenderer::check_state_change(GfxState * state)
* TODO, writing mode, set dx and solve dy * TODO, writing mode, set dx and solve dy
*/ */
double dy = cur_ty - draw_ty; bool merged = false;
double tdx = old_ctm[4] - cur_ctm[4] - cur_ctm[2] * dy; if(_tm_equal(old_ctm, cur_ctm, 4))
double tdy = old_ctm[5] - cur_ctm[5] - cur_ctm[3] * dy;
if(_equal(cur_ctm[0] * tdy, cur_ctm[1] * tdx))
{ {
if(abs(cur_ctm[0]) > EPS) double dy = cur_ty - draw_ty;
double tdx = old_ctm[4] - cur_ctm[4] - cur_ctm[2] * dy;
double tdy = old_ctm[5] - cur_ctm[5] - cur_ctm[3] * dy;
if(_equal(cur_ctm[0] * tdy, cur_ctm[1] * tdx))
{ {
draw_tx += tdx / cur_ctm[0]; if(abs(cur_ctm[0]) > EPS)
draw_ty += dy;
}
else if (abs(cur_ctm[1]) > EPS)
{
draw_tx += tdy / cur_ctm[1];
draw_ty += dy;
}
else
{
if((abs(tdx) < EPS) && (abs(tdy) < EPS))
{ {
// free draw_tx += tdx / cur_ctm[0];
draw_tx = cur_tx;
draw_ty += dy; draw_ty += dy;
merged = true;
}
else if (abs(cur_ctm[1]) > EPS)
{
draw_tx += tdy / cur_ctm[1];
draw_ty += dy;
merged = true;
} }
else else
{ {
// fail if((abs(tdx) < EPS) && (abs(tdy) < EPS))
new_line_status = max(new_line_status, LineStatus::DIV); {
// free
draw_tx = cur_tx;
draw_ty += dy;
merged = true;
}
// else fail
} }
} }
//else no solution
} }
else // else force new lien
if(!merged)
{ {
// no solution
new_line_status = max(new_line_status, LineStatus::DIV); new_line_status = max(new_line_status, LineStatus::DIV);
} }
} }