summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-07-26 21:25:11 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-07-27 09:02:15 +0200
commitf26ca9283beaa03c7155d567622281b952337488 (patch)
treec7a42d38874779491069de3f071c58a223747e75 /external
parent1108f9c9045d603cfabaf28f7ad17c3b0433cc3b (diff)
pdfium: replace FPDFTextObj_GetFontSize() patch with backport
Change-Id: I2a4bdcf506720f266344378cdcc71975de4293e0 Reviewed-on: https://gerrit.libreoffice.org/58146 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'external')
-rw-r--r--external/pdfium/0001-Add-FPDFTextObj_GetFontSize-API.patch.patch.167
-rw-r--r--external/pdfium/0002-svx-more-accurate-PDF-text-importing.patch.225
-rw-r--r--external/pdfium/0004-svx-support-PDF-text-color.patch.213
-rw-r--r--external/pdfium/0012-svx-import-processed-PDF-text.patch.24
-rw-r--r--external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.24
-rw-r--r--external/pdfium/UnpackedTarball_pdfium.mk2
6 files changed, 77 insertions, 38 deletions
diff --git a/external/pdfium/0001-Add-FPDFTextObj_GetFontSize-API.patch.patch.1 b/external/pdfium/0001-Add-FPDFTextObj_GetFontSize-API.patch.patch.1
new file mode 100644
index 000000000000..6c5dda58f76d
--- /dev/null
+++ b/external/pdfium/0001-Add-FPDFTextObj_GetFontSize-API.patch.patch.1
@@ -0,0 +1,67 @@
+From b9d88e52f8c1a4a27daab5739e6c777f2dbb655a Mon Sep 17 00:00:00 2001
+Date: Tue, 26 Jun 2018 15:12:48 +0000
+Subject: [PATCH] Add FPDFTextObj_GetFontSize() API
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+In contrast with FPDFText_GetFontSize(), this exposes the font size of
+the text object according to the text state, rather than the font size
+of a particular character.
+
+Change-Id: Iac88d1aea8fb6bb5522bdaf01363aa6d32025b8f
+Reviewed-on: https://pdfium-review.googlesource.com/35931
+Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
+Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
+---
+ fpdfsdk/fpdf_edit_embeddertest.cpp | 3 +++
+ fpdfsdk/fpdf_edittext.cpp | 11 +++++++++++
+ fpdfsdk/fpdf_view_c_api_test.c | 1 +
+ public/fpdf_edit.h | 9 +++++++++
+ 4 files changed, 24 insertions(+)
+
+diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
+index a927e16e1..e339c2412 100644
+--- a/fpdfsdk/fpdf_edittext.cpp
++++ b/fpdfsdk/fpdf_edittext.cpp
+@@ -511,6 +511,17 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_PAGEOBJECT text,
+ return true;
+ }
+
++FPDF_EXPORT double FPDF_CALLCONV FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text) {
++ if (!text)
++ return 0;
++
++ CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
++ if (!pTextObj)
++ return 0;
++
++ return pTextObj->GetFontSize();
++}
++
+ FPDF_EXPORT void FPDF_CALLCONV FPDFFont_Close(FPDF_FONT font) {
+ CPDF_Font* pFont = CPDFFontFromFPDFFont(font);
+ if (!pFont)
+diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
+index 6df5e3237..6e613bca0 100644
+--- a/public/fpdf_edit.h
++++ b/public/fpdf_edit.h
+@@ -1090,6 +1090,15 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFText_GetMatrix(FPDF_PAGEOBJECT text,
+ double* e,
+ double* f);
+
++// Experimental API.
++// Get the font size of a text object.
++//
++// text - handle to a text.
++//
++// Returns the font size of the text object, measured in points (about 1/72
++// inch) on success; 0 on failure.
++FPDF_EXPORT double FPDF_CALLCONV FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text);
++
+ // Close a loaded PDF font.
+ //
+ // font - Handle to the loaded font.
+--
+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 ef6649b5f4cb..e880d99b8619 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
@@ -20,7 +20,7 @@ index 912df63..3244943 100644
#include "core/fpdfapi/page/cpdf_form.h"
#include "core/fpdfapi/page/cpdf_formobject.h"
#include "core/fpdfapi/page/cpdf_imageobject.h"
-@@ -440,6 +441,26 @@ FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
+@@ -440,6 +441,16 @@ FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
pPageObj->Transform(matrix);
}
@@ -34,23 +34,13 @@ index 912df63..3244943 100644
+ return pTxtObj->CountChars();
+}
+
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
-+{
-+ if (!text_object)
-+ return 0;
-+
-+ CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
-+ return pTxtObj->GetFontSize();
-+}
-+
FPDF_EXPORT void FPDF_CALLCONV
FPDFPageObj_SetBlendMode(FPDF_PAGEOBJECT page_object,
FPDF_BYTESTRING blend_mode) {
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
-@@ -1107,6 +1107,26 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
+@@ -1116,6 +1116,15 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
FPDF_FONT font,
float font_size);
@@ -63,17 +53,6 @@ diff --git a/pdfium/public/fpdf_edit.h b/pdfium/public/fpdf_edit.h
+FPDF_EXPORT int FPDF_CALLCONV
+FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+
-+
-+// Get the font size of a text object.
-+//
-+// text_object - Handle of text object returned by FPDFPageObj_NewTextObj
-+// or FPDFPageObj_NewTextObjEx.
-+//
-+// Return Value:
-+// The value of the font size
-+FPDF_EXPORT int FPDF_CALLCONV
-+FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
-+
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
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 a99f8f5966dd..a9b492891ba7 100644
--- a/external/pdfium/0004-svx-support-PDF-text-color.patch.2
+++ b/external/pdfium/0004-svx-support-PDF-text-color.patch.2
@@ -38,15 +38,6 @@ index 3244943..f8e2418 100644
return pTxtObj->CountChars();
}
-@@ -453,7 +453,7 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
- if (!text_object)
- return 0;
-
-- CPDF_TextObject* pTxtObj = static_cast<CPDF_TextObject*>(text_object);
-+ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object);
- return pTxtObj->GetFontSize();
- }
-
@@ -645,3 +645,23 @@ FPDFPageObj_SetLineCap(FPDF_PAGEOBJECT page_object, int line_cap) {
pPageObj->SetDirty(true);
return true;
@@ -75,9 +66,9 @@ 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
-@@ -1016,6 +1016,22 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+@@ -1125,6 +1125,22 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
FPDF_EXPORT int FPDF_CALLCONV
- FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
+ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+// Get the stroke RGBA of a text. Range of values: 0 - 255.
+//
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 008c7047bdfa..cb9229939b0e 100644
--- a/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
+++ b/external/pdfium/0012-svx-import-processed-PDF-text.patch.2
@@ -123,9 +123,9 @@ 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
-@@ -1088,6 +1088,19 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+@@ -1125,6 +1125,19 @@ FPDFPageObj_CreateTextObj(FPDF_DOCUMENT document,
FPDF_EXPORT int FPDF_CALLCONV
- FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object);
+ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object);
+// Get the processed text of a text object.
+//
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 8eb0bac1eed2..699c632741ae 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
@@ -20,8 +20,8 @@ index a52e1a9..9daffc0 100644
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_number.h"
-@@ -458,6 +459,29 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object)
- return pTxtObj->GetFontSize();
+@@ -452,6 +453,29 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object)
+ return pTxtObj->CountChars();
}
+FPDF_EXPORT int FPDF_CALLCONV
diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk
index dc1ad7b4e221..54c82c9da749 100644
--- a/external/pdfium/UnpackedTarball_pdfium.mk
+++ b/external/pdfium/UnpackedTarball_pdfium.mk
@@ -13,6 +13,8 @@ pdfium_patches += ubsan.patch
# Fixes build on our baseline.
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
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