download.lst                                   |    4 -
 external/pdfium/Library_pdfium.mk              |    9 ++-
 external/pdfium/UnpackedTarball_pdfium.mk      |    2 
 external/pdfium/annot.patch.1                  |   65 -------------------------
 external/pdfium/build.patch.1                  |   13 +++++
 external/pdfium/inc/pch/precompiled_pdfium.hxx |   12 +++-
 vcl/source/pdf/PDFiumLibrary.cxx               |   14 ++---
 7 files changed, 36 insertions(+), 83 deletions(-)

New commits:
commit 0cde8913d8cb183224d03d5cbb37072e63e745d1
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Thu Aug 15 10:09:52 2024 +0200
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Thu Aug 15 13:19:48 2024 +0200

    Update pdfium to 6656
    
    Drop external/pdfium/annot.patch.1, it has been upstreamed as
    <https://pdfium-review.googlesource.com/c/pdfium/+/120750>.
    
    Update PDFiumPageObjectImpl::getFontName() to match
    <https://pdfium-review.googlesource.com/c/pdfium/+/121911> "Rename
    FPDFFont_GetFontName() to FPDFFont_GetFamilyName()".
    
    Extend external/pdfium/build.patch.1 to work around:
    
    > 
C:/cygwin/home/tdf/jenkins/workspace/gerrit_windows/workdir/UnpackedTarball/pdfium/fpdfsdk/fpdf_annot.cpp(1083):
 fatal error C1001: Internal compiler error.
    
    Change-Id: I94ed21265a79d484759f240f3baeb51c92365c78
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171884
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/download.lst b/download.lst
index daf1963f6ecf..59fb23e77885 100644
--- a/download.lst
+++ b/download.lst
@@ -558,8 +558,8 @@ PAGEMAKER_TARBALL := libpagemaker-0.0.4.tar.xz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-PDFIUM_SHA256SUM := 
9c2db89e9ea96f632108170bce7d901dbfc773bb09d03b7cd0ac68ebe26b9092
-PDFIUM_TARBALL := pdfium-6536.tar.bz2
+PDFIUM_SHA256SUM := 
ea2d59946fbd0c72a8b07d19bd58bb99cf66add27f5388b02d99bd7f37c13388
+PDFIUM_TARBALL := pdfium-6656.tar.bz2
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/pdfium/Library_pdfium.mk 
b/external/pdfium/Library_pdfium.mk
index 589a610e3195..285ccee80bc0 100644
--- a/external/pdfium/Library_pdfium.mk
+++ b/external/pdfium/Library_pdfium.mk
@@ -182,6 +182,9 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/Korea1/cmaps_korea1 \
     UnpackedTarball/pdfium/core/fpdfapi/cmaps/fpdf_cmaps \
     UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pagecontentgenerator \
+    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_npagetooneexporter \
+    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pageexporter \
+    UnpackedTarball/pdfium/core/fpdfapi/edit/cpdf_pageorganizer \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_cidfont \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_font \
     UnpackedTarball/pdfium/core/fpdfapi/font/cpdf_fontencoding \
@@ -440,11 +443,9 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
 
 # fxge
 $(eval $(call gb_Library_add_generated_exception_objects,pdfium,\
-    UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapcomposer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_bitmapstorer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_dibitmap \
     UnpackedTarball/pdfium/core/fxge/cfx_drawutils \
-    UnpackedTarball/pdfium/core/fxge/dib/cfx_imagerenderer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagestretcher \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_imagetransformer \
     UnpackedTarball/pdfium/core/fxge/dib/cfx_scanlinecompositor \
@@ -469,7 +470,9 @@ $(eval $(call 
gb_Library_add_generated_exception_objects,pdfium,\
     UnpackedTarball/pdfium/core/fxge/fontdata/chromefontdata/FoxitSymbol \
     UnpackedTarball/pdfium/core/fxge/freetype/fx_freetype \
     UnpackedTarball/pdfium/core/fxge/renderdevicedriver_iface \
-    UnpackedTarball/pdfium/core/fxge/agg/fx_agg_driver \
+    UnpackedTarball/pdfium/core/fxge/agg/cfx_agg_bitmapcomposer \
+    UnpackedTarball/pdfium/core/fxge/agg/cfx_agg_devicedriver \
+    UnpackedTarball/pdfium/core/fxge/agg/cfx_agg_imagerenderer \
     UnpackedTarball/pdfium/core/fxge/cfx_cliprgn \
     UnpackedTarball/pdfium/core/fxge/cfx_color \
     UnpackedTarball/pdfium/core/fxge/cfx_glyphcache \
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk 
b/external/pdfium/UnpackedTarball_pdfium.mk
index a5634f076d1d..6c5bce9b2e29 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -18,8 +18,6 @@ pdfium_patches += constexpr-template.patch
 
 pdfium_patches += system-abseil.diff
 
-pdfium_patches += annot.patch.1
-
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,pdfium,$(PDFIUM_TARBALL)))
diff --git a/external/pdfium/annot.patch.1 b/external/pdfium/annot.patch.1
deleted file mode 100644
index 330685962b4e..000000000000
--- a/external/pdfium/annot.patch.1
+++ /dev/null
@@ -1,65 +0,0 @@
-diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
-index bc1f7f7eb..075baf1df 100644
---- a/fpdfsdk/fpdf_annot.cpp
-+++ b/fpdfsdk/fpdf_annot.cpp
-@@ -1366,6 +1366,42 @@ FPDFAnnot_GetFontSize(FPDF_FORMHANDLE hHandle,
-   return true;
- }
- 
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFAnnot_GetFontColor(FPDF_FORMHANDLE hHandle,
-+                      FPDF_ANNOTATION annot,
-+                      unsigned int* R,
-+                      unsigned int* G,
-+                      unsigned int* B) {
-+  if (!R || !G || !B)
-+    return false;
-+
-+  CPDFSDK_InteractiveForm* pForm = FormHandleToInteractiveForm(hHandle);
-+  if (!pForm)
-+    return false;
-+
-+  const CPDF_Dictionary* pAnnotDict = GetAnnotDictFromFPDFAnnotation(annot);
-+  if (!pAnnotDict)
-+    return false;
-+
-+  CPDF_InteractiveForm* pPDFForm = pForm->GetInteractiveForm();
-+  CPDF_FormControl* pFormControl = pPDFForm->GetControlByDict(pAnnotDict);
-+  if (!pFormControl)
-+    return false;
-+
-+  CPDFSDK_Widget* pWidget = pForm->GetWidget(pFormControl);
-+  if (!pWidget)
-+    return false;
-+
-+  std::optional<FX_COLORREF> text_color = pWidget->GetTextColor();
-+  if (!text_color)
-+    return false;
-+
-+  *R = FXSYS_GetRValue(*text_color);
-+  *G = FXSYS_GetGValue(*text_color);
-+  *B = FXSYS_GetBValue(*text_color);
-+  return true;
-+}
-+
- FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFAnnot_IsChecked(FPDF_FORMHANDLE 
hHandle,
-                                                         FPDF_ANNOTATION 
annot) {
-   const CPDFSDK_Widget* pWidget =
-diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h
-index 337da58f1..27de4b1a8 100644
---- a/public/fpdf_annot.h
-+++ b/public/fpdf_annot.h
-@@ -845,6 +845,13 @@ FPDFAnnot_GetFontSize(FPDF_FORMHANDLE hHandle,
-                       FPDF_ANNOTATION annot,
-                       float* value);
- 
-+FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
-+FPDFAnnot_GetFontColor(FPDF_FORMHANDLE hHandle,
-+                      FPDF_ANNOTATION annot,
-+                      unsigned int* R,
-+                      unsigned int* G,
-+                      unsigned int* B);
-+
- // Experimental API.
- // Determine if |annot| is a form widget that is checked. Intended for use 
with
- // checkbox and radio button widgets.
diff --git a/external/pdfium/build.patch.1 b/external/pdfium/build.patch.1
index 8a70c96f67ee..6fe32f6b76ca 100644
--- a/external/pdfium/build.patch.1
+++ b/external/pdfium/build.patch.1
@@ -64,3 +64,16 @@ index 8026a75d5..34c20d62f 100644
  
  constexpr auto kZoomModeMaxParamCount =
      fxcrt::ToArray<const uint8_t>({0, 3, 0, 1, 1, 4, 0, 1, 1});
+--- pdfium/fpdfsdk/fpdf_annot.cpp.orig 2024-08-15 10:01:30.443712200 +0200
++++ pdfium/fpdfsdk/fpdf_annot.cpp      2024-08-15 10:04:41.161274500 +0200
+@@ -1079,8 +1079,8 @@
+   if (appearanceMode < 0 || appearanceMode >= FPDF_ANNOT_APPEARANCEMODE_COUNT)
+     return false;
+ 
+-  static constexpr auto kModeKeyForMode =
+-      fxcrt::ToArray<const char*>({"N", "R", "D"});
++  static constexpr std::array<const char*, 3UL> kModeKeyForMode
++      ({"N", "R", "D"});
+   static_assert(kModeKeyForMode.size() == FPDF_ANNOT_APPEARANCEMODE_COUNT,
+                 "length of kModeKeyForMode should be equal to "
+                 "FPDF_ANNOT_APPEARANCEMODE_COUNT");
diff --git a/external/pdfium/inc/pch/precompiled_pdfium.hxx 
b/external/pdfium/inc/pch/precompiled_pdfium.hxx
index 5b94cea8372d..ef0860bee248 100644
--- a/external/pdfium/inc/pch/precompiled_pdfium.hxx
+++ b/external/pdfium/inc/pch/precompiled_pdfium.hxx
@@ -37,6 +37,7 @@
 #include <cmath>
 #include <ctype.h>
 #include <functional>
+#include <initializer_list>
 #include <iterator>
 #include <limits.h>
 #include <limits>
@@ -53,7 +54,6 @@
 #include <setjmp.h>
 #include <sstream>
 #include <stack>
-#include <stdarg.h>
 #include <stddef.h>
 #include <stdint.h>
 #include <stdlib.h>
@@ -91,8 +91,11 @@
 #include <core/fpdfapi/cmaps/fpdf_cmaps.h>
 #include <core/fpdfapi/edit/cpdf_contentstream_write_utils.h>
 #include <core/fpdfapi/edit/cpdf_creator.h>
+#include <core/fpdfapi/edit/cpdf_npagetooneexporter.h>
 #include <core/fpdfapi/edit/cpdf_pagecontentgenerator.h>
 #include <core/fpdfapi/edit/cpdf_pagecontentmanager.h>
+#include <core/fpdfapi/edit/cpdf_pageexporter.h>
+#include <core/fpdfapi/edit/cpdf_pageorganizer.h>
 #include <core/fpdfapi/edit/cpdf_stringarchivestream.h>
 #include <core/fpdfapi/font/cfx_cttgsubtable.h>
 #include <core/fpdfapi/font/cfx_stockfontarray.h>
@@ -368,7 +371,10 @@
 #include <core/fxcrt/xml/cfx_xmlnode.h>
 #include <core/fxcrt/xml/cfx_xmlparser.h>
 #include <core/fxcrt/xml/cfx_xmltext.h>
-#include <core/fxge/agg/fx_agg_driver.h>
+#include <core/fxcrt/zip.h>
+#include <core/fxge/agg/cfx_agg_bitmapcomposer.h>
+#include <core/fxge/agg/cfx_agg_devicedriver.h>
+#include <core/fxge/agg/cfx_agg_imagerenderer.h>
 #include <core/fxge/calculate_pitch.h>
 #include <core/fxge/cfx_cliprgn.h>
 #include <core/fxge/cfx_color.h>
@@ -392,12 +398,10 @@
 #include <core/fxge/cfx_textrenderoptions.h>
 #include <core/fxge/cfx_unicodeencoding.h>
 #include <core/fxge/dib/blend.h>
-#include <core/fxge/dib/cfx_bitmapcomposer.h>
 #include <core/fxge/dib/cfx_bitmapstorer.h>
 #include <core/fxge/dib/cfx_cmyk_to_srgb.h>
 #include <core/fxge/dib/cfx_dibbase.h>
 #include <core/fxge/dib/cfx_dibitmap.h>
-#include <core/fxge/dib/cfx_imagerenderer.h>
 #include <core/fxge/dib/cfx_imagestretcher.h>
 #include <core/fxge/dib/cfx_imagetransformer.h>
 #include <core/fxge/dib/cfx_scanlinecompositor.h>
diff --git a/vcl/source/pdf/PDFiumLibrary.cxx b/vcl/source/pdf/PDFiumLibrary.cxx
index 29d95338b004..dd7abd5defd5 100644
--- a/vcl/source/pdf/PDFiumLibrary.cxx
+++ b/vcl/source/pdf/PDFiumLibrary.cxx
@@ -926,16 +926,16 @@ double PDFiumPageObjectImpl::getFontSize()
 
 OUString PDFiumPageObjectImpl::getFontName()
 {
-    OUString sFontName;
-    const int nFontName = 80 + 1;
-    std::unique_ptr<char[]> pFontName(new char[nFontName]); // + terminating 
null
+    OUString sFamilyName;
+    const int nFamilyName = 80 + 1;
+    std::unique_ptr<char[]> pFamilyName(new char[nFamilyName]); // + 
terminating null
     FPDF_FONT pFontObject = FPDFTextObj_GetFont(mpPageObject);
-    int nFontNameChars = FPDFFont_GetFontName(pFontObject, pFontName.get(), 
nFontName);
-    if (nFontName >= nFontNameChars)
+    int nFamilyNameChars = FPDFFont_GetFamilyName(pFontObject, 
pFamilyName.get(), nFamilyName);
+    if (nFamilyName >= nFamilyNameChars)
     {
-        sFontName = OUString::createFromAscii(pFontName.get());
+        sFamilyName = OUString::createFromAscii(pFamilyName.get());
     }
-    return sFontName;
+    return sFamilyName;
 }
 
 PDFTextRenderMode PDFiumPageObjectImpl::getTextRenderMode()

Reply via email to