[Libreoffice-commits] core.git: external/poppler sdext/source

Vort vvort at yandex.ru
Tue Jan 20 05:55:39 PST 2015


 external/poppler/UnpackedTarball_poppler.mk           |    1 
 external/poppler/poppler-new-drawchar.patch.1         |   59 ++++++++++++++++++
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |    8 --
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx |    2 
 4 files changed, 64 insertions(+), 6 deletions(-)

New commits:
commit 7818c73445ad8e08e7ee51e2cc3a4b4d5a798ac4
Author: Vort <vvort at yandex.ru>
Date:   Tue Jan 20 08:48:39 2015 +0200

    fdo#85174 PDF Import: fix character positions
    
    Change-Id: I0aa75b6cb834341e47bbeeaa15d39387a8cb5240
    Reviewed-on: https://gerrit.libreoffice.org/14029
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk
index 3f9c9f8..e2a6d4c 100644
--- a/external/poppler/UnpackedTarball_poppler.mk
+++ b/external/poppler/UnpackedTarball_poppler.mk
@@ -18,6 +18,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,poppler,\
 	external/poppler/poppler-nochecknew.patch.1 \
 	external/poppler/poppler-vs2013.patch.1 \
 	external/poppler/poppler-0.26.4-std-max.patch.1 \
+	external/poppler/poppler-new-drawchar.patch.1 \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/poppler/poppler-new-drawchar.patch.1 b/external/poppler/poppler-new-drawchar.patch.1
new file mode 100644
index 0000000..bc692f5
--- /dev/null
+++ b/external/poppler/poppler-new-drawchar.patch.1
@@ -0,0 +1,59 @@
+diff -u a/poppler/Gfx.cc b/poppler/Gfx.cc
+--- a/poppler/Gfx.cc	2015-01-20 07:54:51.255889300 +0200
++++ b/poppler/Gfx.cc	2015-01-20 08:19:38.734968200 +0200
+@@ -4031,27 +4031,41 @@
+       n = font->getNextChar(p, len, &code,
+ 			    &u, &uLen,
+ 			    &dx, &dy, &originX, &originY);
++	  dx2 = dx;
++	  dy2 = dy;
+       if (wMode) {
+ 	dx *= state->getFontSize();
++	dx2 *= state->getFontSize();
+ 	dy = dy * state->getFontSize() + state->getCharSpace();
++	dy2 = dy2 * state->getFontSize();
+ 	if (n == 1 && *p == ' ') {
+ 	  dy += state->getWordSpace();
++	  dy2 += state->getWordSpace();
+ 	}
+       } else {
+ 	dx = dx * state->getFontSize() + state->getCharSpace();
++	dx2 = dx2 * state->getFontSize();
+ 	if (n == 1 && *p == ' ') {
+ 	  dx += state->getWordSpace();
++	  dx2 += state->getWordSpace();
+ 	}
+ 	dx *= state->getHorizScaling();
++	dx2 *= state->getHorizScaling();
+ 	dy *= state->getFontSize();
++	dy2 *= state->getFontSize();
+       }
+       state->textTransformDelta(dx, dy, &tdx, &tdy);
++      state->textTransformDelta(dx2, dy2, &ddx, &ddy);
+       originX *= state->getFontSize();
+       originY *= state->getFontSize();
+       state->textTransformDelta(originX, originY, &tOriginX, &tOriginY);
+       if (ocState)
++      {
++        out->drawChar2(state, state->getCurX() + riseX, state->getCurY() + riseY,
++		      ddx, ddy, tOriginX, tOriginY, code, n, u, uLen);
+         out->drawChar(state, state->getCurX() + riseX, state->getCurY() + riseY,
+ 		      tdx, tdy, tOriginX, tOriginY, code, n, u, uLen);
++      }
+       state->shift(tdx, tdy);
+       p += n;
+       len -= n;
+diff -u a/poppler/OutputDev.h b/poppler/OutputDev.h
+--- a/poppler/OutputDev.h	2014-04-26 18:37:22.000000000 +0300
++++ b/poppler/OutputDev.h	2015-01-20 08:20:22.321461200 +0200
+@@ -244,6 +244,10 @@
+ 			double /*dx*/, double /*dy*/,
+ 			double /*originX*/, double /*originY*/,
+ 			CharCode /*code*/, int /*nBytes*/, Unicode * /*u*/, int /*uLen*/) {}
++  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*/) {}
+   virtual void drawString(GfxState * /*state*/, GooString * /*s*/) {}
+   virtual GBool beginType3Char(GfxState * /*state*/, double /*x*/, double /*y*/,
+ 			       double /*dx*/, double /*dy*/,
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
index f25af86..838ada5 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx
@@ -821,12 +821,10 @@ void PDFOutDev::eoClip(GfxState *state)
 
 
     @param dx
-    horizontal skip for character (already scaled with font size) +
-    inter-char space: cursor is shifted by this amount for next char
+    horizontal skip for character
 
     @param dy
-    vertical skip for character (zero for horizontal writing mode):
-    cursor is shifted by this amount for next char
+    vertical skip for character
 
     @param originX
     local offset of character (zero for horizontal writing mode). not
@@ -836,7 +834,7 @@ 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.
  */
-void PDFOutDev::drawChar(GfxState *state, double x, double y,
+void PDFOutDev::drawChar2(GfxState *state, double x, double y,
                          double dx, double dy,
                          double originX, double originY,
                          CharCode, int /*nBytes*/, Unicode *u, int uLen)
diff --git a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
index daba445..a577e5e 100644
--- a/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
+++ b/sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx
@@ -220,7 +220,7 @@ namespace pdfi
         virtual void eoClip(GfxState *state) SAL_OVERRIDE;
 
         //----- text drawing
-        virtual void drawChar(GfxState *state, double x, double y,
+        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;


More information about the Libreoffice-commits mailing list