From 820c37607e966d28ad567e49991b75c8d5568bdc Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Thu, 16 Aug 2012 14:00:30 +0800 Subject: [PATCH] enable shift-left again, bug fixed --- src/HTMLRenderer/export.cc | 5 +++++ src/HTMLRenderer/state.cc | 4 +++- src/HTMLRenderer/text.cc | 11 +++-------- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/HTMLRenderer/export.cc b/src/HTMLRenderer/export.cc index ad477ef..efce3de 100644 --- a/src/HTMLRenderer/export.cc +++ b/src/HTMLRenderer/export.cc @@ -98,6 +98,7 @@ void HTMLRenderer::export_transform_matrix (long long tm_id, const double * tm) { allcss_fout << format(".t%|1$x|{") % tm_id; + // TODO: recognize common matices if(_tm_equal(tm, id_matrix)) { @@ -114,10 +115,14 @@ void HTMLRenderer::export_transform_matrix (long long tm_id, const double * tm) << -tm[2] << ',' << tm[3] << ','; + // we have already shifted the origin + allcss_fout << "0,0);"; + /* if(prefix == "-moz-") allcss_fout << format("%1%px,%2%px);") % tm[4] % -tm[5]; else allcss_fout << format("%1%,%2%);") % tm[4] % -tm[5]; + */ } } allcss_fout << "}" << endl; diff --git a/src/HTMLRenderer/state.cc b/src/HTMLRenderer/state.cc index db1e60d..66a19cf 100644 --- a/src/HTMLRenderer/state.cc +++ b/src/HTMLRenderer/state.cc @@ -133,7 +133,9 @@ void HTMLRenderer::check_state_change(GfxState * state) new_ctm[1] = (m1[1] * m2[0] + m1[3] * m2[1]) * hori_scale; new_ctm[2] = m1[0] * m2[2] + m1[2] * m2[3]; new_ctm[3] = m1[1] * m2[2] + m1[3] * m2[3]; - new_ctm[4] = new_ctm[5] = 0; + new_ctm[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4]; + new_ctm[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5]; + //new_ctm[4] = new_ctm[5] = 0; if(!_tm_equal(new_ctm, cur_ctm)) { diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc index 6d86260..930fb0e 100644 --- a/src/HTMLRenderer/text.cc +++ b/src/HTMLRenderer/text.cc @@ -172,14 +172,10 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s) } else { - close_cur_line(); - /* - // TODO bug // shift left // TODO, create a class for this html_fout << format("") % target; draw_tx += target / draw_scale; - */ } } @@ -214,14 +210,13 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s) } //debug - if(0) { -#if 0 +#if 1 html_fout << "\""; double x,y; state->transform(state->getCurX(), state->getCurY(), &x, &y); - html_fout << format("data-lx=\"%5%\" data-ly=\"%6%\" data-drawscale=\"%4%\" data-x=\"%1%\" data-y=\"%2%\" data-hs=\"%3%") - %x%y%(state->getHorizScaling())%draw_scale%state->getLineX()%state->getLineY(); + html_fout << format("data-lx=\"%5%\" data-ly=\"%6%\" data-draw-x=\"%7%\" data-draw-y=\"%8%\" data-drawscale=\"%4%\" data-x=\"%1%\" data-y=\"%2%\" data-hs=\"%3%") + %x%y%(state->getHorizScaling())%draw_scale%state->getLineX()%state->getLineY()%draw_tx%draw_ty; #endif }