Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: fpdfsdk/include/fpdf_sysfontinfo.h

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef _FPDF_SYSFONTINFO_H 7 #ifndef _FPDF_SYSFONTINFO_H
8 #define _FPDF_SYSFONTINFO_H 8 #define _FPDF_SYSFONTINFO_H
9 9
10 #include "fpdfview.h" 10 #include "fpdfview.h"
11 11
12 /* Character sets for the font */ 12 /* Character sets for the font */
13 #define FXFONT_ANSI_CHARSET» » 0 13 #define FXFONT_ANSI_CHARSET 0
14 #define FXFONT_DEFAULT_CHARSET» 1 14 #define FXFONT_DEFAULT_CHARSET 1
15 #define FXFONT_SYMBOL_CHARSET» 2 15 #define FXFONT_SYMBOL_CHARSET 2
16 #define FXFONT_SHIFTJIS_CHARSET»128 16 #define FXFONT_SHIFTJIS_CHARSET 128
17 #define FXFONT_HANGEUL_CHARSET» 129 17 #define FXFONT_HANGEUL_CHARSET 129
18 #define FXFONT_GB2312_CHARSET» 134 18 #define FXFONT_GB2312_CHARSET 134
19 #define FXFONT_CHINESEBIG5_CHARSET» 136 19 #define FXFONT_CHINESEBIG5_CHARSET 136
20 20
21 /* Font pitch and family flags */ 21 /* Font pitch and family flags */
22 #define FXFONT_FF_FIXEDPITCH» 1 22 #define FXFONT_FF_FIXEDPITCH 1
23 #define FXFONT_FF_ROMAN»» » (1<<4) 23 #define FXFONT_FF_ROMAN (1 << 4)
24 #define FXFONT_FF_SCRIPT» » (4<<4) 24 #define FXFONT_FF_SCRIPT (4 << 4)
25 25
26 /* Typical weight values */ 26 /* Typical weight values */
27 #define FXFONT_FW_NORMAL» » 400 27 #define FXFONT_FW_NORMAL 400
28 #define FXFONT_FW_BOLD» » » 700 28 #define FXFONT_FW_BOLD 700
29 29
30 // Exported Functions 30 // Exported Functions
31 #ifdef __cplusplus 31 #ifdef __cplusplus
32 extern "C" { 32 extern "C" {
33 #endif 33 #endif
34 34
35 35 /**
36 /**
37 * Interface: FPDF_SYSFONTINFO 36 * Interface: FPDF_SYSFONTINFO
38 *» » » Interface for getting system font information and font m apping 37 *» » » Interface for getting system font information and font
38 *mapping
39 */ 39 */
40 typedef struct _FPDF_SYSFONTINFO { 40 typedef struct _FPDF_SYSFONTINFO {
41 /** 41 /**
42 * Version number of the interface. Currently must be 1. 42 * Version number of the interface. Currently must be 1.
43 **/ 43 **/
44 int version; 44 int version;
45 45
46 /** 46 /**
47 * Method: Release 47 * Method: Release
48 * Give implementation a chance to release any data after the interface is no longer used 48 * Give implementation a chance to release any data after t he
49 * Interface Version: 49 *interface is no longer used
50 * 1 50 * Interface Version:
51 * Implementation Required: 51 * 1
52 * No 52 * Implementation Required:
53 * Comments: 53 * No
54 * Called by Foxit SDK during the final cleanup pro cess. 54 * Comments:
55 * Parameters: 55 * Called by Foxit SDK during the final cleanup process.
56 * pThis - Pointer to the interface structure itself 56 * Parameters:
57 * Return Value: 57 * pThis - Pointer to the interface structu re
58 * None 58 *itself
59 */ 59 * Return Value:
60 void (*Release)(struct _FPDF_SYSFONTINFO* pThis); 60 * None
61 61 */
62 /** 62 void (*Release)(struct _FPDF_SYSFONTINFO* pThis);
63 * Method: EnumFonts 63
64 * Enumerate all fonts installed on the system 64 /**
65 * Interface Version: 65 * Method: EnumFonts
66 * 1 66 * Enumerate all fonts installed on the system
67 * Implementation Required: 67 * Interface Version:
68 * No 68 * 1
69 * Comments: 69 * Implementation Required:
70 * Implementation should call FPDF_AddIntalledFont( ) function for each font found. 70 * No
71 * Only TrueType/OpenType and Type1 fonts are accep ted by Foxit SDK. 71 * Comments:
72 * Parameters: 72 * Implementation should call FPDF_AddIntalledFont() functi on for
73 * pThis - Pointer to the interface structure itself 73 *each font found.
74 * pMapper - An opaque pointer to int ernal font mapper, used when calling FPDF_AddInstalledFont 74 * Only TrueType/OpenType and Type1 fonts are accepted by F oxit
75 * Return Value: 75 *SDK.
76 * None 76 * Parameters:
77 */ 77 * pThis - Pointer to the interface structu re
78 void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper); 78 *itself
79 79 * pMapper - An opaque pointer to internal fo nt mapper,
80 /** 80 *used when calling FPDF_AddInstalledFont
81 * Method: MapFont 81 * Return Value:
82 * Use the system font mapper to get a font handle from requested parameters 82 * None
83 * Interface Version: 83 */
84 * 1 84 void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper);
85 * Implementation Required: 85
86 * Yes only if GetFont method is not implemented. 86 /**
87 * Comments: 87 * Method: MapFont
88 * If the system supports native font mapper (like Windows), implementation can implement this method to get a font handle. 88 * Use the system font mapper to get a font handle from req uested
89 * Otherwise, Foxit SDK will do the mapping and the n call GetFont method. 89 *parameters
90 * Only TrueType/OpenType and Type1 fonts are accep ted by Foxit SDK. 90 * Interface Version:
91 * Parameters: 91 * 1
92 * pThis - Pointer to the interface structure itself 92 * Implementation Required:
93 * weight - Weight of the requested font. 400 is normal and 700 is bold. 93 * Yes only if GetFont method is not implemented.
94 * bItalic - Italic option of the req uested font, TRUE or FALSE. 94 * Comments:
95 * charset - Character set identifier for the requested font. See above defined constants. 95 * If the system supports native font mapper (like Windows) ,
96 * pitch_family - A combination of flags. See abov e defined constants. 96 *implementation can implement this method to get a font handle.
97 * face - Typeface name. Currently use system local encoding only. 97 * Otherwise, Foxit SDK will do the mapping and then call G etFont
98 * bExact - Pointer to an boolean va lue receiving the indicator whether mapper found the exact match. 98 *method.
99 * If mapper is not sure whether it's exact match, ignore this paramter. 99 * Only TrueType/OpenType and Type1 fonts are accepted by F oxit
100 * Return Value: 100 *SDK.
101 * An opaque pointer for font handle, or NULL if sy stem mapping is not supported. 101 * Parameters:
102 **/ 102 * pThis - Pointer to the interface structu re
103 void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis, int weight, int bItali c, int charset, int pitch_family, 103 *itself
104 const char* face, int* bExact); 104 * weight - Weight of the requested font. 40 0 is normal
105 105 *and 700 is bold.
106 /** 106 * bItalic - Italic option of the requested f ont, TRUE or
107 * Method: GetFont 107 *FALSE.
108 * Get a handle to a particular font by its interna l ID 108 * charset - Character set identifier for the requested
109 * Interface Version: 109 *font. See above defined constants.
110 * 1 110 * pitch_family - A combination of flags. See above define d
111 * Implementation Required: 111 *constants.
112 * Yes only if MapFont method is not implemented. 112 * face - Typeface name. Currently use sys tem local
113 * Comments: 113 *encoding only.
114 * If the system mapping not supported, Foxit SDK w ill do the font mapping and use this method to get a font handle. 114 * bExact - Pointer to an boolean value rece iving the
115 * Parameters: 115 *indicator whether mapper found the exact match.
116 * pThis - Pointer to the interface structure itself 116 * If mapper is not sure wh ether it's exact match,
117 * face - Typeface name. Currently use system local encoding only. 117 *ignore this paramter.
118 * Return Value: 118 * Return Value:
119 * An opaque pointer for font handle. 119 * An opaque pointer for font handle, or NULL if system map ping is
120 **/ 120 *not supported.
121 void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face); 121 **/
122 122 void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis,
123 /** 123 int weight,
124 * Method: GetFontData 124 int bItalic,
125 * Get font data from a font 125 int charset,
126 * Interface Version: 126 int pitch_family,
127 * 1 127 const char* face,
128 * Implementation Required: 128 int* bExact);
129 * Yes 129
130 * Comments: 130 /**
131 * Can read either full font file, or a particular TrueType/OpenType table 131 * Method: GetFont
132 * Parameters: 132 * Get a handle to a particular font by its internal ID
133 * pThis - Pointer to the interface structure itself 133 * Interface Version:
134 * hFont - Font handle returned by MapFont or GetFont method 134 * 1
135 * table - TrueType/OpenType table identifier (refer to TrueType specification). 135 * Implementation Required:
136 * 0 for the whole font file. 136 * Yes only if MapFont method is not implemented.
137 * buffer - The buffer receiving the font data. Can be NULL if not provided 137 * Comments:
138 * buf_size - Buffer size, can be zero if not provided 138 * If the system mapping not supported, Foxit SDK will do t he font
139 * Return Value: 139 *mapping and use this method to get a font handle.
140 * Number of bytes needed, if buffer not provided o r not large enough, 140 * Parameters:
141 * or number of bytes written into buffer otherwise . 141 * pThis - Pointer to the interface structu re
142 **/ 142 *itself
143 unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis, void* hFon t, 143 * face - Typeface name. Currently use sys tem local
144 unsigned int table, unsigned char* buffer, unsigned long buf_size); 144 *encoding only.
145 145 * Return Value:
146 /** 146 * An opaque pointer for font handle.
147 * Method: GetFaceName 147 **/
148 * Get face name from a font handle 148 void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face);
149 * Interface Version: 149
150 * 1 150 /**
151 * Implementation Required: 151 * Method: GetFontData
152 * No 152 * Get font data from a font
153 * Parameters: 153 * Interface Version:
154 * pThis - Pointer to the interface structure itself 154 * 1
155 * hFont - Font handle returned by MapFont or GetFont method 155 * Implementation Required:
156 * buffer - The buffer receiving the face name. Can be NULL if not provided 156 * Yes
157 * buf_size - Buffer size, can be zero if not provided 157 * Comments:
158 * Return Value: 158 * Can read either full font file, or a particular
159 * Number of bytes needed, if buffer not provided o r not large enough, 159 *TrueType/OpenType table
160 * or number of bytes written into buffer otherwise . 160 * Parameters:
161 **/ 161 * pThis - Pointer to the interface structu re
162 unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis, void* hFon t, char* buffer, unsigned long buf_size); 162 *itself
163 163 * hFont - Font handle returned by MapFont or GetFont
164 /** 164 *method
165 * Method: GetFontCharset 165 * table - TrueType/OpenType table identifi er (refer to
166 * Get character set information for a font handle 166 *TrueType specification).
167 * Interface Version: 167 * 0 for the whole font
168 * 1 168 *file.
169 * Implementation Required: 169 * buffer - The buffer receiving the font da ta. Can be
170 * No 170 *NULL if not provided
171 * Parameters: 171 * buf_size - Buffer size, can be zero if not
172 * pThis - Pointer to the interface structure itself 172 *provided
173 * hFont - Font handle returned by MapFont or GetFont method 173 * Return Value:
174 * Return Value: 174 * Number of bytes needed, if buffer not provided or not la rge
175 * Character set identifier. See defined constants above. 175 *enough,
176 **/ 176 * or number of bytes written into buffer otherwise.
177 int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); 177 **/
178 178 unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis,
179 /** 179 void* hFont,
180 * Method: DeleteFont 180 unsigned int table,
181 * Delete a font handle 181 unsigned char* buffer,
182 * Interface Version: 182 unsigned long buf_size);
183 * 1 183
184 * Implementation Required: 184 /**
185 * Yes 185 * Method: GetFaceName
186 * Parameters: 186 * Get face name from a font handle
187 * pThis - Pointer to the interface structure itself 187 * Interface Version:
188 * hFont - Font handle returned by MapFont or GetFont method 188 * 1
189 * Return Value: 189 * Implementation Required:
190 * None 190 * No
191 **/ 191 * Parameters:
192 void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont); 192 * pThis - Pointer to the interface structu re
193 *itself
194 * hFont - Font handle returned by MapFont or GetFont
195 *method
196 * buffer - The buffer receiving the face na me. Can be
197 *NULL if not provided
198 * buf_size - Buffer size, can be zero if not
199 *provided
200 * Return Value:
201 * Number of bytes needed, if buffer not provided or not la rge
202 *enough,
203 * or number of bytes written into buffer otherwise.
204 **/
205 unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis,
206 void* hFont,
207 char* buffer,
208 unsigned long buf_size);
209
210 /**
211 * Method: GetFontCharset
212 * Get character set information for a font handle
213 * Interface Version:
214 * 1
215 * Implementation Required:
216 * No
217 * Parameters:
218 * pThis - Pointer to the interface structu re
219 *itself
220 * hFont - Font handle returned by MapFont or GetFont
221 *method
222 * Return Value:
223 * Character set identifier. See defined constants above.
224 **/
225 int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
226
227 /**
228 * Method: DeleteFont
229 * Delete a font handle
230 * Interface Version:
231 * 1
232 * Implementation Required:
233 * Yes
234 * Parameters:
235 * pThis - Pointer to the interface structu re
236 *itself
237 * hFont - Font handle returned by MapFont or GetFont
238 *method
239 * Return Value:
240 * None
241 **/
242 void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
193 } FPDF_SYSFONTINFO; 243 } FPDF_SYSFONTINFO;
194 244
195 /** 245 /**
196 * Function: FPDF_AddInstalledFont 246 * Function: FPDF_AddInstalledFont
197 * Add a system font to the list in Foxit SDK. 247 * Add a system font to the list in Foxit SDK.
198 * Comments: 248 * Comments:
199 *» » » This function is only called during the system font list building process. 249 *» » » This function is only called during the system font list
250 *building process.
200 * Parameters: 251 * Parameters:
201 *» » » mapper» » » -» Opaque pointer to Foxit font mapper 252 *» » » mapper» » » -» Opaque pointer to Foxit font
253 *mapper
202 * face - The font face name 254 * face - The font face name
203 *» » » charset»» » -» Font character set. See above defined constants. 255 *» » » charset»» » -» Font character set. See
256 *above defined constants.
204 * Return Value: 257 * Return Value:
205 * None. 258 * None.
206 **/ 259 **/
207 DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, const char* face, int charset); 260 DLLEXPORT void STDCALL
261 FPDF_AddInstalledFont(void* mapper, const char* face, int charset);
208 262
209 /** 263 /**
210 * Function: FPDF_SetSystemFontInfo 264 * Function: FPDF_SetSystemFontInfo
211 * Set the system font info interface into Foxit SDK 265 * Set the system font info interface into Foxit SDK
212 * Comments: 266 * Comments:
213 *» » » Platform support implementation should implement require d methods of FFDF_SYSFONTINFO interface, 267 *» » » Platform support implementation should implement require d
214 *» » » then call this function during SDK initialization proces s. 268 *methods of FFDF_SYSFONTINFO interface,
269 *» » » then call this function during SDK initialization
270 *process.
215 * Parameters: 271 * Parameters:
216 *» » » pFontInfo» » -» Pointer to a FPDF_SYSFON TINFO structure 272 *» » » pFontInfo» » -» Pointer to a FPDF_SYSFON TINFO
273 *structure
217 * Return Value: 274 * Return Value:
218 * None 275 * None
219 **/ 276 **/
220 DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo); 277 DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
221 278
222 /** 279 /**
223 * Function: FPDF_GetDefaultSystemFontInfo 280 * Function: FPDF_GetDefaultSystemFontInfo
224 *» » » Get default system font info interface for current platf orm 281 *» » » Get default system font info interface for current
282 *platform
225 * Comments: 283 * Comments:
226 *» » » For some platforms Foxit SDK implement a default version of system font info interface. 284 *» » » For some platforms Foxit SDK implement a default version of
227 *» » » The default implementation can be used in FPDF_SetSystem FontInfo function. 285 *system font info interface.
286 *» » » The default implementation can be used in
287 *FPDF_SetSystemFontInfo function.
228 * Parameters: 288 * Parameters:
229 * None 289 * None
230 * Return Value: 290 * Return Value:
231 *» » » Pointer to a FPDF_SYSFONTINFO structure describing the d efault interface. 291 *» » » Pointer to a FPDF_SYSFONTINFO structure describing the
232 *» » » Or NULL if the platform doesn't have a default interface . 292 *default interface.
233 *» » » Application should call FPDF_FreeMemory to free the retu rned pointer. 293 *» » » Or NULL if the platform doesn't have a default
294 *interface.
295 *» » » Application should call FPDF_FreeMemory to free the retu rned
296 *pointer.
234 **/ 297 **/
235 DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo(); 298 DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo();
236 299
237 #ifdef __cplusplus 300 #ifdef __cplusplus
238 }; 301 };
239 #endif 302 #endif
240 303
241 #endif // _FPDF_SYSFONTINFO_H 304 #endif // _FPDF_SYSFONTINFO_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698