| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 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 _FPDF_SYSFONTINFO_H | |
| 8 #define _FPDF_SYSFONTINFO_H | |
| 9 | |
| 10 #include "fpdfview.h" | |
| 11 | |
| 12 /* Character sets for the font */ | |
| 13 #define FXFONT_ANSI_CHARSET 0 | |
| 14 #define FXFONT_DEFAULT_CHARSET 1 | |
| 15 #define FXFONT_SYMBOL_CHARSET 2 | |
| 16 #define FXFONT_SHIFTJIS_CHARSET 128 | |
| 17 #define FXFONT_HANGEUL_CHARSET 129 | |
| 18 #define FXFONT_GB2312_CHARSET 134 | |
| 19 #define FXFONT_CHINESEBIG5_CHARSET 136 | |
| 20 | |
| 21 /* Font pitch and family flags */ | |
| 22 #define FXFONT_FF_FIXEDPITCH 1 | |
| 23 #define FXFONT_FF_ROMAN (1<<4) | |
| 24 #define FXFONT_FF_SCRIPT (4<<4) | |
| 25 | |
| 26 /* Typical weight values */ | |
| 27 #define FXFONT_FW_NORMAL 400 | |
| 28 #define FXFONT_FW_BOLD 700 | |
| 29 | |
| 30 // Exported Functions | |
| 31 #ifdef __cplusplus | |
| 32 extern "C" { | |
| 33 #endif | |
| 34 | |
| 35 | |
| 36 /** | |
| 37 * Interface: FPDF_SYSFONTINFO | |
| 38 * Interface for getting system font information and font m
apping | |
| 39 */ | |
| 40 typedef struct _FPDF_SYSFONTINFO { | |
| 41 /** | |
| 42 * Version number of the interface. Currently must be 1. | |
| 43 **/ | |
| 44 int version; | |
| 45 | |
| 46 /** | |
| 47 * Method: Release | |
| 48 * Give implementation a chance to release any data
after the interface is no longer used | |
| 49 * Interface Version: | |
| 50 * 1 | |
| 51 * Implementation Required: | |
| 52 * No | |
| 53 * Comments: | |
| 54 * Called by Foxit SDK during the final cleanup pro
cess. | |
| 55 * Parameters: | |
| 56 * pThis - Pointer to the interface
structure itself | |
| 57 * Return Value: | |
| 58 * None | |
| 59 */ | |
| 60 void (*Release)(struct _FPDF_SYSFONTINFO* pThis); | |
| 61 | |
| 62 /** | |
| 63 * Method: EnumFonts | |
| 64 * Enumerate all fonts installed on the system | |
| 65 * Interface Version: | |
| 66 * 1 | |
| 67 * Implementation Required: | |
| 68 * No | |
| 69 * Comments: | |
| 70 * Implementation should call FPDF_AddIntalledFont(
) function for each font found. | |
| 71 * Only TrueType/OpenType and Type1 fonts are accep
ted by Foxit SDK. | |
| 72 * Parameters: | |
| 73 * pThis - Pointer to the interface
structure itself | |
| 74 * pMapper - An opaque pointer to int
ernal font mapper, used when calling FPDF_AddInstalledFont | |
| 75 * Return Value: | |
| 76 * None | |
| 77 */ | |
| 78 void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper); | |
| 79 | |
| 80 /** | |
| 81 * Method: MapFont | |
| 82 * Use the system font mapper to get a font handle
from requested parameters | |
| 83 * Interface Version: | |
| 84 * 1 | |
| 85 * Implementation Required: | |
| 86 * Yes only if GetFont method is not implemented. | |
| 87 * Comments: | |
| 88 * If the system supports native font mapper (like
Windows), implementation can implement this method to get a font handle. | |
| 89 * Otherwise, Foxit SDK will do the mapping and the
n call GetFont method. | |
| 90 * Only TrueType/OpenType and Type1 fonts are accep
ted by Foxit SDK. | |
| 91 * Parameters: | |
| 92 * pThis - Pointer to the interface
structure itself | |
| 93 * weight - Weight of the requested
font. 400 is normal and 700 is bold. | |
| 94 * bItalic - Italic option of the req
uested font, TRUE or FALSE. | |
| 95 * charset - Character set identifier
for the requested font. See above defined constants. | |
| 96 * pitch_family - A combination of flags. See abov
e defined constants. | |
| 97 * face - Typeface name. Currently
use system local encoding only. | |
| 98 * bExact - Pointer to an boolean va
lue receiving the indicator whether mapper found the exact match. | |
| 99 * If mapper is not
sure whether it's exact match, ignore this paramter. | |
| 100 * Return Value: | |
| 101 * An opaque pointer for font handle, or NULL if sy
stem mapping is not supported. | |
| 102 **/ | |
| 103 void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, int weight, int bItali
c, int charset, int pitch_family, | |
| 104 const char* face, int* bExact); | |
| 105 | |
| 106 /** | |
| 107 * Method: GetFont | |
| 108 * Get a handle to a particular font by its interna
l ID | |
| 109 * Interface Version: | |
| 110 * 1 | |
| 111 * Implementation Required: | |
| 112 * Yes only if MapFont method is not implemented. | |
| 113 * Comments: | |
| 114 * If the system mapping not supported, Foxit SDK w
ill do the font mapping and use this method to get a font handle. | |
| 115 * Parameters: | |
| 116 * pThis - Pointer to the interface
structure itself | |
| 117 * face - Typeface name. Currently
use system local encoding only. | |
| 118 * Return Value: | |
| 119 * An opaque pointer for font handle. | |
| 120 **/ | |
| 121 void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face); | |
| 122 | |
| 123 /** | |
| 124 * Method: GetFontData | |
| 125 * Get font data from a font | |
| 126 * Interface Version: | |
| 127 * 1 | |
| 128 * Implementation Required: | |
| 129 * Yes | |
| 130 * Comments: | |
| 131 * Can read either full font file, or a particular
TrueType/OpenType table | |
| 132 * Parameters: | |
| 133 * pThis - Pointer to the interface
structure itself | |
| 134 * hFont - Font handle returned by
MapFont or GetFont method | |
| 135 * table - TrueType/OpenType table
identifier (refer to TrueType specification). | |
| 136 * 0 for the whole
font file. | |
| 137 * buffer - The buffer receiving the
font data. Can be NULL if not provided | |
| 138 * buf_size - Buffer size, can be zero
if not provided | |
| 139 * Return Value: | |
| 140 * Number of bytes needed, if buffer not provided o
r not large enough, | |
| 141 * or number of bytes written into buffer otherwise
. | |
| 142 **/ | |
| 143 unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis, void* hFon
t, | |
| 144 unsigned int table, unsigned char* buffer, unsigned long
buf_size); | |
| 145 | |
| 146 /** | |
| 147 * Method: GetFaceName | |
| 148 * Get face name from a font handle | |
| 149 * Interface Version: | |
| 150 * 1 | |
| 151 * Implementation Required: | |
| 152 * No | |
| 153 * Parameters: | |
| 154 * pThis - Pointer to the interface
structure itself | |
| 155 * hFont - Font handle returned by
MapFont or GetFont method | |
| 156 * buffer - The buffer receiving the
face name. Can be NULL if not provided | |
| 157 * buf_size - Buffer size, can be zero
if not provided | |
| 158 * Return Value: | |
| 159 * Number of bytes needed, if buffer not provided o
r not large enough, | |
| 160 * or number of bytes written into buffer otherwise
. | |
| 161 **/ | |
| 162 unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis, void* hFon
t, char* buffer, unsigned long buf_size); | |
| 163 | |
| 164 /** | |
| 165 * Method: GetFontCharset | |
| 166 * Get character set information for a font handle | |
| 167 * Interface Version: | |
| 168 * 1 | |
| 169 * Implementation Required: | |
| 170 * No | |
| 171 * Parameters: | |
| 172 * pThis - Pointer to the interface
structure itself | |
| 173 * hFont - Font handle returned by
MapFont or GetFont method | |
| 174 * Return Value: | |
| 175 * Character set identifier. See defined constants
above. | |
| 176 **/ | |
| 177 int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); | |
| 178 | |
| 179 /** | |
| 180 * Method: DeleteFont | |
| 181 * Delete a font handle | |
| 182 * Interface Version: | |
| 183 * 1 | |
| 184 * Implementation Required: | |
| 185 * Yes | |
| 186 * Parameters: | |
| 187 * pThis - Pointer to the interface
structure itself | |
| 188 * hFont - Font handle returned by
MapFont or GetFont method | |
| 189 * Return Value: | |
| 190 * None | |
| 191 **/ | |
| 192 void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); | |
| 193 } FPDF_SYSFONTINFO; | |
| 194 | |
| 195 /** | |
| 196 * Function: FPDF_AddInstalledFont | |
| 197 * Add a system font to the list in Foxit SDK. | |
| 198 * Comments: | |
| 199 * This function is only called during the system font list
building process. | |
| 200 * Parameters: | |
| 201 * mapper - Opaque pointer to Foxit
font mapper | |
| 202 * face - The font face name | |
| 203 * charset - Font character set. See
above defined constants. | |
| 204 * Return Value: | |
| 205 * None. | |
| 206 **/ | |
| 207 DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, const char* face, int
charset); | |
| 208 | |
| 209 /** | |
| 210 * Function: FPDF_SetSystemFontInfo | |
| 211 * Set the system font info interface into Foxit SDK | |
| 212 * Comments: | |
| 213 * Platform support implementation should implement require
d methods of FFDF_SYSFONTINFO interface, | |
| 214 * then call this function during SDK initialization proces
s. | |
| 215 * Parameters: | |
| 216 * pFontInfo - Pointer to a FPDF_SYSFON
TINFO structure | |
| 217 * Return Value: | |
| 218 * None | |
| 219 **/ | |
| 220 DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); | |
| 221 | |
| 222 /** | |
| 223 * Function: FPDF_GetDefaultSystemFontInfo | |
| 224 * Get default system font info interface for current platf
orm | |
| 225 * Comments: | |
| 226 * For some platforms Foxit SDK implement a default version
of system font info interface. | |
| 227 * The default implementation can be used in FPDF_SetSystem
FontInfo function. | |
| 228 * Parameters: | |
| 229 * None | |
| 230 * Return Value: | |
| 231 * Pointer to a FPDF_SYSFONTINFO structure describing the d
efault interface. | |
| 232 * Or NULL if the platform doesn't have a default interface
. | |
| 233 * Application should call FPDF_FreeMemory to free the retu
rned pointer. | |
| 234 **/ | |
| 235 DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo(); | |
| 236 | |
| 237 #ifdef __cplusplus | |
| 238 }; | |
| 239 #endif | |
| 240 | |
| 241 #endif // _FPDF_SYSFONTINFO_H | |
| OLD | NEW |