// Copyright 2014 The PDFium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #ifndef PUBLIC_FPDF_SYSFONTINFO_H_ #define PUBLIC_FPDF_SYSFONTINFO_H_ #include <stddef.h> // clang-format off // NOLINTNEXTLINE(build/include) #include "fpdfview.h" // Character sets for the font #define FXFONT_ANSI_CHARSET … #define FXFONT_DEFAULT_CHARSET … #define FXFONT_SYMBOL_CHARSET … #define FXFONT_SHIFTJIS_CHARSET … #define FXFONT_HANGEUL_CHARSET … #define FXFONT_GB2312_CHARSET … #define FXFONT_CHINESEBIG5_CHARSET … #define FXFONT_GREEK_CHARSET … #define FXFONT_VIETNAMESE_CHARSET … #define FXFONT_HEBREW_CHARSET … #define FXFONT_ARABIC_CHARSET … #define FXFONT_CYRILLIC_CHARSET … #define FXFONT_THAI_CHARSET … #define FXFONT_EASTERNEUROPEAN_CHARSET … // Font pitch and family flags #define FXFONT_FF_FIXEDPITCH … #define FXFONT_FF_ROMAN … #define FXFONT_FF_SCRIPT … // Typical weight values #define FXFONT_FW_NORMAL … #define FXFONT_FW_BOLD … // Exported Functions #ifdef __cplusplus extern "C" { #endif // Interface: FPDF_SYSFONTINFO // Interface for getting system font information and font mapping FPDF_SYSFONTINFO; // Struct: FPDF_CharsetFontMap // Provides the name of a font to use for a given charset value. FPDF_CharsetFontMap; // Function: FPDF_GetDefaultTTFMap // Returns a pointer to the default character set to TT Font name map. The // map is an array of FPDF_CharsetFontMap structs, with its end indicated // by a { -1, NULL } entry. // Parameters: // None. // Return Value: // Pointer to the Charset Font Map. // Note: // Once FPDF_GetDefaultTTFMapCount() and FPDF_GetDefaultTTFMapEntry() are no // longer experimental, this API will be marked as deprecated. // See https://crbug.com/348468114 FPDF_EXPORT const FPDF_CharsetFontMap* FPDF_CALLCONV FPDF_GetDefaultTTFMap(); // Experimental API. // // Function: FPDF_GetDefaultTTFMapCount // Returns the number of entries in the default character set to TT Font name // map. // Parameters: // None. // Return Value: // The number of entries in the map. FPDF_EXPORT size_t FPDF_CALLCONV FPDF_GetDefaultTTFMapCount(); // Experimental API. // // Function: FPDF_GetDefaultTTFMapEntry // Returns an entry in the default character set to TT Font name map. // Parameters: // index - The index to the entry in the map to retrieve. // Return Value: // A pointer to the entry, if it is in the map, or NULL if the index is out // of bounds. FPDF_EXPORT const FPDF_CharsetFontMap* FPDF_CALLCONV FPDF_GetDefaultTTFMapEntry(size_t index); // Function: FPDF_AddInstalledFont // Add a system font to the list in PDFium. // Comments: // This function is only called during the system font list building // process. // Parameters: // mapper - Opaque pointer to Foxit font mapper // face - The font face name // charset - Font character set. See above defined constants. // Return Value: // None. FPDF_EXPORT void FPDF_CALLCONV FPDF_AddInstalledFont(void* mapper, const char* face, int charset); // Function: FPDF_SetSystemFontInfo // Set the system font info interface into PDFium // Parameters: // pFontInfo - Pointer to a FPDF_SYSFONTINFO structure // Return Value: // None // Comments: // Platform support implementation should implement required methods of // FFDF_SYSFONTINFO interface, then call this function during PDFium // initialization process. // // Call this with NULL to tell PDFium to stop using a previously set // |FPDF_SYSFONTINFO|. FPDF_EXPORT void FPDF_CALLCONV FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); // Function: FPDF_GetDefaultSystemFontInfo // Get default system font info interface for current platform // Parameters: // None // Return Value: // Pointer to a FPDF_SYSFONTINFO structure describing the default // interface, or NULL if the platform doesn't have a default interface. // Application should call FPDF_FreeDefaultSystemFontInfo to free the // returned pointer. // Comments: // For some platforms, PDFium implements a default version of system // font info interface. The default implementation can be passed to // FPDF_SetSystemFontInfo(). FPDF_EXPORT FPDF_SYSFONTINFO* FPDF_CALLCONV FPDF_GetDefaultSystemFontInfo(); // Function: FPDF_FreeDefaultSystemFontInfo // Free a default system font info interface // Parameters: // pFontInfo - Pointer to a FPDF_SYSFONTINFO structure // Return Value: // None // Comments: // This function should be called on the output from // FPDF_GetDefaultSystemFontInfo() once it is no longer needed. FPDF_EXPORT void FPDF_CALLCONV FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); #ifdef __cplusplus } #endif #endif // PUBLIC_FPDF_SYSFONTINFO_H_