From 70c287a565949a7d76754f22729ecdcc80ac8d31 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Tue, 11 Sep 2012 12:26:54 +0800 Subject: [PATCH] working on bugs --- TODO | 2 ++ src/HTMLRenderer/LineBuffer.cc | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/TODO b/TODO index 0184f18..d670acb 100644 --- a/TODO +++ b/TODO @@ -1,3 +1,5 @@ +check fontforge with pkg-config first + bug found in baidu & github & mail argument auto-completion diff --git a/src/HTMLRenderer/LineBuffer.cc b/src/HTMLRenderer/LineBuffer.cc index 10f8816..a999a07 100644 --- a/src/HTMLRenderer/LineBuffer.cc +++ b/src/HTMLRenderer/LineBuffer.cc @@ -17,14 +17,30 @@ using std::max; using std::vector; using std::ostream; +// debug +GfxFont * debug_font; +double debug_width; + void HTMLRenderer::LineBuffer::reset(GfxState * state) { + //debug + debug_font = state->getFont(); + state->transform(state->getCurX(), state->getCurY(), &x, &y); tm_id = renderer->cur_tm_id; } void HTMLRenderer::LineBuffer::append_unicodes(const Unicode * u, int l) { + //debug + if(text.size() == 0) + { + if(debug_font->isCIDFont()) + debug_width = 0; + else + debug_width = dynamic_cast(debug_font)->getWidth(u[0]); + } + text.insert(text.end(), u, u+l); } @@ -150,6 +166,12 @@ void HTMLRenderer::LineBuffer::flush(void) size_t next_text_idx = min(cur_state_iter->start_idx, cur_offset_iter->start_idx); + { + double w; + auto wid = renderer->install_whitespace(debug_width, w); + out << "" << ""; + } + outputUnicodes(out, (&text.front()) + cur_text_idx, next_text_idx - cur_text_idx); cur_text_idx = next_text_idx; }