From fdb35ffb8d4bd283dd8f5905936f5c400fea3394 Mon Sep 17 00:00:00 2001 From: thestig Date: Mon, 18 Jul 2016 13:45:44 -0700 Subject: Implement CGdiPrinterDriver::DrawDeviceText(). This is sufficient to print text with GDI for PDFs generated by Chromium and cannot print any arbitrary PDF. Text that cannot be printed will be drawn as glyphs as before. BUG=409472 Review-Url: https://codereview.chromium.org/2113563003 --- public/fpdfview.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'public') diff --git a/public/fpdfview.h b/public/fpdfview.h index cea431a498..cbb577b2fd 100644 --- a/public/fpdfview.h +++ b/public/fpdfview.h @@ -211,6 +211,34 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary(); DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, FPDF_BOOL enable); +#if defined(_WIN32) && defined(PDFIUM_PRINT_TEXT_WITH_GDI) +// Pointer to a helper function to make |font| with |text| of |text_length| +// accessible when printing text with GDI. This is useful in sandboxed +// environments where PDFium's access to GDI may be restricted. +typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, + const wchar_t* text, + size_t text_length); + +// Function: FPDF_SetTypefaceAccessibleFunc +// Set the function pointer that makes GDI fonts available in sandboxed +// environments. Experimental API. +// Parameters: +// func - A function pointer. See description above. +// Return value: +// None. +DLLEXPORT void STDCALL +FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); + +// Function: FPDF_SetPrintTextWithGDI +// Set whether to use GDI to draw fonts when printing on Windows. +// Experimental API. +// Parameters: +// use_gdi - Set to true to enable printing text with GDI. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi); +#endif + // Function: FPDF_LoadDocument // Open and load a PDF document. // Parameters: -- cgit v1.2.3