From 6e0b487ff59f17fbeaf57abd9996d6dba218caca Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Fri, 24 Aug 2012 20:21:04 +0200 Subject: [PATCH] fixed a padding bug --- src/HTMLRenderer/state.cc | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/HTMLRenderer/state.cc b/src/HTMLRenderer/state.cc index b00bae8..cc79918 100644 --- a/src/HTMLRenderer/state.cc +++ b/src/HTMLRenderer/state.cc @@ -197,8 +197,21 @@ void HTMLRenderer::check_state_change(GfxState * state) { if(abs(cur_ctm[0]) > EPS) { + //debug + html_fout<<""; + draw_tx += tdx / cur_ctm[0]; draw_ty += dy; + + //debug + html_fout<<""; + } else if (abs(cur_ctm[1]) > EPS) { @@ -323,11 +336,12 @@ void HTMLRenderer::prepare_line(GfxState * state) { new_line_status = LineStatus::DIV; } - else + + if(new_line_status != LineStatus::DIV) { // align horizontal position // try to merge with the last line if possible - double target = cur_tx - draw_tx; + double target = (cur_tx - draw_tx) * draw_scale; if(abs(target) < param->h_eps) { // ignore it @@ -335,9 +349,8 @@ void HTMLRenderer::prepare_line(GfxState * state) else { // don't close a pending span here, keep the styling - double w; - auto wid = install_whitespace(target * draw_scale, w); + auto wid = install_whitespace(target, w); html_fout << format("%2%") % wid % (target > 0 ? " " : ""); draw_tx += w / draw_scale; } @@ -358,7 +371,6 @@ void HTMLRenderer::prepare_line(GfxState * state) //resync position draw_ty = cur_ty; draw_tx = cur_tx; - } else if(new_line_status == LineStatus::SPAN) {