From e69e9a8be83a79ae9955bf2f8dd11245cb68f8cd Mon Sep 17 00:00:00 2001 From: Duan Yao Date: Wed, 25 Jun 2014 14:32:34 +0800 Subject: [PATCH] Fix word space problem in HTMLRenderer::drawString(). --- src/HTMLRenderer/text.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/HTMLRenderer/text.cc b/src/HTMLRenderer/text.cc index 132f087..8a2fae3 100644 --- a/src/HTMLRenderer/text.cc +++ b/src/HTMLRenderer/text.cc @@ -57,7 +57,7 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s) //accumulated displacement of chars in this string, in text object space double dx = 0; double dy = 0; - //displacement of current char, in text object space + //displacement of current char, in text object space, including letter space but not word space. double ddx, ddy; //advance of current char, in glyph space double ax, ay; @@ -97,7 +97,6 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s) * There are always ugly PDF files with no useful info at all. */ is_space = true; - ddx += cur_word_space * cur_horiz_scaling; } if(is_space && (param.space_as_offset)) @@ -137,6 +136,8 @@ void HTMLRenderer::drawString(GfxState * state, GooString * s) dx += ddx; dy += ddy; + if (is_space) + dx += cur_word_space * cur_horiz_scaling; p += n; len -= n;