From 1801ec52df2f3857b40151b83179dcae389fbfdb Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Fri, 24 Aug 2012 19:15:15 +0200 Subject: [PATCH] do not use hacky zero font size --- share/all.css | 2 +- src/HTMLRenderer/state.cc | 38 +++++++++++++++++++++----------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/share/all.css b/share/all.css index 0634946..fcb171d 100644 --- a/share/all.css +++ b/share/all.css @@ -20,7 +20,7 @@ #pdf-main .l { position:absolute; white-space:pre; - font-size:0; + font-size:1px; transform-origin:0% 100%; -ms-transform-origin:0% 100%; -moz-transform-origin:0% 100%; diff --git a/src/HTMLRenderer/state.cc b/src/HTMLRenderer/state.cc index dd184a8..1ffbae9 100644 --- a/src/HTMLRenderer/state.cc +++ b/src/HTMLRenderer/state.cc @@ -320,7 +320,28 @@ void HTMLRenderer::prepare_line(GfxState * state) } if(line_status == LineStatus::NONE) + { new_line_status = LineStatus::DIV; + } + else + { + // align horizontal position + // try to merge with the last line if possible + double target = cur_tx - draw_tx; + if(abs(target) < param->h_eps) + { + // ignore it + } + else + { + // don't close a pending span here, keep the styling + + double w; + auto wid = install_whitespace(target * draw_scale, w); + html_fout << format("%2%") % wid % (target > 0 ? " " : ""); + draw_tx += w / draw_scale; + } + } if(new_line_status != LineStatus::NONE) { @@ -353,23 +374,6 @@ void HTMLRenderer::prepare_line(GfxState * state) line_status = LineStatus::SPAN; } - - // align horizontal position - // try to merge with the last line if possible - double target = cur_tx - draw_tx; - if(abs(target) < param->h_eps) - { - // ignore it - } - else - { - // don't close a pending span here, keep the styling - - double w; - auto wid = install_whitespace(target * draw_scale, w); - html_fout << format("%2%") % wid % (target > 0 ? " " : ""); - draw_tx += w / draw_scale; - } } void HTMLRenderer::close_line() {