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

Vort vvort at yandex.ru
Wed Jan 21 07:33:02 PST 2015


 RepositoryExternal.mk                                 |    4 -
 external/poppler/UnpackedTarball_poppler.mk           |    1 
 external/poppler/poppler-new-drawchar.patch.1         |   59 ------------------
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.cxx |   28 +++++---
 sdext/source/pdfimport/xpdfwrapper/pdfioutdev_gpl.hxx |    7 --
 5 files changed, 17 insertions(+), 82 deletions(-)

New commits:
commit df54862ec61c81a39b7ccfadc292b5bf859f45fa
Author: Vort <vvort at yandex.ru>
Date:   Wed Jan 21 08:39:08 2015 +0200

    fdo#85174 PDF Import: fix character positions without modifying poppler
    
    Change-Id: I4ec6409e8fa13161c5cd37fcae2055b4bc5ecfd4
    Reviewed-on: https://gerrit.libreoffice.org/14066
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 1968fe1..5799da2 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2628,10 +2628,6 @@ endif # ENABLE_VALGRIND
 ifneq ($(SYSTEM_POPPLER),)
 
 define gb_LinkTarget__use_poppler
-$(call gb_LinkTarget_add_defs,$(1),\
-    -DSYSTEM_POPPLER_HEADERS \
-)
-
 $(call gb_LinkTarget_set_include,$(1),\
 	$(POPPLER_CFLAGS) \
 	$$(INCLUDE) \
diff --git a/external/poppler/UnpackedTarball_poppler.mk b/external/poppler/UnpackedTarball_poppler.mk
index e2a6d4c..3f9c9f8 100644
--- a/external/poppler/UnpackedTarball_poppler.mk
+++ b/external/poppler/UnpackedTarball_poppler.mk
@@ -18,7 +18,6 @@ $(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
deleted file mode 100644
index bc692f5..0000000
--- a/external/poppler/poppler-new-drawchar.patch.1
+++ /dev/null
@@ -1,59 +0,0 @@
-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 e785339..15454a4 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 b8414c7..daba445 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;
 


More information about the Libreoffice-commits mailing list