diff --git a/src/HTMLRenderer/general.cc b/src/HTMLRenderer/general.cc
index fea717a..a79627a 100644
--- a/src/HTMLRenderer/general.cc
+++ b/src/HTMLRenderer/general.cc
@@ -108,8 +108,8 @@ void HTMLRenderer::process(PDFDoc *doc)
zoom = *min_element(zoom_factors.begin(), zoom_factors.end());
}
- scale_factor1 = max(zoom, param->font_size_multiplier);
- scale_factor2 = zoom / scale_factor1;
+ text_scale_factor1 = max(zoom, param->font_size_multiplier);
+ text_scale_factor2 = zoom / text_scale_factor1;
}
@@ -156,7 +156,8 @@ void HTMLRenderer::process(PDFDoc *doc)
}
}
- doc->displayPage(this, i, zoom_factor() * DEFAULT_DPI, zoom_factor() * DEFAULT_DPI,
+ doc->displayPage(this, i,
+ text_zoom_factor() * DEFAULT_DPI, text_zoom_factor() * DEFAULT_DPI,
0, true, false, false,
nullptr, nullptr, nullptr, nullptr);
@@ -219,7 +220,7 @@ void HTMLRenderer::startPage(int pageNum, GfxState *state)
}
html_fout << "\">";
- draw_scale = 1.0;
+ draw_text_scale = 1.0;
cur_font_info = install_font(nullptr);
cur_font_size = draw_font_size = 0;
diff --git a/src/HTMLRenderer/link.cc b/src/HTMLRenderer/link.cc
index 968bc02..a38fc65 100644
--- a/src/HTMLRenderer/link.cc
+++ b/src/HTMLRenderer/link.cc
@@ -202,7 +202,7 @@ void HTMLRenderer::processLink(AnnotLink * al)
auto * border = al->getBorder();
if(border)
{
- border_width = border->getWidth() * zoom_factor();
+ border_width = border->getWidth();
if(border_width > 0)
{
{
diff --git a/src/HTMLRenderer/state.cc b/src/HTMLRenderer/state.cc
index 521ab12..054a807 100644
--- a/src/HTMLRenderer/state.cc
+++ b/src/HTMLRenderer/state.cc
@@ -82,7 +82,7 @@ void HTMLRenderer::check_state_change(GfxState * state)
bool need_recheck_position = false;
bool need_rescale_font = false;
- bool draw_scale_changed = false;
+ bool draw_text_scale_changed = false;
// text position
// we've been tracking the text position positively in the update*** functions
@@ -139,31 +139,31 @@ void HTMLRenderer::check_state_change(GfxState * state)
}
}
- // draw_text_tm, draw_scale
+ // draw_text_tm, draw_text_scale
// depends: font size & ctm & text_ctm & hori scale
if(need_rescale_font)
{
double new_draw_text_tm[6];
memcpy(new_draw_text_tm, cur_text_tm, sizeof(new_draw_text_tm));
- double new_draw_scale = 1.0/scale_factor2 * sqrt(new_draw_text_tm[2] * new_draw_text_tm[2] + new_draw_text_tm[3] * new_draw_text_tm[3]);
+ double new_draw_text_scale = 1.0/text_scale_factor2 * sqrt(new_draw_text_tm[2] * new_draw_text_tm[2] + new_draw_text_tm[3] * new_draw_text_tm[3]);
double new_draw_font_size = cur_font_size;
- if(_is_positive(new_draw_scale))
+ if(_is_positive(new_draw_text_scale))
{
- new_draw_font_size *= new_draw_scale;
+ new_draw_font_size *= new_draw_text_scale;
for(int i = 0; i < 4; ++i)
- new_draw_text_tm[i] /= new_draw_scale;
+ new_draw_text_tm[i] /= new_draw_text_scale;
}
else
{
- new_draw_scale = 1.0;
+ new_draw_text_scale = 1.0;
}
- if(!(_equal(new_draw_scale, draw_scale)))
+ if(!(_equal(new_draw_text_scale, draw_text_scale)))
{
- draw_scale_changed = true;
- draw_scale = new_draw_scale;
+ draw_text_scale_changed = true;
+ draw_text_scale = new_draw_text_scale;
}
if(!(_equal(new_draw_font_size, draw_font_size)))
@@ -241,28 +241,28 @@ void HTMLRenderer::check_state_change(GfxState * state)
}
// letter space
- // depends: draw_scale
- if(all_changed || letter_space_changed || draw_scale_changed)
+ // depends: draw_text_scale
+ if(all_changed || letter_space_changed || draw_text_scale_changed)
{
double new_letter_space = state->getCharSpace();
if(!_equal(cur_letter_space, new_letter_space))
{
new_line_state = max(new_line_state, NLS_SPAN);
cur_letter_space = new_letter_space;
- cur_ls_id = install_letter_space(cur_letter_space * draw_scale);
+ cur_ls_id = install_letter_space(cur_letter_space * draw_text_scale);
}
}
// word space
- // depends draw_scale
- if(all_changed || word_space_changed || draw_scale_changed)
+ // depends draw_text_scale
+ if(all_changed || word_space_changed || draw_text_scale_changed)
{
double new_word_space = state->getWordSpace();
if(!_equal(cur_word_space, new_word_space))
{
new_line_state = max(new_line_state, NLS_SPAN);
cur_word_space = new_word_space;
- cur_ws_id = install_word_space(cur_word_space * draw_scale);
+ cur_ws_id = install_word_space(cur_word_space * draw_text_scale);
}
}
@@ -280,15 +280,15 @@ void HTMLRenderer::check_state_change(GfxState * state)
}
// rise
- // depends draw_scale
- if(all_changed || rise_changed || draw_scale_changed)
+ // depends draw_text_scale
+ if(all_changed || rise_changed || draw_text_scale_changed)
{
double new_rise = state->getRise();
if(!_equal(cur_rise, new_rise))
{
new_line_state = max(new_line_state, NLS_SPAN);
cur_rise = new_rise;
- cur_rise_id = install_rise(new_rise * draw_scale);
+ cur_rise_id = install_rise(new_rise * draw_text_scale);
}
}
@@ -333,7 +333,7 @@ void HTMLRenderer::prepare_text_line(GfxState * state)
{
// align horizontal position
// try to merge with the last line if possible
- double target = (cur_tx - draw_tx) * draw_scale;
+ double target = (cur_tx - draw_tx) * draw_text_scale;
if(abs(target) < param->h_eps)
{
// ignore it
@@ -341,7 +341,7 @@ void HTMLRenderer::prepare_text_line(GfxState * state)
else
{
line_buf.append_offset(target);
- draw_tx += target / draw_scale;
+ draw_tx += target / draw_text_scale;
}
}
diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc
index 3b9b179..1a6e323 100644
--- a/src/HTMLRenderer/text.cc
+++ b/src/HTMLRenderer/text.cc
@@ -522,7 +522,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s)
if(is_space && (param->space_as_offset))
{
// ignore horiz_scaling, as it's merged in CTM
- line_buf.append_offset((dx1 * cur_font_size + cur_letter_space + cur_word_space) * draw_scale);
+ line_buf.append_offset((dx1 * cur_font_size + cur_letter_space + cur_word_space) * draw_text_scale);
}
else
{
diff --git a/src/ffw.c b/src/ffw.c
index dc8e913..2bdef39 100644
--- a/src/ffw.c
+++ b/src/ffw.c
@@ -332,15 +332,11 @@ void ffw_set_widths(int * width_list, int mapping_len, int stretch_narrow, int s
SplineChar * sc = sf->glyphs[j];
if(sc == NULL) continue;
- DBounds bb;
- SplineCharFindBounds(sc, &bb);
-
- double glyph_width = bb.maxx - bb.minx;
- if((glyph_width > EPS)
- && (((glyph_width > width_list[i] + EPS) && (squeeze_wide))
- || ((glyph_width < width_list[i] - EPS) && (stretch_narrow))))
+ if(((sc->width > EPS)
+ && (((sc->width > width_list[i] + EPS) && (squeeze_wide))
+ || ((sc->width < width_list[i] - EPS) && (stretch_narrow)))))
{
- real transform[6]; transform[0] = ((double)width_list[i]) / glyph_width;
+ real transform[6]; transform[0] = ((double)width_list[i]) / (sc->width);
transform[3] = 1.0;
transform[1] = transform[2] = transform[4] = transform[5] = 0;
FVTrans(cur_fv, sc, transform, NULL, fvt_alllayers | fvt_dontmovewidth);
diff --git a/src/include/HTMLRenderer.h b/src/include/HTMLRenderer.h
index b102a4f..9ebc872 100644
--- a/src/include/HTMLRenderer.h
+++ b/src/include/HTMLRenderer.h
@@ -237,9 +237,9 @@ class HTMLRenderer : public OutputDev
* factor1 & factor 2 are determined according to zoom and font-size-multiplier
*
*/
- double zoom_factor (void) const { return scale_factor1 * scale_factor2; }
- double scale_factor1;
- double scale_factor2;
+ double text_zoom_factor (void) const { return text_scale_factor1 * text_scale_factor2; }
+ double text_scale_factor1;
+ double text_scale_factor2;
////////////////////////////////////////////////////
@@ -301,11 +301,11 @@ class HTMLRenderer : public OutputDev
// we try to render the final font size directly
// to reduce the effect of ctm as much as possible
- // draw_ctm is cur_ctm scaled by 1/draw_scale,
- // so everything redenered should be multiplied by draw_scale
+ // draw_ctm is cur_ctm scaled by 1/draw_text_scale,
+ // so everything redenered should be multiplied by draw_text_scale
double draw_text_tm[6];
double draw_font_size;
- double draw_scale;
+ double draw_text_scale;
// the position of next char, in text coords
// this is actual position (in HTML), which might be different from cur_tx/ty (in PDF)