From 9c0b2a8a74e3be76946d9be74b5fc8abc0ed611f Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Sat, 28 Jun 2014 02:04:20 -0700 Subject: [PATCH] fix rise with optimize-text --- share/base.css.in | 1 - src/HTMLRenderer/state.cc | 4 ++-- src/HTMLRenderer/text.cc | 9 ++------- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/share/base.css.in b/share/base.css.in index 95cbd53..de71c12 100644 --- a/share/base.css.in +++ b/share/base.css.in @@ -163,7 +163,6 @@ } .@CSS_LINE_CN@ span { /* text blocks within a line */ position:relative; - vertical-align: baseline; /* _ for spaces may need display:inline, which will override this */ display:inline-block; unicode-bidi:bidi-override; /* For rtl lanauges, e.g. Hebrew, we don't want the default Unicode behaviour */ diff --git a/src/HTMLRenderer/state.cc b/src/HTMLRenderer/state.cc index 3f3d3ca..320fd81 100644 --- a/src/HTMLRenderer/state.cc +++ b/src/HTMLRenderer/state.cc @@ -382,9 +382,9 @@ void HTMLRenderer::check_state_change(GfxState * state) } // 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)) { cur_text_state.vertical_align = 0; diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc index 23c3af3..dafe510 100644 --- a/src/HTMLRenderer/text.cc +++ b/src/HTMLRenderer/text.cc @@ -26,7 +26,6 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s) return; auto font = state->getFont(); - // unscaled double cur_letter_space = state->getCharSpace(); double cur_word_space = state->getWordSpace(); 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)) { - // TODO: why multiply cur_horiz_scaling here? - html_text_page.get_cur_line()->append_unicodes(u, uLen, (dx1 * cur_font_size + cur_letter_space) * cur_horiz_scaling); + html_text_page.get_cur_line()->append_unicodes(u, uLen, (dx1 * cur_font_size + cur_letter_space)); } else { @@ -112,8 +110,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s) { 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) * cur_horiz_scaling); + html_text_page.get_cur_line()->append_unicodes(&uu, 1, (dx1 * cur_font_size + cur_letter_space)); /* * In PDF, word_space is appended if (n == 1 and *p = ' ') * 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, // 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; - dy *= cur_font_size; cur_tx += dx;