From b31618571938e4873dcf1cdd44eeedb40caa5bd7 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Tue, 2 May 2017 14:12:50 -0400 Subject: Add API to create a text object using a loaded font. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is already a method to add text from standard font, this CL adds an option to add text using a loaded font. The font set into a text object is ref counted and may be released, so call LoadFont on this new text obj, and add a method to close the font. This CL also improves the SetText method so that it now uses a WideString, in preparation for CID fonts with non-Latin characters. Bug: pdfium:667 Change-Id: I6829d702357d2a898a12f5297e4fd2ec993a9891 Reviewed-on: https://pdfium-review.googlesource.com/4770 Reviewed-by: Tom Sepez Commit-Queue: Nicolás Peña --- public/cpp/fpdf_deleters.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'public/cpp/fpdf_deleters.h') diff --git a/public/cpp/fpdf_deleters.h b/public/cpp/fpdf_deleters.h index d56daf5c55..238ef30e62 100644 --- a/public/cpp/fpdf_deleters.h +++ b/public/cpp/fpdf_deleters.h @@ -6,6 +6,7 @@ #define PUBLIC_CPP_FPDF_DELETERS_H_ #include "public/fpdf_dataavail.h" +#include "public/fpdf_edit.h" #include "public/fpdf_formfill.h" #include "public/fpdf_structtree.h" #include "public/fpdf_text.h" @@ -43,4 +44,8 @@ struct FPDFStructTreeDeleter { inline void operator()(FPDF_STRUCTTREE tree) { FPDF_StructTree_Close(tree); } }; +struct FPDFFontDeleter { + inline void operator()(FPDF_FONT font) { FPDFFont_Close(font); } +}; + #endif // PUBLIC_CPP_FPDF_DELETERS_H_ -- cgit v1.2.3