summaryrefslogtreecommitdiff
path: root/external/pdfium
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-09-16 08:20:56 +0200
committerMiklos Vajna <vmiklos@collabora.com>2022-09-16 09:05:33 +0200
commit493b10997053882d06803156a98ae8924bf7660d (patch)
treef4f03a1a407b85fc7abb8c11a3cfbfb1e55a13e2 /external/pdfium
parentc317f0adb308b1ece3bfa8bdffb4d0bcb1478d30 (diff)
sw content controls: add PDF export of font properties
Like font name or size. Change-Id: Ie7b0d38be0ef69faf364b7c801d0bd3fdd60777a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140038 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'external/pdfium')
-rw-r--r--external/pdfium/UnpackedTarball_pdfium.mk2
-rw-r--r--external/pdfium/annot.patch.145
2 files changed, 47 insertions, 0 deletions
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index c1791ed8e823..272fa5cb606f 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -28,6 +28,8 @@ pdfium_patches += include.patch
pdfium_patches += abseil-trivial.patch
+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
new file mode 100644
index 000000000000..542cb9766ff7
--- /dev/null
+++ b/external/pdfium/annot.patch.1
@@ -0,0 +1,45 @@
+diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp
+index 349348583..54e139645 100644
+--- a/fpdfsdk/fpdf_annot.cpp
++++ b/fpdfsdk/fpdf_annot.cpp
+@@ -1223,6 +1223,26 @@ FPDFAnnot_GetFormFieldType(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot) {
+ return pFormField ? static_cast<int>(pFormField->GetFieldType()) : -1;
+ }
+
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
++FPDFAnnot_GetFormFontSize(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot, float* value) {
++ const CPDF_FormField* pFormField = GetFormField(hHandle, annot);
++ if (!pFormField) {
++ return false;
++ }
++
++ if (!value) {
++ return false;
++ }
++
++ ByteString DA;
++ if (const CPDF_Object* pObj = pFormField->GetFieldAttr(pFormField->GetDict(), "DA"))
++ DA = pObj->GetString();
++
++ CPDF_DefaultAppearance appearance(DA);
++ appearance.GetFont(value);
++ return true;
++}
++
+ FPDF_EXPORT unsigned long FPDF_CALLCONV
+ FPDFAnnot_GetFormFieldValue(FPDF_FORMHANDLE hHandle,
+ FPDF_ANNOTATION annot,
+diff --git a/public/fpdf_annot.h b/public/fpdf_annot.h
+index ccfbb0f1c..3c96b99a0 100644
+--- a/public/fpdf_annot.h
++++ b/public/fpdf_annot.h
+@@ -699,6 +699,9 @@ FPDFAnnot_GetFormFieldName(FPDF_FORMHANDLE hHandle,
+ FPDF_EXPORT int FPDF_CALLCONV
+ FPDFAnnot_GetFormFieldType(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot);
+
++FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
++FPDFAnnot_GetFormFontSize(FPDF_FORMHANDLE hHandle, FPDF_ANNOTATION annot, float* value);
++
+ // Experimental API.
+ // Gets the value of |annot|, which is an interactive form annotation.
+ // |buffer| is only modified if |buflen| is longer than the length of contents.