1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-22 13:00:08 +00:00

fix rise with optimize-text

This commit is contained in:
Lu Wang 2014-06-28 02:04:20 -07:00
parent fefd307016
commit 9c0b2a8a74
3 changed files with 4 additions and 10 deletions

View File

@ -163,7 +163,6 @@
} }
.@CSS_LINE_CN@ span { /* text blocks within a line */ .@CSS_LINE_CN@ span { /* text blocks within a line */
position:relative; position:relative;
vertical-align: baseline;
/* _<id> for spaces may need display:inline, which will override this */ /* _<id> for spaces may need display:inline, which will override this */
display:inline-block; display:inline-block;
unicode-bidi:bidi-override; /* For rtl lanauges, e.g. Hebrew, we don't want the default Unicode behaviour */ unicode-bidi:bidi-override; /* For rtl lanauges, e.g. Hebrew, we don't want the default Unicode behaviour */

View File

@ -382,9 +382,9 @@ void HTMLRenderer::check_state_change(GfxState * state)
} }
// else: different rotation: force new line // else: different rotation: force new line
if(merged) if(merged && !equal(state->getHorizScaling(), 0))
{ {
html_text_page.get_cur_line()->append_offset(dx * old_draw_text_scale); html_text_page.get_cur_line()->append_offset(dx * old_draw_text_scale / state->getHorizScaling());
if(equal(dy, 0)) if(equal(dy, 0))
{ {
cur_text_state.vertical_align = 0; cur_text_state.vertical_align = 0;

View File

@ -26,7 +26,6 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
return; return;
auto font = state->getFont(); auto font = state->getFont();
// unscaled
double cur_letter_space = state->getCharSpace(); double cur_letter_space = state->getCharSpace();
double cur_word_space = state->getWordSpace(); double cur_word_space = state->getWordSpace();
double cur_horiz_scaling = state->getHorizScaling(); double cur_horiz_scaling = state->getHorizScaling();
@ -98,8 +97,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
{ {
if((param.decompose_ligature) && (uLen > 1) && all_of(u, u+uLen, isLegalUnicode)) if((param.decompose_ligature) && (uLen > 1) && all_of(u, u+uLen, isLegalUnicode))
{ {
// TODO: why multiply cur_horiz_scaling here? html_text_page.get_cur_line()->append_unicodes(u, uLen, (dx1 * cur_font_size + cur_letter_space));
html_text_page.get_cur_line()->append_unicodes(u, uLen, (dx1 * cur_font_size + cur_letter_space) * cur_horiz_scaling);
} }
else else
{ {
@ -112,8 +110,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
{ {
uu = unicode_from_font(code, font); uu = unicode_from_font(code, font);
} }
// TODO: why multiply cur_horiz_scaling here? html_text_page.get_cur_line()->append_unicodes(&uu, 1, (dx1 * cur_font_size + cur_letter_space));
html_text_page.get_cur_line()->append_unicodes(&uu, 1, (dx1 * cur_font_size + cur_letter_space) * cur_horiz_scaling);
/* /*
* In PDF, word_space is appended if (n == 1 and *p = ' ') * In PDF, word_space is appended if (n == 1 and *p = ' ')
* but in HTML, word_space is appended if (uu == ' ') * but in HTML, word_space is appended if (uu == ' ')
@ -136,9 +133,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
// horiz_scaling is merged into ctm now, // horiz_scaling is merged into ctm now,
// so the coordinate system is ugly // so the coordinate system is ugly
// TODO: why multiply cur_horiz_scaling here
dx = (dx * cur_font_size + nChars * cur_letter_space + nSpaces * cur_word_space) * cur_horiz_scaling; dx = (dx * cur_font_size + nChars * cur_letter_space + nSpaces * cur_word_space) * cur_horiz_scaling;
dy *= cur_font_size; dy *= cur_font_size;
cur_tx += dx; cur_tx += dx;