diff options
Diffstat (limited to 'external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1')
-rw-r--r-- | external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1 | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1 b/external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1 deleted file mode 100644 index 3ddd8e6b8127..000000000000 --- a/external/pdfium/0001-Add-FPDFText_GetFontName-API.patch.1 +++ /dev/null @@ -1,87 +0,0 @@ -From 53d4f0a4526ef996caf5005ae84406a9467423f2 Mon Sep 17 00:00:00 2001 -Date: Wed, 1 Aug 2018 01:28:49 +0000 -Subject: [PATCH] Add FPDFText_GetFontName() API - -This follows the same pattern as DefaultGetFaceName(), so the client has -to call this function twice, but allocation of the string buffer happens -outside pdfium. - -Change-Id: I06b7dcd00aca9b9b94799dad3f139617d7f5451e -Reviewed-on: https://pdfium-review.googlesource.com/38870 -Commit-Queue: Lei Zhang <thestig@chromium.org> -Reviewed-by: Lei Zhang <thestig@chromium.org> -Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> ---- - fpdfsdk/fpdf_edit_embeddertest.cpp | 28 ++++++++++++++++++++++++++++ - fpdfsdk/fpdf_edittext.cpp | 22 ++++++++++++++++++++++ - fpdfsdk/fpdf_view_c_api_test.c | 1 + - public/fpdf_edit.h | 18 ++++++++++++++++++ - testing/resources/text_font.pdf | Bin 0 -> 10576 bytes - 5 files changed, 69 insertions(+) - create mode 100644 testing/resources/text_font.pdf - -diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp -index c552d615e..6aa44b3b2 100644 ---- a/fpdfsdk/fpdf_edittext.cpp -+++ b/fpdfsdk/fpdf_edittext.cpp -@@ -548,6 +548,28 @@ FPDF_EXPORT double FPDF_CALLCONV FPDFTextObj_GetFontSize(FPDF_PAGEOBJECT text) { - return pTextObj->GetFontSize(); - } - -+FPDF_EXPORT unsigned long FPDF_CALLCONV -+FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text, -+ void* buffer, -+ unsigned long length) { -+ CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text); -+ if (!pTextObj) -+ return 0; -+ -+ CPDF_Font* pPdfFont = pTextObj->GetFont(); -+ if (!pPdfFont) -+ return 0; -+ -+ CFX_Font* pFont = pPdfFont->GetFont(); -+ ASSERT(pFont); -+ -+ ByteString name = pFont->GetFamilyName(); -+ unsigned long dwStringLen = name.GetLength() + 1; -+ if (buffer && length >= dwStringLen) -+ memcpy(buffer, name.c_str(), dwStringLen); -+ return dwStringLen; -+} -+ - 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 b97a7adbd..4d5aa9c48 100644 ---- a/public/fpdf_edit.h -+++ b/public/fpdf_edit.h -@@ -1256,6 +1256,24 @@ 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); - -+// Experimental API. -+// Get the font name of a text object. -+// -+// text - the handle to the text object. -+// buffer - the address of a buffer that receives the font name. -+// length - the size, in bytes, of |buffer|. -+// -+// Returns the number of bytes in the font name (including the trailing NUL -+// character) on success, 0 on error. -+// -+// Regardless of the platform, the |buffer| is always in UTF-8 encoding. -+// If |length| is less than the returned length, or |buffer| is NULL, |buffer| -+// will not be modified. -+FPDF_EXPORT unsigned long FPDF_CALLCONV -+FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text, -+ void* buffer, -+ unsigned long length); -+ - // Experimental API. - // Get number of page objects inside |form_object|. - // --- -2.16.4 - |