1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 04:50:09 +00:00

working on bugs

This commit is contained in:
Lu Wang 2012-09-11 12:26:54 +08:00
parent e087a42c6b
commit 70c287a565
2 changed files with 24 additions and 0 deletions

2
TODO
View File

@ -1,3 +1,5 @@
check fontforge with pkg-config first
bug found in baidu & github & mail bug found in baidu & github & mail
argument auto-completion argument auto-completion

View File

@ -17,14 +17,30 @@ using std::max;
using std::vector; using std::vector;
using std::ostream; using std::ostream;
// debug
GfxFont * debug_font;
double debug_width;
void HTMLRenderer::LineBuffer::reset(GfxState * state) void HTMLRenderer::LineBuffer::reset(GfxState * state)
{ {
//debug
debug_font = state->getFont();
state->transform(state->getCurX(), state->getCurY(), &x, &y); state->transform(state->getCurX(), state->getCurY(), &x, &y);
tm_id = renderer->cur_tm_id; tm_id = renderer->cur_tm_id;
} }
void HTMLRenderer::LineBuffer::append_unicodes(const Unicode * u, int l) 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<Gfx8BitFont*>(debug_font)->getWidth(u[0]);
}
text.insert(text.end(), u, u+l); 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); 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 << "<span class=\"_ _" << wid << "\">" << "</span>";
}
outputUnicodes(out, (&text.front()) + cur_text_idx, next_text_idx - cur_text_idx); outputUnicodes(out, (&text.front()) + cur_text_idx, next_text_idx - cur_text_idx);
cur_text_idx = next_text_idx; cur_text_idx = next_text_idx;
} }