[Libreoffice-commits] core.git: external/pdfium svx/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Aug 1 07:34:26 UTC 2018


 external/pdfium/0001-Add-FPDFText_GetTextRenderMode-API.patch.1         |  118 ++++++++++
 external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2       |    6 
 external/pdfium/0004-svx-support-PDF-text-color.patch.2                 |   51 ----
 external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2   |  100 --------
 external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2      |   10 
 external/pdfium/0012-svx-import-processed-PDF-text.patch.2              |   16 -
 external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2           |   24 --
 external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 |    6 
 external/pdfium/UnpackedTarball_pdfium.mk                               |    3 
 svx/source/svdraw/svdpdf.cxx                                            |   29 ++
 10 files changed, 167 insertions(+), 196 deletions(-)

New commits:
commit d8b7ac327cfe39f46aaa871cfa7a8fdc8b2b6b54
Author:     Miklos Vajna <vmiklos at collabora.co.uk>
AuthorDate: Wed Aug 1 08:34:42 2018 +0200
Commit:     Miklos Vajna <vmiklos at collabora.co.uk>
CommitDate: Wed Aug 1 09:34:02 2018 +0200

    pdfium: replace FPDFTextObj_GetColor() patch with backport
    
    Upstream already got FPDFPageObj_GetFillColor() and
    FPDFPageObj_GetStrokeColor(), so what was necessary is just a
    FPDFText_GetTextRenderMode() to find out which one to use.
    
    Change-Id: I2f31fcadee8a4377b890e01ea62ed96bce275f2b
    Reviewed-on: https://gerrit.libreoffice.org/58381
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins

diff --git a/external/pdfium/0001-Add-FPDFText_GetTextRenderMode-API.patch.1 b/external/pdfium/0001-Add-FPDFText_GetTextRenderMode-API.patch.1
new file mode 100644
index 000000000000..47874119baeb
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFText_GetTextRenderMode-API.patch.1
@@ -0,0 +1,118 @@
+From 1448cc11b9be67d2d1fcd3f2f833cc6f79ad8d42 Mon Sep 17 00:00:00 2001
+Date: Tue, 3 Jul 2018 13:52:33 +0000
+Subject: [PATCH] Add FPDFText_GetTextRenderMode() API
+
+This allows deciding if FPDFPageObj_GetFillColor() or
+FPDFPageObj_GetStrokeColor() should be used to get the effective color
+of a text object.
+
+Change-Id: Ic6e99a9eb8512b164756da8b5fcd8cd7771271ae
+Reviewed-on: https://pdfium-review.googlesource.com/36750
+Reviewed-by: dsinclair <dsinclair at chromium.org>
+Commit-Queue: dsinclair <dsinclair at chromium.org>
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp     | 17 ++++++++
+ fpdfsdk/fpdf_edittext.cpp              | 37 +++++++++++++++++
+ fpdfsdk/fpdf_view_c_api_test.c         |  1 +
+ public/fpdf_edit.h                     | 17 ++++++++
+ testing/resources/text_render_mode.pdf | 75 ++++++++++++++++++++++++++++++++++
+ 5 files changed, 147 insertions(+)
+ create mode 100644 testing/resources/text_render_mode.pdf
+
+diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
+index 3115e2a16..c552d615e 100644
+--- a/fpdfsdk/fpdf_edittext.cpp
++++ b/fpdfsdk/fpdf_edittext.cpp
+@@ -14,6 +14,7 @@
+ #include "core/fpdfapi/font/cpdf_type1font.h"
+ #include "core/fpdfapi/page/cpdf_docpagedata.h"
+ #include "core/fpdfapi/page/cpdf_textobject.h"
++#include "core/fpdfapi/page/cpdf_textstate.h"
+ #include "core/fpdfapi/parser/cpdf_array.h"
+ #include "core/fpdfapi/parser/cpdf_dictionary.h"
+ #include "core/fpdfapi/parser/cpdf_document.h"
+@@ -27,6 +28,31 @@
+ #include "fpdfsdk/cpdfsdk_helpers.h"
+ #include "public/fpdf_edit.h"
+ 
++// These checks are here because core/ and public/ cannot depend on each other.
++static_assert(static_cast<int>(TextRenderingMode::MODE_FILL) ==
++                  FPDF_TEXTRENDERMODE_FILL,
++              "TextRenderingMode::MODE_FILL value mismatch");
++static_assert(static_cast<int>(TextRenderingMode::MODE_STROKE) ==
++                  FPDF_TEXTRENDERMODE_STROKE,
++              "TextRenderingMode::MODE_STROKE value mismatch");
++static_assert(static_cast<int>(TextRenderingMode::MODE_FILL_STROKE) ==
++                  FPDF_TEXTRENDERMODE_FILL_STROKE,
++              "TextRenderingMode::MODE_FILL_STROKE value mismatch");
++static_assert(static_cast<int>(TextRenderingMode::MODE_INVISIBLE) ==
++                  FPDF_TEXTRENDERMODE_INVISIBLE,
++              "TextRenderingMode::MODE_INVISIBLE value mismatch");
++static_assert(static_cast<int>(TextRenderingMode::MODE_FILL_CLIP) ==
++                  FPDF_TEXTRENDERMODE_FILL_CLIP,
++              "TextRenderingMode::MODE_FILL_CLIP value mismatch");
++static_assert(static_cast<int>(TextRenderingMode::MODE_STROKE_CLIP) ==
++                  FPDF_TEXTRENDERMODE_STROKE_CLIP,
++              "TextRenderingMode::MODE_STROKE_CLIP value mismatch");
++static_assert(static_cast<int>(TextRenderingMode::MODE_FILL_STROKE_CLIP) ==
++                  FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP,
++              "TextRenderingMode::MODE_FILL_STROKE_CLIP value mismatch");
++static_assert(static_cast<int>(TextRenderingMode::MODE_CLIP) ==
++                  FPDF_TEXTRENDERMODE_CLIP,
++              "TextRenderingMode::MODE_CLIP value mismatch");
+ namespace {
+ 
+ CPDF_Dictionary* LoadFontDesc(CPDF_Document* pDoc,
+@@ -545,3 +571,14 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+   pTextObj->DefaultStates();
+   return FPDFPageObjectFromCPDFPageObject(pTextObj.release());
+ }
++
++FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text) {
++  if (!text)
++    return -1;
++
++  CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
++  if (!pTextObj)
++    return -1;
++
++  return static_cast<int>(pTextObj->m_TextState.GetTextMode());
++}
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index 6e613bca0..6490c18c6 100644
+--- a/public/fpdf_edit.h
++++ b/public/fpdf_edit.h
+@@ -70,6 +70,15 @@
+ #define FPDF_PRINTMODE_POSTSCRIPT2_PASSTHROUGH 4
+ #define FPDF_PRINTMODE_POSTSCRIPT3_PASSTHROUGH 5
+ 
++#define FPDF_TEXTRENDERMODE_FILL 0
++#define FPDF_TEXTRENDERMODE_STROKE 1
++#define FPDF_TEXTRENDERMODE_FILL_STROKE 2
++#define FPDF_TEXTRENDERMODE_INVISIBLE 3
++#define FPDF_TEXTRENDERMODE_FILL_CLIP 4
++#define FPDF_TEXTRENDERMODE_STROKE_CLIP 5
++#define FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP 6
++#define FPDF_TEXTRENDERMODE_CLIP 7
++
+ typedef struct FPDF_IMAGEOBJ_METADATA {
+   // The image width in pixels.
+   unsigned int width;
+@@ -1116,6 +1125,14 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+                           FPDF_FONT font,
+                           float font_size);
+ 
++// Experimental API.
++// Get the text rendering mode of a text object.
++//
++// text     - the handle to the text object.
++//
++// Returns one of the FPDF_TEXTRENDERMODE_* flags on success, -1 on error.
++FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text);
++
+ #ifdef __cplusplus
+ }  // extern "C"
+ #endif  // __cplusplus
+-- 
+2.16.4
+
diff --git a/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2 b/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
index e880d99b8619..d4f8de52b3ec 100644
--- a/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
+++ b/external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.2
@@ -40,9 +40,9 @@ index 912df63..3244943 100644
 diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
 --- a/pdfium/public/fpdf_edit.h
 +++ b/pdfium/public/fpdf_edit.h
-@@ -1116,6 +1116,15 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
-                           FPDF_FONT font,
-                           float font_size);
+@@ -1133,6 +1133,15 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+ // Returns one of the FPDF_TEXTRENDERMODE_* flags on success, -1 on error.
+ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text);
  
 +// Get the number of characters from a text object.
 +//
diff --git a/external/pdfium/0004-svx-support-PDF-text-color.patch.2 b/external/pdfium/0004-svx-support-PDF-text-color.patch.2
index a9b492891ba7..5f492007da3b 100644
--- a/external/pdfium/0004-svx-support-PDF-text-color.patch.2
+++ b/external/pdfium/0004-svx-support-PDF-text-color.patch.2
@@ -38,57 +38,6 @@ index 3244943..f8e2418 100644
    return pTxtObj->CountChars();
  }
  
-@@ -645,3 +645,23 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
-   pPageObj->SetDirty(true);
-   return true;
- }
-+
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object,
-+                           unsigned int* R,
-+                           unsigned int* G,
-+                           unsigned int* B,
-+                           unsigned int* A)
-+{
-+  CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-+  if (!pTxtObj || !R || !G || !B || !A)
-+    return false;
-+
-+  const uint32_t strokeRGB = pTxtObj->m_ColorState.GetStrokeRGB();
-+  *R = FXSYS_GetRValue(strokeRGB);
-+  *G = FXSYS_GetGValue(strokeRGB);
-+  *B = FXSYS_GetBValue(strokeRGB);
-+  *A = static_cast<unsigned int>(
-+      (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
-+  return true;
-+}
-diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
-index 602849f..fa9902e 100644
---- a/pdfium/public/fpdf_edit.h
-+++ b/pdfium/public/fpdf_edit.h
-@@ -1125,6 +1125,22 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
- FPDF_EXPORT int FPDF_CALLCONV
- FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
- 
-+// Get the stroke RGBA of a text. Range of values: 0 - 255.
-+//
-+// path   - the handle to the path object.
-+// R      - the red component of the path stroke color.
-+// G      - the green component of the path stroke color.
-+// B      - the blue component of the path stroke color.
-+// A      - the stroke alpha of the path.
-+//
-+// Returns TRUE on success.
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object,
-+                           unsigned int* R,
-+                           unsigned int* G,
-+                           unsigned int* B,
-+                           unsigned int* A);
-+
- #ifdef __cplusplus
- }  // extern "C"
- #endif  // __cplusplus
 diff --git a/pdfium/fpdfsdk/fpdf_edittext.cpp b/pdfium/fpdfsdk/fpdf_edittext.cpp
 index c38873faa..aa3287ef4 100644
 --- a/pdfium/fpdfsdk/fpdf_edittext.cpp
diff --git a/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2 b/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2
deleted file mode 100644
index c141cc4b58ea..000000000000
--- a/external/pdfium/0009-svx-support-color-text-for-imported-PDFs.patch.2
+++ /dev/null
@@ -1,100 +0,0 @@
-From 32ec9efddb8e1706085478fd8434dd2860840345 Mon Sep 17 00:00:00 2001
-From: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
-Date: Tue, 5 Jun 2018 11:33:56 +0200
-Subject: [PATCH 09/14] svx: support color text for imported PDFs
-
----
- pdfium/core/fpdfapi/page/cpdf_imageobject.cpp |  2 +-
- pdfium/core/fxge/cfx_pathdata.cpp             |  4 +--
- pdfium/fpdfsdk/fpdf_editpage.cpp              | 47 ++++++++++++++++++++++-----
- pdfium/public/fpdf_edit.h                     | 10 +++---
- 4 files changed, 46 insertions(+), 17 deletions(-)
-
-diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
-index 2249e8e..9c353a4 100644
---- a/pdfium/fpdfsdk/fpdf_editpage.cpp
-+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -733,21 +733,50 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
- }
- 
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
--FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object,
--                           unsigned int* R,
--                           unsigned int* G,
--                           unsigned int* B,
--                           unsigned int* A)
-+FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
-+                     unsigned int* R,
-+                     unsigned int* G,
-+                     unsigned int* B,
-+                     unsigned int* A)
- {
-   CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
-   if (!pTxtObj || !R || !G || !B || !A)
-     return false;
- 
--  const uint32_t strokeRGB = pTxtObj->m_ColorState.GetStrokeRGB();
--  *R = FXSYS_GetRValue(strokeRGB);
--  *G = FXSYS_GetGValue(strokeRGB);
--  *B = FXSYS_GetBValue(strokeRGB);
-+  bool bFill = false;
-+  bool bStroke = false;
-+  CPDF_Font* pFont = pTxtObj->m_TextState.GetFont();
-+  const TextRenderingMode text_render_mode = pTxtObj->m_TextState.GetTextMode();
-+  switch (text_render_mode)
-+  {
-+    case TextRenderingMode::MODE_FILL:
-+    case TextRenderingMode::MODE_FILL_CLIP:
-+      bFill = true;
-+      break;
-+    case TextRenderingMode::MODE_STROKE:
-+    case TextRenderingMode::MODE_STROKE_CLIP:
-+      if (pFont->GetFace())
-+        bStroke = true;
-+      else
-+        bFill = true;
-+      break;
-+    case TextRenderingMode::MODE_FILL_STROKE:
-+    case TextRenderingMode::MODE_FILL_STROKE_CLIP:
-+      bFill = true;
-+      if (pFont->GetFace())
-+        bStroke = true;
-+      break;
-+    case TextRenderingMode::MODE_INVISIBLE:
-+    case TextRenderingMode::MODE_CLIP:
-+      return false;
-+  }
-+
-+  const uint32_t RGB = bStroke ? pTxtObj->m_ColorState.GetStrokeRGB() : pTxtObj->m_ColorState.GetFillRGB();
-+  *R = FXSYS_GetRValue(RGB);
-+  *G = FXSYS_GetGValue(RGB);
-+  *B = FXSYS_GetBValue(RGB);
-   *A = static_cast<unsigned int>(
-       (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
-+
-   return true;
- }
-diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
-index fc906f4..4264ccd 100644
---- a/pdfium/public/fpdf_edit.h
-+++ b/pdfium/public/fpdf_edit.h
-@@ -1075,11 +1075,11 @@ FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
- //
- // Returns TRUE on success.
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
--FPDFTextObj_GetStrokeColor(FPDF_PAGEOBJECT text_object,
--                           unsigned int* R,
--                           unsigned int* G,
--                           unsigned int* B,
--                           unsigned int* A);
-+FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
-+                     unsigned int* R,
-+                     unsigned int* G,
-+                     unsigned int* B,
-+                     unsigned int* A);
- 
- #ifdef __cplusplus
- }  // extern "C"
--- 
-2.16.3
-
diff --git a/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2 b/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
index f0b09bbf7abf..21d0511bf1b6 100644
--- a/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
+++ b/external/pdfium/0010-svx-support-importing-forms-from-PDFs.patch.2
@@ -29,8 +29,8 @@ diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
 index 9c353a4..bf68250 100644
 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp
 +++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -704,3 +704,31 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
- 
+@@ -650,3 +650,31 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
+   pPageObj->SetDirty(true);
    return true;
  }
 +
@@ -65,9 +65,9 @@ diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
 index 4264ccd..ca76954 100644
 --- a/pdfium/public/fpdf_edit.h
 +++ b/pdfium/public/fpdf_edit.h
-@@ -1081,6 +1081,23 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
-                      unsigned int* B,
-                      unsigned int* A);
+@@ -1142,6 +1142,23 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text);
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
  
 +// Get number of page objects inside the form object.
 +//
diff --git a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2 b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
index cb9229939b0e..85e7662a8314 100644
--- a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
+++ b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
@@ -64,7 +64,7 @@ diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
 index f4a1688..f34d3b5 100644
 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp
 +++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -26,6 +26,7 @@
+@@ -27,6 +27,7 @@
  #include "core/fpdfapi/parser/cpdf_string.h"
  #include "core/fpdfdoc/cpdf_annot.h"
  #include "core/fpdfdoc/cpdf_annotlist.h"
@@ -72,7 +72,7 @@ index f4a1688..f34d3b5 100644
  #include "fpdfsdk/cpdfsdk_helpers.h"
  #include "public/fpdf_formfill.h"
  #include "third_party/base/logging.h"
-@@ -656,6 +657,46 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
+@@ -651,6 +652,46 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
    return true;
  }
  
@@ -116,14 +116,14 @@ index f4a1688..f34d3b5 100644
 +  return ret_count;
 +}
 +
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
- FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
-                      unsigned int* R,
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFFormObj_CountSubObjects(FPDF_PAGEOBJECT form_object)
+ {
 diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
 index f249e64..e14b2a5 100644
 --- a/pdfium/public/fpdf_edit.h
 +++ b/pdfium/public/fpdf_edit.h
-@@ -1125,6 +1125,19 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+@@ -1142,6 +1142,19 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text);
  FPDF_EXPORT int FPDF_CALLCONV
  FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
  
@@ -140,9 +140,9 @@ index f249e64..e14b2a5 100644
 +                             int char_count,
 +                             unsigned short* result);
 +
- // Get the stroke RGBA of a text. Range of values: 0 - 255.
+ // Get number of page objects inside the form object.
  //
- // path   - the handle to the path object.
+ // form_object - Handle to a form object. Returned by FPDFPage_GetObject.
 -- 
 2.16.3
 
diff --git a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2 b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
index d56c2ce69e70..e0d5ae1abff8 100644
--- a/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
+++ b/external/pdfium/0014-svx-update-PDFium-patch-and-code.patch.2
@@ -40,7 +40,7 @@ diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
 index 29c8b01..a52e1a9 100644
 --- a/pdfium/fpdfsdk/fpdf_editpage.cpp
 +++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
-@@ -693,7 +693,7 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
+@@ -688,7 +688,7 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
    int ret_count = byte_str_len / kBytesPerCharacter;
  
    ASSERT(ret_count <= char_count + 1);  // +1 to account for the NUL terminator.
@@ -49,27 +49,7 @@ index 29c8b01..a52e1a9 100644
    return ret_count;
  }
  
-@@ -736,10 +736,15 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
-       return false;
-   }
- 
--  const uint32_t RGB = bStroke ? pTxtObj->m_ColorState.GetStrokeRGB() : pTxtObj->m_ColorState.GetFillRGB();
--  *R = FXSYS_GetRValue(RGB);
--  *G = FXSYS_GetGValue(RGB);
--  *B = FXSYS_GetBValue(RGB);
-+  const CPDF_Color* pColor = bStroke ? pTxtObj->m_ColorState.GetStrokeColor() : pTxtObj->m_ColorState.GetFillColor();
-+  if (pColor == nullptr)
-+    return false;
-+
-+  int r, g, b;
-+  pColor->GetRGB(&r, &g, &b);
-+  *R = r;
-+  *G = g;
-+  *B = b;
-   *A = static_cast<unsigned int>(
-       (pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
- 
-@@ -768,7 +773,7 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
+@@ -714,7 +714,7 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
    {
      const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
      if (pObjectList)
diff --git a/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
index 699c632741ae..8943af795919 100644
--- a/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
+++ b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2
@@ -54,9 +54,9 @@ diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
 index 4351649..f858ab2 100644
 --- a/pdfium/public/fpdf_edit.h
 +++ b/pdfium/public/fpdf_edit.h
-@@ -1068,6 +1068,17 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
-                           FPDF_FONT font,
-                           float font_size);
+@@ -1133,6 +1133,17 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+ // Returns one of the FPDF_TEXTRENDERMODE_* flags on success, -1 on error.
+ FPDF_EXPORT int FPDF_CALLCONV FPDFText_GetTextRenderMode(FPDF_PAGEOBJECT text);
  
 +// Get the font name of a text object.
 +//
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index 54c82c9da749..6c5eef772da3 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -15,10 +15,11 @@ pdfium_patches += build.patch.1
 # Adds missing editing API
 # Backport of <https://pdfium-review.googlesource.com/35931>.
 pdfium_patches += 0001-Add-FPDFTextObj_GetFontSize-API.patch.patch.1
+# Backport of <https://pdfium-review.googlesource.com/36750>.
+pdfium_patches += 0001-Add-FPDFText_GetTextRenderMode-API.patch.1
 pdfium_patches += 0002-svx-more-accurate-PDF-text-importing.patch.2
 pdfium_patches += 0003-svx-import-PDF-images-as-BGRA.patch.2
 pdfium_patches += 0004-svx-support-PDF-text-color.patch.2
-pdfium_patches += 0009-svx-support-color-text-for-imported-PDFs.patch.2
 pdfium_patches += 0010-svx-support-importing-forms-from-PDFs.patch.2
 pdfium_patches += 0011-svx-correctly-possition-form-objects-from-PDF.patch.2
 pdfium_patches += 0012-svx-import-processed-PDF-text.patch.2
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 5b664eb23c65..b6bc08ce7d10 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -867,9 +867,32 @@ void ImpSdrPdfImport::ImportText(FPDF_PAGEOBJECT pPageObject, FPDF_TEXTPAGE pTex
     }
 
     Color aTextColor(COL_TRANSPARENT);
-    unsigned int nR, nG, nB, nA;
-    if (FPDFTextObj_GetColor(pPageObject, &nR, &nG, &nB, &nA))
-        aTextColor = Color(nR, nG, nB);
+    bool bFill = false;
+    bool bUse = true;
+    switch (FPDFText_GetTextRenderMode(pPageObject))
+    {
+        case FPDF_TEXTRENDERMODE_FILL:
+        case FPDF_TEXTRENDERMODE_FILL_CLIP:
+        case FPDF_TEXTRENDERMODE_FILL_STROKE:
+        case FPDF_TEXTRENDERMODE_FILL_STROKE_CLIP:
+            bFill = true;
+            break;
+        case FPDF_TEXTRENDERMODE_STROKE:
+        case FPDF_TEXTRENDERMODE_STROKE_CLIP:
+            break;
+        case FPDF_TEXTRENDERMODE_INVISIBLE:
+        case FPDF_TEXTRENDERMODE_CLIP:
+            bUse = false;
+            break;
+    }
+    if (bUse)
+    {
+        unsigned int nR, nG, nB, nA;
+        bool bRet = bFill ? FPDFPageObj_GetFillColor(pPageObject, &nR, &nG, &nB, &nA)
+                          : FPDFPageObj_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA);
+        if (bRet)
+            aTextColor = Color(nR, nG, nB);
+    }
 
     if (aTextColor != mpVD->GetTextColor())
     {


More information about the Libreoffice-commits mailing list