1 | /***************************************************************************/ |
---|
2 | /* */ |
---|
3 | /* cffdrivr.c */ |
---|
4 | /* */ |
---|
5 | /* OpenType font driver implementation (body). */ |
---|
6 | /* */ |
---|
7 | /* Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by */ |
---|
8 | /* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
---|
9 | /* */ |
---|
10 | /* This file is part of the FreeType project, and may only be used, */ |
---|
11 | /* modified, and distributed under the terms of the FreeType project */ |
---|
12 | /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
---|
13 | /* this file you indicate that you have read the license and */ |
---|
14 | /* understand and accept it fully. */ |
---|
15 | /* */ |
---|
16 | /***************************************************************************/ |
---|
17 | |
---|
18 | |
---|
19 | #include <ft2build.h> |
---|
20 | #include FT_FREETYPE_H |
---|
21 | #include FT_INTERNAL_DEBUG_H |
---|
22 | #include FT_INTERNAL_STREAM_H |
---|
23 | #include FT_INTERNAL_SFNT_H |
---|
24 | #include FT_TRUETYPE_IDS_H |
---|
25 | #include FT_SERVICE_CID_H |
---|
26 | #include FT_SERVICE_POSTSCRIPT_CMAPS_H |
---|
27 | #include FT_SERVICE_POSTSCRIPT_INFO_H |
---|
28 | #include FT_SERVICE_POSTSCRIPT_NAME_H |
---|
29 | #include FT_SERVICE_TT_CMAP_H |
---|
30 | |
---|
31 | #include "cffdrivr.h" |
---|
32 | #include "cffgload.h" |
---|
33 | #include "cffload.h" |
---|
34 | #include "cffcmap.h" |
---|
35 | |
---|
36 | #include "cfferrs.h" |
---|
37 | |
---|
38 | #include FT_SERVICE_XFREE86_NAME_H |
---|
39 | #include FT_SERVICE_GLYPH_DICT_H |
---|
40 | |
---|
41 | |
---|
42 | /*************************************************************************/ |
---|
43 | /* */ |
---|
44 | /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ |
---|
45 | /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ |
---|
46 | /* messages during execution. */ |
---|
47 | /* */ |
---|
48 | #undef FT_COMPONENT |
---|
49 | #define FT_COMPONENT trace_cffdriver |
---|
50 | |
---|
51 | |
---|
52 | /*************************************************************************/ |
---|
53 | /*************************************************************************/ |
---|
54 | /*************************************************************************/ |
---|
55 | /**** ****/ |
---|
56 | /**** ****/ |
---|
57 | /**** F A C E S ****/ |
---|
58 | /**** ****/ |
---|
59 | /**** ****/ |
---|
60 | /*************************************************************************/ |
---|
61 | /*************************************************************************/ |
---|
62 | /*************************************************************************/ |
---|
63 | |
---|
64 | |
---|
65 | #undef PAIR_TAG |
---|
66 | #define PAIR_TAG( left, right ) ( ( (FT_ULong)left << 16 ) | \ |
---|
67 | (FT_ULong)right ) |
---|
68 | |
---|
69 | |
---|
70 | /*************************************************************************/ |
---|
71 | /* */ |
---|
72 | /* <Function> */ |
---|
73 | /* cff_get_kerning */ |
---|
74 | /* */ |
---|
75 | /* <Description> */ |
---|
76 | /* A driver method used to return the kerning vector between two */ |
---|
77 | /* glyphs of the same face. */ |
---|
78 | /* */ |
---|
79 | /* <Input> */ |
---|
80 | /* face :: A handle to the source face object. */ |
---|
81 | /* */ |
---|
82 | /* left_glyph :: The index of the left glyph in the kern pair. */ |
---|
83 | /* */ |
---|
84 | /* right_glyph :: The index of the right glyph in the kern pair. */ |
---|
85 | /* */ |
---|
86 | /* <Output> */ |
---|
87 | /* kerning :: The kerning vector. This is in font units for */ |
---|
88 | /* scalable formats, and in pixels for fixed-sizes */ |
---|
89 | /* formats. */ |
---|
90 | /* */ |
---|
91 | /* <Return> */ |
---|
92 | /* FreeType error code. 0 means success. */ |
---|
93 | /* */ |
---|
94 | /* <Note> */ |
---|
95 | /* Only horizontal layouts (left-to-right & right-to-left) are */ |
---|
96 | /* supported by this function. Other layouts, or more sophisticated */ |
---|
97 | /* kernings, are out of scope of this method (the basic driver */ |
---|
98 | /* interface is meant to be simple). */ |
---|
99 | /* */ |
---|
100 | /* They can be implemented by format-specific interfaces. */ |
---|
101 | /* */ |
---|
102 | FT_CALLBACK_DEF( FT_Error ) |
---|
103 | cff_get_kerning( FT_Face ttface, /* TT_Face */ |
---|
104 | FT_UInt left_glyph, |
---|
105 | FT_UInt right_glyph, |
---|
106 | FT_Vector* kerning ) |
---|
107 | { |
---|
108 | TT_Face face = (TT_Face)ttface; |
---|
109 | SFNT_Service sfnt = (SFNT_Service)face->sfnt; |
---|
110 | |
---|
111 | |
---|
112 | kerning->x = 0; |
---|
113 | kerning->y = 0; |
---|
114 | |
---|
115 | if ( sfnt ) |
---|
116 | kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); |
---|
117 | |
---|
118 | return CFF_Err_Ok; |
---|
119 | } |
---|
120 | |
---|
121 | |
---|
122 | #undef PAIR_TAG |
---|
123 | |
---|
124 | |
---|
125 | /*************************************************************************/ |
---|
126 | /* */ |
---|
127 | /* <Function> */ |
---|
128 | /* Load_Glyph */ |
---|
129 | /* */ |
---|
130 | /* <Description> */ |
---|
131 | /* A driver method used to load a glyph within a given glyph slot. */ |
---|
132 | /* */ |
---|
133 | /* <Input> */ |
---|
134 | /* slot :: A handle to the target slot object where the glyph */ |
---|
135 | /* will be loaded. */ |
---|
136 | /* */ |
---|
137 | /* size :: A handle to the source face size at which the glyph */ |
---|
138 | /* must be scaled, loaded, etc. */ |
---|
139 | /* */ |
---|
140 | /* glyph_index :: The index of the glyph in the font file. */ |
---|
141 | /* */ |
---|
142 | /* load_flags :: A flag indicating what to load for this glyph. The */ |
---|
143 | /* FT_LOAD_??? constants can be used to control the */ |
---|
144 | /* glyph loading process (e.g., whether the outline */ |
---|
145 | /* should be scaled, whether to load bitmaps or not, */ |
---|
146 | /* whether to hint the outline, etc). */ |
---|
147 | /* */ |
---|
148 | /* <Return> */ |
---|
149 | /* FreeType error code. 0 means success. */ |
---|
150 | /* */ |
---|
151 | FT_CALLBACK_DEF( FT_Error ) |
---|
152 | Load_Glyph( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */ |
---|
153 | FT_Size cffsize, /* CFF_Size */ |
---|
154 | FT_UInt glyph_index, |
---|
155 | FT_Int32 load_flags ) |
---|
156 | { |
---|
157 | FT_Error error; |
---|
158 | CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; |
---|
159 | CFF_Size size = (CFF_Size)cffsize; |
---|
160 | |
---|
161 | |
---|
162 | if ( !slot ) |
---|
163 | return CFF_Err_Invalid_Slot_Handle; |
---|
164 | |
---|
165 | /* check whether we want a scaled outline or bitmap */ |
---|
166 | if ( !size ) |
---|
167 | load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; |
---|
168 | |
---|
169 | /* reset the size object if necessary */ |
---|
170 | if ( load_flags & FT_LOAD_NO_SCALE ) |
---|
171 | size = NULL; |
---|
172 | |
---|
173 | if ( size ) |
---|
174 | { |
---|
175 | /* these two objects must have the same parent */ |
---|
176 | if ( cffsize->face != cffslot->face ) |
---|
177 | return CFF_Err_Invalid_Face_Handle; |
---|
178 | } |
---|
179 | |
---|
180 | /* now load the glyph outline if necessary */ |
---|
181 | error = cff_slot_load( slot, size, glyph_index, load_flags ); |
---|
182 | |
---|
183 | /* force drop-out mode to 2 - irrelevant now */ |
---|
184 | /* slot->outline.dropout_mode = 2; */ |
---|
185 | |
---|
186 | return error; |
---|
187 | } |
---|
188 | |
---|
189 | |
---|
190 | FT_CALLBACK_DEF( FT_Error ) |
---|
191 | cff_get_advances( FT_Face ftface, |
---|
192 | FT_UInt start, |
---|
193 | FT_UInt count, |
---|
194 | FT_Int32 flags, |
---|
195 | FT_Fixed* advances ) |
---|
196 | { |
---|
197 | CFF_Face face = (CFF_Face)ftface; |
---|
198 | FT_UInt nn; |
---|
199 | FT_Error error = CFF_Err_Ok; |
---|
200 | FT_GlyphSlot slot = face->root.glyph; |
---|
201 | |
---|
202 | |
---|
203 | flags |= FT_LOAD_ADVANCE_ONLY; |
---|
204 | |
---|
205 | for ( nn = 0; nn < count; nn++ ) |
---|
206 | { |
---|
207 | error = Load_Glyph( slot, face->root.size, start+nn, flags ); |
---|
208 | if ( error ) |
---|
209 | break; |
---|
210 | |
---|
211 | advances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) |
---|
212 | ? slot->advance.y |
---|
213 | : slot->advance.x; |
---|
214 | } |
---|
215 | |
---|
216 | return error; |
---|
217 | } |
---|
218 | |
---|
219 | |
---|
220 | /* |
---|
221 | * GLYPH DICT SERVICE |
---|
222 | * |
---|
223 | */ |
---|
224 | |
---|
225 | static FT_Error |
---|
226 | cff_get_glyph_name( CFF_Face face, |
---|
227 | FT_UInt glyph_index, |
---|
228 | FT_Pointer buffer, |
---|
229 | FT_UInt buffer_max ) |
---|
230 | { |
---|
231 | CFF_Font font = (CFF_Font)face->extra.data; |
---|
232 | FT_Memory memory = FT_FACE_MEMORY( face ); |
---|
233 | FT_String* gname; |
---|
234 | FT_UShort sid; |
---|
235 | FT_Service_PsCMaps psnames; |
---|
236 | FT_Error error; |
---|
237 | |
---|
238 | |
---|
239 | FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); |
---|
240 | if ( !psnames ) |
---|
241 | { |
---|
242 | FT_ERROR(( "cff_get_glyph_name:" )); |
---|
243 | FT_ERROR(( " cannot get glyph name from CFF & CEF fonts\n" )); |
---|
244 | FT_ERROR(( " " )); |
---|
245 | FT_ERROR(( " without the `PSNames' module\n" )); |
---|
246 | error = CFF_Err_Unknown_File_Format; |
---|
247 | goto Exit; |
---|
248 | } |
---|
249 | |
---|
250 | /* first, locate the sid in the charset table */ |
---|
251 | sid = font->charset.sids[glyph_index]; |
---|
252 | |
---|
253 | /* now, lookup the name itself */ |
---|
254 | gname = cff_index_get_sid_string( &font->string_index, sid, psnames ); |
---|
255 | |
---|
256 | if ( gname ) |
---|
257 | FT_STRCPYN( buffer, gname, buffer_max ); |
---|
258 | |
---|
259 | FT_FREE( gname ); |
---|
260 | error = CFF_Err_Ok; |
---|
261 | |
---|
262 | Exit: |
---|
263 | return error; |
---|
264 | } |
---|
265 | |
---|
266 | |
---|
267 | static FT_UInt |
---|
268 | cff_get_name_index( CFF_Face face, |
---|
269 | FT_String* glyph_name ) |
---|
270 | { |
---|
271 | CFF_Font cff; |
---|
272 | CFF_Charset charset; |
---|
273 | FT_Service_PsCMaps psnames; |
---|
274 | FT_Memory memory = FT_FACE_MEMORY( face ); |
---|
275 | FT_String* name; |
---|
276 | FT_UShort sid; |
---|
277 | FT_UInt i; |
---|
278 | FT_Int result; |
---|
279 | |
---|
280 | |
---|
281 | cff = (CFF_FontRec *)face->extra.data; |
---|
282 | charset = &cff->charset; |
---|
283 | |
---|
284 | FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); |
---|
285 | if ( !psnames ) |
---|
286 | return 0; |
---|
287 | |
---|
288 | for ( i = 0; i < cff->num_glyphs; i++ ) |
---|
289 | { |
---|
290 | sid = charset->sids[i]; |
---|
291 | |
---|
292 | if ( sid > 390 ) |
---|
293 | name = cff_index_get_name( &cff->string_index, sid - 391 ); |
---|
294 | else |
---|
295 | name = (FT_String *)psnames->adobe_std_strings( sid ); |
---|
296 | |
---|
297 | if ( !name ) |
---|
298 | continue; |
---|
299 | |
---|
300 | result = ft_strcmp( glyph_name, name ); |
---|
301 | |
---|
302 | if ( sid > 390 ) |
---|
303 | FT_FREE( name ); |
---|
304 | |
---|
305 | if ( !result ) |
---|
306 | return i; |
---|
307 | } |
---|
308 | |
---|
309 | return 0; |
---|
310 | } |
---|
311 | |
---|
312 | |
---|
313 | static const FT_Service_GlyphDictRec cff_service_glyph_dict = |
---|
314 | { |
---|
315 | (FT_GlyphDict_GetNameFunc) cff_get_glyph_name, |
---|
316 | (FT_GlyphDict_NameIndexFunc)cff_get_name_index, |
---|
317 | }; |
---|
318 | |
---|
319 | |
---|
320 | /* |
---|
321 | * POSTSCRIPT INFO SERVICE |
---|
322 | * |
---|
323 | */ |
---|
324 | |
---|
325 | static FT_Int |
---|
326 | cff_ps_has_glyph_names( FT_Face face ) |
---|
327 | { |
---|
328 | return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0; |
---|
329 | } |
---|
330 | |
---|
331 | |
---|
332 | static FT_Error |
---|
333 | cff_ps_get_font_info( CFF_Face face, |
---|
334 | PS_FontInfoRec* afont_info ) |
---|
335 | { |
---|
336 | CFF_Font cff = (CFF_Font)face->extra.data; |
---|
337 | FT_Error error = FT_Err_Ok; |
---|
338 | |
---|
339 | |
---|
340 | if ( cff && cff->font_info == NULL ) |
---|
341 | { |
---|
342 | CFF_FontRecDict dict = &cff->top_font.font_dict; |
---|
343 | PS_FontInfoRec *font_info; |
---|
344 | FT_Memory memory = face->root.memory; |
---|
345 | FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; |
---|
346 | |
---|
347 | |
---|
348 | if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) ) |
---|
349 | goto Fail; |
---|
350 | |
---|
351 | font_info->version = cff_index_get_sid_string( &cff->string_index, |
---|
352 | dict->version, |
---|
353 | psnames ); |
---|
354 | font_info->notice = cff_index_get_sid_string( &cff->string_index, |
---|
355 | dict->notice, |
---|
356 | psnames ); |
---|
357 | font_info->full_name = cff_index_get_sid_string( &cff->string_index, |
---|
358 | dict->full_name, |
---|
359 | psnames ); |
---|
360 | font_info->family_name = cff_index_get_sid_string( &cff->string_index, |
---|
361 | dict->family_name, |
---|
362 | psnames ); |
---|
363 | font_info->weight = cff_index_get_sid_string( &cff->string_index, |
---|
364 | dict->weight, |
---|
365 | psnames ); |
---|
366 | font_info->italic_angle = dict->italic_angle; |
---|
367 | font_info->is_fixed_pitch = dict->is_fixed_pitch; |
---|
368 | font_info->underline_position = (FT_Short)dict->underline_position; |
---|
369 | font_info->underline_thickness = (FT_Short)dict->underline_thickness; |
---|
370 | |
---|
371 | cff->font_info = font_info; |
---|
372 | } |
---|
373 | |
---|
374 | *afont_info = *cff->font_info; |
---|
375 | |
---|
376 | Fail: |
---|
377 | return error; |
---|
378 | } |
---|
379 | |
---|
380 | |
---|
381 | static const FT_Service_PsInfoRec cff_service_ps_info = |
---|
382 | { |
---|
383 | (PS_GetFontInfoFunc) cff_ps_get_font_info, |
---|
384 | (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, |
---|
385 | (PS_GetFontPrivateFunc)NULL /* unsupported with CFF fonts */ |
---|
386 | }; |
---|
387 | |
---|
388 | |
---|
389 | /* |
---|
390 | * POSTSCRIPT NAME SERVICE |
---|
391 | * |
---|
392 | */ |
---|
393 | |
---|
394 | static const char* |
---|
395 | cff_get_ps_name( CFF_Face face ) |
---|
396 | { |
---|
397 | CFF_Font cff = (CFF_Font)face->extra.data; |
---|
398 | |
---|
399 | |
---|
400 | return (const char*)cff->font_name; |
---|
401 | } |
---|
402 | |
---|
403 | |
---|
404 | static const FT_Service_PsFontNameRec cff_service_ps_name = |
---|
405 | { |
---|
406 | (FT_PsName_GetFunc)cff_get_ps_name |
---|
407 | }; |
---|
408 | |
---|
409 | |
---|
410 | /* |
---|
411 | * TT CMAP INFO |
---|
412 | * |
---|
413 | * If the charmap is a synthetic Unicode encoding cmap or |
---|
414 | * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO |
---|
415 | * service defined in SFNT module. |
---|
416 | * |
---|
417 | * Otherwise call the service function in the sfnt module. |
---|
418 | * |
---|
419 | */ |
---|
420 | static FT_Error |
---|
421 | cff_get_cmap_info( FT_CharMap charmap, |
---|
422 | TT_CMapInfo *cmap_info ) |
---|
423 | { |
---|
424 | FT_CMap cmap = FT_CMAP( charmap ); |
---|
425 | FT_Error error = CFF_Err_Ok; |
---|
426 | |
---|
427 | |
---|
428 | cmap_info->language = 0; |
---|
429 | cmap_info->format = 0; |
---|
430 | |
---|
431 | if ( cmap->clazz != &cff_cmap_encoding_class_rec && |
---|
432 | cmap->clazz != &cff_cmap_unicode_class_rec ) |
---|
433 | { |
---|
434 | FT_Face face = FT_CMAP_FACE( cmap ); |
---|
435 | FT_Library library = FT_FACE_LIBRARY( face ); |
---|
436 | FT_Module sfnt = FT_Get_Module( library, "sfnt" ); |
---|
437 | FT_Service_TTCMaps service = |
---|
438 | (FT_Service_TTCMaps)ft_module_get_service( sfnt, |
---|
439 | FT_SERVICE_ID_TT_CMAP ); |
---|
440 | |
---|
441 | |
---|
442 | if ( service && service->get_cmap_info ) |
---|
443 | error = service->get_cmap_info( charmap, cmap_info ); |
---|
444 | } |
---|
445 | |
---|
446 | return error; |
---|
447 | } |
---|
448 | |
---|
449 | |
---|
450 | static const FT_Service_TTCMapsRec cff_service_get_cmap_info = |
---|
451 | { |
---|
452 | (TT_CMap_Info_GetFunc)cff_get_cmap_info |
---|
453 | }; |
---|
454 | |
---|
455 | |
---|
456 | /* |
---|
457 | * CID INFO SERVICE |
---|
458 | * |
---|
459 | */ |
---|
460 | static FT_Error |
---|
461 | cff_get_ros( CFF_Face face, |
---|
462 | const char* *registry, |
---|
463 | const char* *ordering, |
---|
464 | FT_Int *supplement ) |
---|
465 | { |
---|
466 | FT_Error error = CFF_Err_Ok; |
---|
467 | CFF_Font cff = (CFF_Font)face->extra.data; |
---|
468 | |
---|
469 | |
---|
470 | if ( cff ) |
---|
471 | { |
---|
472 | CFF_FontRecDict dict = &cff->top_font.font_dict; |
---|
473 | FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames; |
---|
474 | |
---|
475 | |
---|
476 | if ( dict->cid_registry == 0xFFFFU ) |
---|
477 | { |
---|
478 | error = CFF_Err_Invalid_Argument; |
---|
479 | goto Fail; |
---|
480 | } |
---|
481 | |
---|
482 | if ( registry ) |
---|
483 | { |
---|
484 | if ( cff->registry == NULL ) |
---|
485 | cff->registry = cff_index_get_sid_string( &cff->string_index, |
---|
486 | dict->cid_registry, |
---|
487 | psnames ); |
---|
488 | *registry = cff->registry; |
---|
489 | } |
---|
490 | |
---|
491 | if ( ordering ) |
---|
492 | { |
---|
493 | if ( cff->ordering == NULL ) |
---|
494 | cff->ordering = cff_index_get_sid_string( &cff->string_index, |
---|
495 | dict->cid_ordering, |
---|
496 | psnames ); |
---|
497 | *ordering = cff->ordering; |
---|
498 | } |
---|
499 | |
---|
500 | if ( supplement ) |
---|
501 | *supplement = dict->cid_supplement; |
---|
502 | } |
---|
503 | |
---|
504 | Fail: |
---|
505 | return error; |
---|
506 | } |
---|
507 | |
---|
508 | |
---|
509 | static const FT_Service_CIDRec cff_service_cid_info = |
---|
510 | { |
---|
511 | (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros |
---|
512 | }; |
---|
513 | |
---|
514 | |
---|
515 | /*************************************************************************/ |
---|
516 | /*************************************************************************/ |
---|
517 | /*************************************************************************/ |
---|
518 | /**** ****/ |
---|
519 | /**** ****/ |
---|
520 | /**** D R I V E R I N T E R F A C E ****/ |
---|
521 | /**** ****/ |
---|
522 | /**** ****/ |
---|
523 | /*************************************************************************/ |
---|
524 | /*************************************************************************/ |
---|
525 | /*************************************************************************/ |
---|
526 | |
---|
527 | static const FT_ServiceDescRec cff_services[] = |
---|
528 | { |
---|
529 | { FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF }, |
---|
530 | { FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info }, |
---|
531 | { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name }, |
---|
532 | #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES |
---|
533 | { FT_SERVICE_ID_GLYPH_DICT, &cff_service_glyph_dict }, |
---|
534 | #endif |
---|
535 | { FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info }, |
---|
536 | { FT_SERVICE_ID_CID, &cff_service_cid_info }, |
---|
537 | { NULL, NULL } |
---|
538 | }; |
---|
539 | |
---|
540 | |
---|
541 | FT_CALLBACK_DEF( FT_Module_Interface ) |
---|
542 | cff_get_interface( FT_Module driver, /* CFF_Driver */ |
---|
543 | const char* module_interface ) |
---|
544 | { |
---|
545 | FT_Module sfnt; |
---|
546 | FT_Module_Interface result; |
---|
547 | |
---|
548 | |
---|
549 | result = ft_service_list_lookup( cff_services, module_interface ); |
---|
550 | if ( result != NULL ) |
---|
551 | return result; |
---|
552 | |
---|
553 | /* we pass our request to the `sfnt' module */ |
---|
554 | sfnt = FT_Get_Module( driver->library, "sfnt" ); |
---|
555 | |
---|
556 | return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0; |
---|
557 | } |
---|
558 | |
---|
559 | |
---|
560 | /* The FT_DriverInterface structure is defined in ftdriver.h. */ |
---|
561 | |
---|
562 | FT_CALLBACK_TABLE_DEF |
---|
563 | const FT_Driver_ClassRec cff_driver_class = |
---|
564 | { |
---|
565 | /* begin with the FT_Module_Class fields */ |
---|
566 | { |
---|
567 | FT_MODULE_FONT_DRIVER | |
---|
568 | FT_MODULE_DRIVER_SCALABLE | |
---|
569 | FT_MODULE_DRIVER_HAS_HINTER, |
---|
570 | |
---|
571 | sizeof( CFF_DriverRec ), |
---|
572 | "cff", |
---|
573 | 0x10000L, |
---|
574 | 0x20000L, |
---|
575 | |
---|
576 | 0, /* module-specific interface */ |
---|
577 | |
---|
578 | cff_driver_init, |
---|
579 | cff_driver_done, |
---|
580 | cff_get_interface, |
---|
581 | }, |
---|
582 | |
---|
583 | /* now the specific driver fields */ |
---|
584 | sizeof( TT_FaceRec ), |
---|
585 | sizeof( CFF_SizeRec ), |
---|
586 | sizeof( CFF_GlyphSlotRec ), |
---|
587 | |
---|
588 | cff_face_init, |
---|
589 | cff_face_done, |
---|
590 | cff_size_init, |
---|
591 | cff_size_done, |
---|
592 | cff_slot_init, |
---|
593 | cff_slot_done, |
---|
594 | |
---|
595 | #ifdef FT_CONFIG_OPTION_OLD_INTERNALS |
---|
596 | ft_stub_set_char_sizes, |
---|
597 | ft_stub_set_pixel_sizes, |
---|
598 | #endif |
---|
599 | |
---|
600 | Load_Glyph, |
---|
601 | |
---|
602 | cff_get_kerning, |
---|
603 | 0, /* FT_Face_AttachFunc */ |
---|
604 | cff_get_advances, /* FT_Face_GetAdvancesFunc */ |
---|
605 | |
---|
606 | cff_size_request, |
---|
607 | |
---|
608 | #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS |
---|
609 | cff_size_select |
---|
610 | #else |
---|
611 | 0 /* FT_Size_SelectFunc */ |
---|
612 | #endif |
---|
613 | }; |
---|
614 | |
---|
615 | |
---|
616 | /* END */ |
---|