kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 1 | // Copyright 2014 The PDFium Authors |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
| 7 | #ifndef PUBLIC_FPDF_SYSFONTINFO_H_ |
| 8 | #define PUBLIC_FPDF_SYSFONTINFO_H_ |
| 9 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 10 | // clang-format off |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 11 | // NOLINTNEXTLINE(build/include) |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 12 | #include "fpdfview.h" |
| 13 | |
| 14 | /* Character sets for the font */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 15 | #define FXFONT_ANSI_CHARSET 0 |
| 16 | #define FXFONT_DEFAULT_CHARSET 1 |
| 17 | #define FXFONT_SYMBOL_CHARSET 2 |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 18 | #define FXFONT_SHIFTJIS_CHARSET 128 |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 19 | #define FXFONT_HANGEUL_CHARSET 129 |
| 20 | #define FXFONT_GB2312_CHARSET 134 |
| 21 | #define FXFONT_CHINESEBIG5_CHARSET 136 |
kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 22 | #define FXFONT_GREEK_CHARSET 161 |
| 23 | #define FXFONT_VIETNAMESE_CHARSET 163 |
| 24 | #define FXFONT_HEBREW_CHARSET 177 |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 25 | #define FXFONT_ARABIC_CHARSET 178 |
| 26 | #define FXFONT_CYRILLIC_CHARSET 204 |
kumarashishg | 826308d | 2023-06-23 13:21:22 +0000 | [diff] [blame] | 27 | #define FXFONT_THAI_CHARSET 222 |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 28 | #define FXFONT_EASTERNEUROPEAN_CHARSET 238 |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 29 | |
| 30 | /* Font pitch and family flags */ |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 31 | #define FXFONT_FF_FIXEDPITCH (1 << 0) |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 32 | #define FXFONT_FF_ROMAN (1 << 4) |
| 33 | #define FXFONT_FF_SCRIPT (4 << 4) |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 34 | |
| 35 | /* Typical weight values */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 36 | #define FXFONT_FW_NORMAL 400 |
| 37 | #define FXFONT_FW_BOLD 700 |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 38 | |
| 39 | // Exported Functions |
| 40 | #ifdef __cplusplus |
| 41 | extern "C" { |
| 42 | #endif |
| 43 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 44 | /* |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 45 | * Interface: FPDF_SYSFONTINFO |
| 46 | * Interface for getting system font information and font mapping |
| 47 | */ |
| 48 | typedef struct _FPDF_SYSFONTINFO { |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 49 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 50 | * Version number of the interface. Currently must be 1. |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 51 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 52 | int version; |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 53 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 54 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 55 | * Method: Release |
| 56 | * Give implementation a chance to release any data after the |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 57 | * interface is no longer used. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 58 | * Interface Version: |
| 59 | * 1 |
| 60 | * Implementation Required: |
| 61 | * No |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 62 | * Parameters: |
| 63 | * pThis - Pointer to the interface structure itself |
| 64 | * Return Value: |
| 65 | * None |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 66 | * Comments: |
| 67 | * Called by PDFium during the final cleanup process. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 68 | */ |
| 69 | void (*Release)(struct _FPDF_SYSFONTINFO* pThis); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 70 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 71 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 72 | * Method: EnumFonts |
| 73 | * Enumerate all fonts installed on the system |
| 74 | * Interface Version: |
| 75 | * 1 |
| 76 | * Implementation Required: |
| 77 | * No |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 78 | * Parameters: |
| 79 | * pThis - Pointer to the interface structure itself |
| 80 | * pMapper - An opaque pointer to internal font mapper, used |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 81 | * when calling FPDF_AddInstalledFont(). |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 82 | * Return Value: |
| 83 | * None |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 84 | * Comments: |
| 85 | * Implementations should call FPDF_AddIntalledFont() function for |
| 86 | * each font found. Only TrueType/OpenType and Type1 fonts are accepted |
| 87 | * by PDFium. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 88 | */ |
| 89 | void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 90 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 91 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 92 | * Method: MapFont |
| 93 | * Use the system font mapper to get a font handle from requested |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 94 | * parameters. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 95 | * Interface Version: |
| 96 | * 1 |
| 97 | * Implementation Required: |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 98 | * Required if GetFont method is not implemented. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 99 | * Parameters: |
| 100 | * pThis - Pointer to the interface structure itself |
| 101 | * weight - Weight of the requested font. 400 is normal and |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 102 | * 700 is bold. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 103 | * bItalic - Italic option of the requested font, TRUE or |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 104 | * FALSE. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 105 | * charset - Character set identifier for the requested font. |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 106 | * See above defined constants. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 107 | * pitch_family - A combination of flags. See above defined |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 108 | * constants. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 109 | * face - Typeface name. Currently use system local encoding |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 110 | * only. |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 111 | * bExact - Obsolete: this parameter is now ignored. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 112 | * Return Value: |
| 113 | * An opaque pointer for font handle, or NULL if system mapping is |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 114 | * not supported. |
| 115 | * Comments: |
| 116 | * If the system supports native font mapper (like Windows), |
| 117 | * implementation can implement this method to get a font handle. |
| 118 | * Otherwise, PDFium will do the mapping and then call GetFont |
| 119 | * method. Only TrueType/OpenType and Type1 fonts are accepted |
| 120 | * by PDFium. |
| 121 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 122 | void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, |
| 123 | int weight, |
| 124 | FPDF_BOOL bItalic, |
| 125 | int charset, |
| 126 | int pitch_family, |
| 127 | const char* face, |
| 128 | FPDF_BOOL* bExact); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 129 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 130 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 131 | * Method: GetFont |
| 132 | * Get a handle to a particular font by its internal ID |
| 133 | * Interface Version: |
| 134 | * 1 |
| 135 | * Implementation Required: |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 136 | * Required if MapFont method is not implemented. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 137 | * Return Value: |
| 138 | * An opaque pointer for font handle. |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 139 | * Parameters: |
| 140 | * pThis - Pointer to the interface structure itself |
| 141 | * face - Typeface name in system local encoding. |
| 142 | * Comments: |
| 143 | * If the system mapping not supported, PDFium will do the font |
| 144 | * mapping and use this method to get a font handle. |
| 145 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 146 | void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 147 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 148 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 149 | * Method: GetFontData |
| 150 | * Get font data from a font |
| 151 | * Interface Version: |
| 152 | * 1 |
| 153 | * Implementation Required: |
| 154 | * Yes |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 155 | * Parameters: |
| 156 | * pThis - Pointer to the interface structure itself |
| 157 | * hFont - Font handle returned by MapFont or GetFont method |
| 158 | * table - TrueType/OpenType table identifier (refer to |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 159 | * TrueType specification), or 0 for the whole file. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 160 | * buffer - The buffer receiving the font data. Can be NULL if |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 161 | * not provided. |
| 162 | * buf_size - Buffer size, can be zero if not provided. |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 163 | * Return Value: |
| 164 | * Number of bytes needed, if buffer not provided or not large |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 165 | * enough, or number of bytes written into buffer otherwise. |
| 166 | * Comments: |
| 167 | * Can read either the full font file, or a particular |
| 168 | * TrueType/OpenType table. |
| 169 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 170 | unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis, |
| 171 | void* hFont, |
| 172 | unsigned int table, |
| 173 | unsigned char* buffer, |
| 174 | unsigned long buf_size); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 175 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 176 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 177 | * Method: GetFaceName |
| 178 | * Get face name from a font handle |
| 179 | * Interface Version: |
| 180 | * 1 |
| 181 | * Implementation Required: |
| 182 | * No |
| 183 | * Parameters: |
| 184 | * pThis - Pointer to the interface structure itself |
| 185 | * hFont - Font handle returned by MapFont or GetFont method |
| 186 | * buffer - The buffer receiving the face name. Can be NULL if |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 187 | * not provided |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 188 | * buf_size - Buffer size, can be zero if not provided |
| 189 | * Return Value: |
| 190 | * Number of bytes needed, if buffer not provided or not large |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 191 | * enough, or number of bytes written into buffer otherwise. |
| 192 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 193 | unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis, |
| 194 | void* hFont, |
| 195 | char* buffer, |
| 196 | unsigned long buf_size); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 197 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 198 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 199 | * Method: GetFontCharset |
| 200 | * Get character set information for a font handle |
| 201 | * Interface Version: |
| 202 | * 1 |
| 203 | * Implementation Required: |
| 204 | * No |
| 205 | * Parameters: |
| 206 | * pThis - Pointer to the interface structure itself |
| 207 | * hFont - Font handle returned by MapFont or GetFont method |
| 208 | * Return Value: |
| 209 | * Character set identifier. See defined constants above. |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 210 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 211 | int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 212 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 213 | /* |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 214 | * Method: DeleteFont |
| 215 | * Delete a font handle |
| 216 | * Interface Version: |
| 217 | * 1 |
| 218 | * Implementation Required: |
| 219 | * Yes |
| 220 | * Parameters: |
| 221 | * pThis - Pointer to the interface structure itself |
| 222 | * hFont - Font handle returned by MapFont or GetFont method |
| 223 | * Return Value: |
| 224 | * None |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 225 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 226 | void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 227 | } FPDF_SYSFONTINFO; |
| 228 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 229 | /* |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 230 | * Struct: FPDF_CharsetFontMap |
| 231 | * Provides the name of a font to use for a given charset value. |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 232 | */ |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 233 | typedef struct FPDF_CharsetFontMap_ { |
| 234 | int charset; // Character Set Enum value, see FXFONT_*_CHARSET above. |
| 235 | const char* fontname; // Name of default font to use with that charset. |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 236 | } FPDF_CharsetFontMap; |
| 237 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 238 | /* |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 239 | * Function: FPDF_GetDefaultTTFMap |
| 240 | * Returns a pointer to the default character set to TT Font name map. The |
| 241 | * map is an array of FPDF_CharsetFontMap structs, with its end indicated |
| 242 | * by a { -1, NULL } entry. |
| 243 | * Parameters: |
| 244 | * None. |
| 245 | * Return Value: |
| 246 | * Pointer to the Charset Font Map. |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 247 | */ |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 248 | FPDF_EXPORT const FPDF_CharsetFontMap* FPDF_CALLCONV FPDF_GetDefaultTTFMap(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 249 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 250 | /* |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 251 | * Function: FPDF_AddInstalledFont |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 252 | * Add a system font to the list in PDFium. |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 253 | * Comments: |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 254 | * This function is only called during the system font list building |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 255 | * process. |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 256 | * Parameters: |
| 257 | * mapper - Opaque pointer to Foxit font mapper |
| 258 | * face - The font face name |
| 259 | * charset - Font character set. See above defined constants. |
| 260 | * Return Value: |
| 261 | * None. |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 262 | */ |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 263 | FPDF_EXPORT void FPDF_CALLCONV FPDF_AddInstalledFont(void* mapper, |
| 264 | const char* face, |
| 265 | int charset); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 266 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 267 | /* |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 268 | * Function: FPDF_SetSystemFontInfo |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 269 | * Set the system font info interface into PDFium |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 270 | * Parameters: |
| 271 | * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure |
| 272 | * Return Value: |
| 273 | * None |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 274 | * Comments: |
| 275 | * Platform support implementation should implement required methods of |
| 276 | * FFDF_SYSFONTINFO interface, then call this function during PDFium |
| 277 | * initialization process. |
| 278 | */ |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 279 | FPDF_EXPORT void FPDF_CALLCONV |
| 280 | FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 281 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 282 | /* |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 283 | * Function: FPDF_GetDefaultSystemFontInfo |
| 284 | * Get default system font info interface for current platform |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 285 | * Parameters: |
| 286 | * None |
| 287 | * Return Value: |
Philip P. Moltmann | ac3d58c | 2016-03-04 15:19:21 -0800 | [diff] [blame] | 288 | * Pointer to a FPDF_SYSFONTINFO structure describing the default |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 289 | * interface, or NULL if the platform doesn't have a default interface. |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 290 | * Application should call FPDF_FreeDefaultSystemFontInfo to free the |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 291 | * returned pointer. |
| 292 | * Comments: |
| 293 | * For some platforms, PDFium implements a default version of system |
| 294 | * font info interface. The default implementation can be passed to |
| 295 | * FPDF_SetSystemFontInfo(). |
| 296 | */ |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 297 | FPDF_EXPORT FPDF_SYSFONTINFO* FPDF_CALLCONV FPDF_GetDefaultSystemFontInfo(); |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 298 | |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 299 | /* |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 300 | * Function: FPDF_FreeDefaultSystemFontInfo |
| 301 | * Free a default system font info interface |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 302 | * Parameters: |
| 303 | * pFontInfo - Pointer to a FPDF_SYSFONTINFO structure |
| 304 | * Return Value: |
Haibo Huang | 49cc930 | 2020-04-27 16:14:24 -0700 | [diff] [blame] | 305 | * None |
| 306 | * Comments: |
| 307 | * This function should be called on the output from |
| 308 | * FPDF_SetSystemFontInfo() once it is no longer needed. |
| 309 | */ |
Philip P. Moltmann | d904c1e | 2018-03-19 09:26:45 -0700 | [diff] [blame] | 310 | FPDF_EXPORT void FPDF_CALLCONV |
| 311 | FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); |
Philip P. Moltmann | 4d3acf4 | 2017-03-20 11:05:52 -0700 | [diff] [blame] | 312 | |
Svet Ganov | e6986e1 | 2015-06-04 14:52:15 -0700 | [diff] [blame] | 313 | #ifdef __cplusplus |
| 314 | } |
| 315 | #endif |
| 316 | |
| 317 | #endif // PUBLIC_FPDF_SYSFONTINFO_H_ |