diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-05-20 15:17:16 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-07 10:45:32 +0200 |
commit | 43ade4368f270594e9dd2bfd6ebab972859046df (patch) | |
tree | 462e60a81d2eb56914a76e3397b188ffdb570095 /external | |
parent | 92550f9b04785f83ee7229c815e88e847db194dc (diff) |
svx: set the font name of imported PDF text
Change-Id: I79dde3c8983a70311de2d2a46093fac2722fb372
Diffstat (limited to 'external')
-rw-r--r-- | external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 | 69 | ||||
-rw-r--r-- | external/pdfium/UnpackedTarball_pdfium.mk | 1 |
2 files changed, 70 insertions, 0 deletions
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 new file mode 100644 index 000000000000..798b2b6c1ef8 --- /dev/null +++ b/external/pdfium/0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 @@ -0,0 +1,69 @@ +From 04f9899ddf5f9691ffaca5091082183f167e95d3 Mon Sep 17 00:00:00 2001 +From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> +Date: Wed, 6 Jun 2018 06:34:56 +0200 +Subject: [PATCH] svx: set the font name of imported PDF text + +--- + pdfium/fpdfsdk/fpdf_editpage.cpp | 23 +++++++++++++++++++++++ + pdfium/public/fpdf_edit.h | 11 +++++++++++ + 2 files changed, 34 insertions(+) + +diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp +index a52e1a9..9daffc0 100644 +--- a/pdfium/fpdfsdk/fpdf_editpage.cpp ++++ b/pdfium/fpdfsdk/fpdf_editpage.cpp +@@ -648,6 +648,29 @@ FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object) + return pTxtObj->GetFontSize(); + } + ++FPDF_EXPORT int FPDF_CALLCONV ++FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result) ++{ ++ if (!text_object) ++ return 0; ++ ++ CPDF_TextObject* pTxtObj = CPDFTextObjectFromFPDFPageObject(text_object); ++ CPDF_Font* pPdfFont = pTxtObj->GetFont(); ++ if (!pPdfFont) ++ return 0; ++ ++ CFX_Font* pFont = pPdfFont->GetFont(); ++ if (!pFont) ++ return 0; ++ ++ ByteString byte_str = pFont->GetFamilyName(); ++ const size_t byte_str_len = byte_str.GetLength(); ++ ++ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len); ++ result[byte_str_len] = '\0'; ++ return byte_str_len; ++} ++ + FPDF_EXPORT void FPDF_CALLCONV + FPDFTextObj_GetMatrix(FPDF_PAGEOBJECT text_object, + double* a, +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 +@@ -1030,6 +1030,17 @@ FPDFTextObj_CountChars(FPDF_PAGEOBJECT text_object); + FPDF_EXPORT int FPDF_CALLCONV + FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text_object); + ++// Get the font name of a text object. ++// ++// text_object - Handle of text object returned by FPDFPageObj_NewTextObj ++// or FPDFPageObj_NewTextObjEx. ++// result - The result in ascii. ++// ++// Return Value: ++// The number of characters / bytes written in result. ++FPDF_EXPORT int FPDF_CALLCONV ++FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text_object, char* result); ++ + // Get the matrix of a particular text object. + // + // text_object - Handle of text object returned by FPDFPageObj_NewTextObj +-- +2.16.3 + diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index 294a6498898e..c73da438821d 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -28,6 +28,7 @@ pdfium_patches += 0011-svx-correctly-possition-form-objects-from-PDF.patch.2 pdfium_patches += 0012-svx-import-processed-PDF-text.patch.2 pdfium_patches += 0013-svx-cleanup-pdfium-importer.patch.2 pdfium_patches += 0014-svx-update-PDFium-patch-and-code.patch.2 +pdfium_patches += 0015-svx-set-the-font-name-of-imported-PDF-text.patch.2 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium)) |