summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorVort <vvort@yandex.ru>2015-01-21 08:39:08 +0200
committerCaolán McNamara <caolanm@redhat.com>2015-01-21 15:32:25 +0000
commitdf54862ec61c81a39b7ccfadc292b5bf859f45fa (patch)
tree273f03834537fe0a401696082e80e2ce681ca4d2 /sdext
parent6acd5c45c764d81aea1539e66adbfadb51df0aa3 (diff)
fdo#85174 PDF Import: fix character positions without modifying poppler
Change-Id: I4ec6409e8fa13161c5cd37fcae2055b4bc5ecfd4 Reviewed-on: https://gerrit.libreoffice.org/14066 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx28
-rw-r--r--sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx7
2 files changed, 17 insertions, 18 deletions
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index e7853394506c..15454a4501b5 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -821,10 +821,12 @@ void PDFOutDev::eoClip(GfxState *state)
@param dx
- horizontal skip for character
+ horizontal skip for character (already scaled with font size) +
+ inter-char space: cursor is shifted by this amount for next char
@param dy
- vertical skip for character
+ vertical skip for character (zero for horizontal writing mode):
+ cursor is shifted by this amount for next char
@param originX
local offset of character (zero for horizontal writing mode). not
@@ -834,23 +836,27 @@ void PDFOutDev::eoClip(GfxState *state)
local offset of character (zero for horizontal writing mode). not
taken into account for output pos updates. Used for vertical writing.
*/
-#ifdef SYSTEM_POPPLER_HEADERS
void PDFOutDev::drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
CharCode, int /*nBytes*/, Unicode *u, int uLen)
-#else
-void PDFOutDev::drawChar2(GfxState *state, double x, double y,
- double dx, double dy,
- double originX, double originY,
- CharCode, int /*nBytes*/, Unicode *u, int uLen)
-#endif
{
assert(state);
if( u == NULL )
return;
+ double csdx = 0.0;
+ double csdy = 0.0;
+ if (state->getFont()->getWMode())
+ csdy = state->getCharSpace();
+ else
+ csdx = state->getCharSpace() * state->getHorizScaling();
+
+ double cstdx = 0.0;
+ double cstdy = 0.0;
+ state->textTransformDelta(csdx, csdy, &cstdx, &cstdy);
+
const double fontSize = state->getFontSize();
const double aPositionX(x-originX);
@@ -860,8 +866,8 @@ void PDFOutDev::drawChar2(GfxState *state, double x, double y,
printf( "drawChar %f %f %f %f %f %f %f %f %f ",
normalize(aPositionX),
normalize(aPositionY),
- normalize(aPositionX + dx),
- normalize(aPositionY + dy),
+ normalize(aPositionX + dx - cstdx),
+ normalize(aPositionY + dy - cstdy),
normalize(pTextMat[0]),
normalize(pTextMat[2]),
normalize(pTextMat[1]),
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
index b8414c7fb69d..daba4454a4d8 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
@@ -220,17 +220,10 @@ namespace pdfi
virtual void eoClip(GfxState *state) SAL_OVERRIDE;
//----- text drawing
-#ifdef SYSTEM_POPPLER_HEADERS
virtual void drawChar(GfxState *state, double x, double y,
double dx, double dy,
double originX, double originY,
CharCode code, int nBytes, Unicode *u, int uLen) SAL_OVERRIDE;
-#else
- virtual void drawChar2(GfxState *state, double x, double y,
- double dx, double dy,
- double originX, double originY,
- CharCode code, int nBytes, Unicode *u, int uLen) SAL_OVERRIDE;
-#endif
virtual void drawString(GfxState *state, GooString *s) SAL_OVERRIDE;
virtual void endTextObject(GfxState *state) SAL_OVERRIDE;