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

Side by Side Diff: src/cff/cffdrivr.c

Issue 89753003: Update freetype to latest version of ASOP. (Closed) Base URL: https://chromium.googlesource.com/chromium/src/third_party/freetype.git@master
Patch Set: Created 7 years 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
« no previous file with comments | « src/cff/cffcmap.c ('k') | src/cff/cffgload.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /***************************************************************************/ 1 /***************************************************************************/
2 /* */ 2 /* */
3 /* cffdrivr.c */ 3 /* cffdrivr.c */
4 /* */ 4 /* */
5 /* OpenType font driver implementation (body). */ 5 /* OpenType font driver implementation (body). */
6 /* */ 6 /* */
7 /* Copyright 1996-2012 by */ 7 /* Copyright 1996-2013 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */ 8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */ 9 /* */
10 /* This file is part of the FreeType project, and may only be used, */ 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 */ 11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */ 12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */ 13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */ 14 /* understand and accept it fully. */
15 /* */ 15 /* */
16 /***************************************************************************/ 16 /***************************************************************************/
17 17
(...skipping 12 matching lines...) Expand all
30 #include "cffgload.h" 30 #include "cffgload.h"
31 #include "cffload.h" 31 #include "cffload.h"
32 #include "cffcmap.h" 32 #include "cffcmap.h"
33 #include "cffparse.h" 33 #include "cffparse.h"
34 34
35 #include "cfferrs.h" 35 #include "cfferrs.h"
36 #include "cffpic.h" 36 #include "cffpic.h"
37 37
38 #include FT_SERVICE_XFREE86_NAME_H 38 #include FT_SERVICE_XFREE86_NAME_H
39 #include FT_SERVICE_GLYPH_DICT_H 39 #include FT_SERVICE_GLYPH_DICT_H
40 #include FT_SERVICE_PROPERTIES_H
41 #include FT_CFF_DRIVER_H
40 42
41 43
42 /*************************************************************************/ 44 /*************************************************************************/
43 /* */ 45 /* */
44 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ 46 /* 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 */ 47 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
46 /* messages during execution. */ 48 /* messages during execution. */
47 /* */ 49 /* */
48 #undef FT_COMPONENT 50 #undef FT_COMPONENT
49 #define FT_COMPONENT trace_cffdriver 51 #define FT_COMPONENT trace_cffdriver
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 TT_Face face = (TT_Face)ttface; 110 TT_Face face = (TT_Face)ttface;
109 SFNT_Service sfnt = (SFNT_Service)face->sfnt; 111 SFNT_Service sfnt = (SFNT_Service)face->sfnt;
110 112
111 113
112 kerning->x = 0; 114 kerning->x = 0;
113 kerning->y = 0; 115 kerning->y = 0;
114 116
115 if ( sfnt ) 117 if ( sfnt )
116 kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph ); 118 kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
117 119
118 return CFF_Err_Ok; 120 return FT_Err_Ok;
119 } 121 }
120 122
121 123
122 #undef PAIR_TAG 124 #undef PAIR_TAG
123 125
124 126
125 /*************************************************************************/ 127 /*************************************************************************/
126 /* */ 128 /* */
127 /* <Function> */ 129 /* <Function> */
128 /* cff_glyph_load */ 130 /* cff_glyph_load */
(...skipping 24 matching lines...) Expand all
153 FT_Size cffsize, /* CFF_Size */ 155 FT_Size cffsize, /* CFF_Size */
154 FT_UInt glyph_index, 156 FT_UInt glyph_index,
155 FT_Int32 load_flags ) 157 FT_Int32 load_flags )
156 { 158 {
157 FT_Error error; 159 FT_Error error;
158 CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; 160 CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot;
159 CFF_Size size = (CFF_Size)cffsize; 161 CFF_Size size = (CFF_Size)cffsize;
160 162
161 163
162 if ( !slot ) 164 if ( !slot )
163 return CFF_Err_Invalid_Slot_Handle; 165 return FT_THROW( Invalid_Slot_Handle );
164 166
165 /* check whether we want a scaled outline or bitmap */ 167 /* check whether we want a scaled outline or bitmap */
166 if ( !size ) 168 if ( !size )
167 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; 169 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
168 170
169 /* reset the size object if necessary */ 171 /* reset the size object if necessary */
170 if ( load_flags & FT_LOAD_NO_SCALE ) 172 if ( load_flags & FT_LOAD_NO_SCALE )
171 size = NULL; 173 size = NULL;
172 174
173 if ( size ) 175 if ( size )
174 { 176 {
175 /* these two objects must have the same parent */ 177 /* these two objects must have the same parent */
176 if ( cffsize->face != cffslot->face ) 178 if ( cffsize->face != cffslot->face )
177 return CFF_Err_Invalid_Face_Handle; 179 return FT_THROW( Invalid_Face_Handle );
178 } 180 }
179 181
180 /* now load the glyph outline if necessary */ 182 /* now load the glyph outline if necessary */
181 error = cff_slot_load( slot, size, glyph_index, load_flags ); 183 error = cff_slot_load( slot, size, glyph_index, load_flags );
182 184
183 /* force drop-out mode to 2 - irrelevant now */ 185 /* force drop-out mode to 2 - irrelevant now */
184 /* slot->outline.dropout_mode = 2; */ 186 /* slot->outline.dropout_mode = 2; */
185 187
186 return error; 188 return error;
187 } 189 }
188 190
189 191
190 FT_CALLBACK_DEF( FT_Error ) 192 FT_CALLBACK_DEF( FT_Error )
191 cff_get_advances( FT_Face face, 193 cff_get_advances( FT_Face face,
192 FT_UInt start, 194 FT_UInt start,
193 FT_UInt count, 195 FT_UInt count,
194 FT_Int32 flags, 196 FT_Int32 flags,
195 FT_Fixed* advances ) 197 FT_Fixed* advances )
196 { 198 {
197 FT_UInt nn; 199 FT_UInt nn;
198 FT_Error error = CFF_Err_Ok; 200 FT_Error error = FT_Err_Ok;
199 FT_GlyphSlot slot = face->glyph; 201 FT_GlyphSlot slot = face->glyph;
200 202
201 203
202 flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; 204 flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
203 205
204 for ( nn = 0; nn < count; nn++ ) 206 for ( nn = 0; nn < count; nn++ )
205 { 207 {
206 error = cff_glyph_load( slot, face->size, start + nn, flags ); 208 error = cff_glyph_load( slot, face->size, start + nn, flags );
207 if ( error ) 209 if ( error )
208 break; 210 break;
(...skipping 23 matching lines...) Expand all
232 FT_UShort sid; 234 FT_UShort sid;
233 FT_Error error; 235 FT_Error error;
234 236
235 237
236 if ( !font->psnames ) 238 if ( !font->psnames )
237 { 239 {
238 FT_ERROR(( "cff_get_glyph_name:" 240 FT_ERROR(( "cff_get_glyph_name:"
239 " cannot get glyph name from CFF & CEF fonts\n" 241 " cannot get glyph name from CFF & CEF fonts\n"
240 " " 242 " "
241 " without the `PSNames' module\n" )); 243 " without the `PSNames' module\n" ));
242 error = CFF_Err_Missing_Module; 244 error = FT_THROW( Missing_Module );
243 goto Exit; 245 goto Exit;
244 } 246 }
245 247
246 /* first, locate the sid in the charset table */ 248 /* first, locate the sid in the charset table */
247 sid = font->charset.sids[glyph_index]; 249 sid = font->charset.sids[glyph_index];
248 250
249 /* now, lookup the name itself */ 251 /* now, lookup the name itself */
250 gname = cff_index_get_sid_string( font, sid ); 252 gname = cff_index_get_sid_string( font, sid );
251 253
252 if ( gname ) 254 if ( gname )
253 FT_STRCPYN( buffer, gname, buffer_max ); 255 FT_STRCPYN( buffer, gname, buffer_max );
254 256
255 error = CFF_Err_Ok; 257 error = FT_Err_Ok;
256 258
257 Exit: 259 Exit:
258 return error; 260 return error;
259 } 261 }
260 262
261 263
262 static FT_UInt 264 static FT_UInt
263 cff_get_name_index( CFF_Face face, 265 cff_get_name_index( CFF_Face face,
264 FT_String* glyph_name ) 266 FT_String* glyph_name )
265 { 267 {
(...skipping 25 matching lines...) Expand all
291 continue; 293 continue;
292 294
293 if ( !ft_strcmp( glyph_name, name ) ) 295 if ( !ft_strcmp( glyph_name, name ) )
294 return i; 296 return i;
295 } 297 }
296 298
297 return 0; 299 return 0;
298 } 300 }
299 301
300 302
301 FT_DEFINE_SERVICE_GLYPHDICTREC(cff_service_glyph_dict, 303 FT_DEFINE_SERVICE_GLYPHDICTREC(
304 cff_service_glyph_dict,
302 (FT_GlyphDict_GetNameFunc) cff_get_glyph_name, 305 (FT_GlyphDict_GetNameFunc) cff_get_glyph_name,
303 (FT_GlyphDict_NameIndexFunc)cff_get_name_index 306 (FT_GlyphDict_NameIndexFunc)cff_get_name_index
304 ) 307 )
305 308
306 309
307 /* 310 /*
308 * POSTSCRIPT INFO SERVICE 311 * POSTSCRIPT INFO SERVICE
309 * 312 *
310 */ 313 */
311 314
312 static FT_Int 315 static FT_Int
313 cff_ps_has_glyph_names( FT_Face face ) 316 cff_ps_has_glyph_names( FT_Face face )
314 { 317 {
315 return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0; 318 return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;
316 } 319 }
317 320
318 321
319 static FT_Error 322 static FT_Error
320 cff_ps_get_font_info( CFF_Face face, 323 cff_ps_get_font_info( CFF_Face face,
321 PS_FontInfoRec* afont_info ) 324 PS_FontInfoRec* afont_info )
322 { 325 {
323 CFF_Font cff = (CFF_Font)face->extra.data; 326 CFF_Font cff = (CFF_Font)face->extra.data;
324 FT_Error error = CFF_Err_Ok; 327 FT_Error error = FT_Err_Ok;
325 328
326 329
327 if ( cff && cff->font_info == NULL ) 330 if ( cff && cff->font_info == NULL )
328 { 331 {
329 CFF_FontRecDict dict = &cff->top_font.font_dict; 332 CFF_FontRecDict dict = &cff->top_font.font_dict;
330 PS_FontInfoRec *font_info = NULL; 333 PS_FontInfoRec *font_info = NULL;
331 FT_Memory memory = face->root.memory; 334 FT_Memory memory = face->root.memory;
332 335
333 336
334 if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) ) 337 if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
(...skipping 18 matching lines...) Expand all
353 } 356 }
354 357
355 if ( cff ) 358 if ( cff )
356 *afont_info = *cff->font_info; 359 *afont_info = *cff->font_info;
357 360
358 Fail: 361 Fail:
359 return error; 362 return error;
360 } 363 }
361 364
362 365
363 FT_DEFINE_SERVICE_PSINFOREC(cff_service_ps_info, 366 FT_DEFINE_SERVICE_PSINFOREC(
367 cff_service_ps_info,
364 (PS_GetFontInfoFunc) cff_ps_get_font_info, 368 (PS_GetFontInfoFunc) cff_ps_get_font_info,
365 (PS_GetFontExtraFunc) NULL, 369 (PS_GetFontExtraFunc) NULL,
366 (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, 370 (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names,
367 (PS_GetFontPrivateFunc)NULL, /* unsupported with CFF fonts */ 371 (PS_GetFontPrivateFunc)NULL, /* unsupported with CFF fonts */
368 (PS_GetFontValueFunc) NULL /* not implemented */ 372 (PS_GetFontValueFunc) NULL /* not implemented */
369 ) 373 )
370 374
371 375
372 /* 376 /*
373 * POSTSCRIPT NAME SERVICE 377 * POSTSCRIPT NAME SERVICE
374 * 378 *
375 */ 379 */
376 380
377 static const char* 381 static const char*
378 cff_get_ps_name( CFF_Face face ) 382 cff_get_ps_name( CFF_Face face )
379 { 383 {
380 CFF_Font cff = (CFF_Font)face->extra.data; 384 CFF_Font cff = (CFF_Font)face->extra.data;
381 385
382 386
383 return (const char*)cff->font_name; 387 return (const char*)cff->font_name;
384 } 388 }
385 389
386 390
387 FT_DEFINE_SERVICE_PSFONTNAMEREC(cff_service_ps_name, 391 FT_DEFINE_SERVICE_PSFONTNAMEREC(
392 cff_service_ps_name,
388 (FT_PsName_GetFunc)cff_get_ps_name 393 (FT_PsName_GetFunc)cff_get_ps_name
389 ) 394 )
390 395
391 396
392 /* 397 /*
393 * TT CMAP INFO 398 * TT CMAP INFO
394 * 399 *
395 * If the charmap is a synthetic Unicode encoding cmap or 400 * If the charmap is a synthetic Unicode encoding cmap or
396 * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO 401 * a Type 1 standard (or expert) encoding cmap, hide TT CMAP INFO
397 * service defined in SFNT module. 402 * service defined in SFNT module.
398 * 403 *
399 * Otherwise call the service function in the sfnt module. 404 * Otherwise call the service function in the sfnt module.
400 * 405 *
401 */ 406 */
402 static FT_Error 407 static FT_Error
403 cff_get_cmap_info( FT_CharMap charmap, 408 cff_get_cmap_info( FT_CharMap charmap,
404 TT_CMapInfo *cmap_info ) 409 TT_CMapInfo *cmap_info )
405 { 410 {
406 FT_CMap cmap = FT_CMAP( charmap ); 411 FT_CMap cmap = FT_CMAP( charmap );
407 FT_Error error = CFF_Err_Ok; 412 FT_Error error = FT_Err_Ok;
408 FT_Face face = FT_CMAP_FACE( cmap ); 413
409 FT_Library library = FT_FACE_LIBRARY( face ); 414 FT_Face face = FT_CMAP_FACE( cmap );
415 FT_Library library = FT_FACE_LIBRARY( face );
410 416
411 417
412 cmap_info->language = 0; 418 cmap_info->language = 0;
413 cmap_info->format = 0; 419 cmap_info->format = 0;
414 420
415 if ( cmap->clazz != &FT_CFF_CMAP_ENCODING_CLASS_REC_GET && 421 if ( cmap->clazz != &CFF_CMAP_ENCODING_CLASS_REC_GET &&
416 cmap->clazz != &FT_CFF_CMAP_UNICODE_CLASS_REC_GET ) 422 cmap->clazz != &CFF_CMAP_UNICODE_CLASS_REC_GET )
417 { 423 {
418 FT_Module sfnt = FT_Get_Module( library, "sfnt" ); 424 FT_Module sfnt = FT_Get_Module( library, "sfnt" );
419 FT_Service_TTCMaps service = 425 FT_Service_TTCMaps service =
420 (FT_Service_TTCMaps)ft_module_get_service( sfnt, 426 (FT_Service_TTCMaps)ft_module_get_service( sfnt,
421 FT_SERVICE_ID_TT_CMAP ); 427 FT_SERVICE_ID_TT_CMAP );
422 428
423 429
424 if ( service && service->get_cmap_info ) 430 if ( service && service->get_cmap_info )
425 error = service->get_cmap_info( charmap, cmap_info ); 431 error = service->get_cmap_info( charmap, cmap_info );
426 } 432 }
427 433
428 return error; 434 return error;
429 } 435 }
430 436
431 437
432 FT_DEFINE_SERVICE_TTCMAPSREC(cff_service_get_cmap_info, 438 FT_DEFINE_SERVICE_TTCMAPSREC(
439 cff_service_get_cmap_info,
433 (TT_CMap_Info_GetFunc)cff_get_cmap_info 440 (TT_CMap_Info_GetFunc)cff_get_cmap_info
434 ) 441 )
435 442
436 443
437 /* 444 /*
438 * CID INFO SERVICE 445 * CID INFO SERVICE
439 * 446 *
440 */ 447 */
441 static FT_Error 448 static FT_Error
442 cff_get_ros( CFF_Face face, 449 cff_get_ros( CFF_Face face,
443 const char* *registry, 450 const char* *registry,
444 const char* *ordering, 451 const char* *ordering,
445 FT_Int *supplement ) 452 FT_Int *supplement )
446 { 453 {
447 FT_Error error = CFF_Err_Ok; 454 FT_Error error = FT_Err_Ok;
448 CFF_Font cff = (CFF_Font)face->extra.data; 455 CFF_Font cff = (CFF_Font)face->extra.data;
449 456
450 457
451 if ( cff ) 458 if ( cff )
452 { 459 {
453 CFF_FontRecDict dict = &cff->top_font.font_dict; 460 CFF_FontRecDict dict = &cff->top_font.font_dict;
454 461
455 462
456 if ( dict->cid_registry == 0xFFFFU ) 463 if ( dict->cid_registry == 0xFFFFU )
457 { 464 {
458 error = CFF_Err_Invalid_Argument; 465 error = FT_THROW( Invalid_Argument );
459 goto Fail; 466 goto Fail;
460 } 467 }
461 468
462 if ( registry ) 469 if ( registry )
463 { 470 {
464 if ( cff->registry == NULL ) 471 if ( cff->registry == NULL )
465 cff->registry = cff_index_get_sid_string( cff, 472 cff->registry = cff_index_get_sid_string( cff,
466 dict->cid_registry ); 473 dict->cid_registry );
467 *registry = cff->registry; 474 *registry = cff->registry;
468 } 475 }
(...skipping 23 matching lines...) Expand all
492 499
493 Fail: 500 Fail:
494 return error; 501 return error;
495 } 502 }
496 503
497 504
498 static FT_Error 505 static FT_Error
499 cff_get_is_cid( CFF_Face face, 506 cff_get_is_cid( CFF_Face face,
500 FT_Bool *is_cid ) 507 FT_Bool *is_cid )
501 { 508 {
502 FT_Error error = CFF_Err_Ok; 509 FT_Error error = FT_Err_Ok;
503 CFF_Font cff = (CFF_Font)face->extra.data; 510 CFF_Font cff = (CFF_Font)face->extra.data;
504 511
505 512
506 *is_cid = 0; 513 *is_cid = 0;
507 514
508 if ( cff ) 515 if ( cff )
509 { 516 {
510 CFF_FontRecDict dict = &cff->top_font.font_dict; 517 CFF_FontRecDict dict = &cff->top_font.font_dict;
511 518
512 519
513 if ( dict->cid_registry != 0xFFFFU ) 520 if ( dict->cid_registry != 0xFFFFU )
514 *is_cid = 1; 521 *is_cid = 1;
515 } 522 }
516 523
517 return error; 524 return error;
518 } 525 }
519 526
520 527
521 static FT_Error 528 static FT_Error
522 cff_get_cid_from_glyph_index( CFF_Face face, 529 cff_get_cid_from_glyph_index( CFF_Face face,
523 FT_UInt glyph_index, 530 FT_UInt glyph_index,
524 FT_UInt *cid ) 531 FT_UInt *cid )
525 { 532 {
526 FT_Error error = CFF_Err_Ok; 533 FT_Error error = FT_Err_Ok;
527 CFF_Font cff; 534 CFF_Font cff;
528 535
529 536
530 cff = (CFF_Font)face->extra.data; 537 cff = (CFF_Font)face->extra.data;
531 538
532 if ( cff ) 539 if ( cff )
533 { 540 {
534 FT_UInt c; 541 FT_UInt c;
535 CFF_FontRecDict dict = &cff->top_font.font_dict; 542 CFF_FontRecDict dict = &cff->top_font.font_dict;
536 543
537 544
538 if ( dict->cid_registry == 0xFFFFU ) 545 if ( dict->cid_registry == 0xFFFFU )
539 { 546 {
540 error = CFF_Err_Invalid_Argument; 547 error = FT_THROW( Invalid_Argument );
541 goto Fail; 548 goto Fail;
542 } 549 }
543 550
544 if ( glyph_index > cff->num_glyphs ) 551 if ( glyph_index > cff->num_glyphs )
545 { 552 {
546 error = CFF_Err_Invalid_Argument; 553 error = FT_THROW( Invalid_Argument );
547 goto Fail; 554 goto Fail;
548 } 555 }
549 556
550 c = cff->charset.sids[glyph_index]; 557 c = cff->charset.sids[glyph_index];
551 558
552 if ( cid ) 559 if ( cid )
553 *cid = c; 560 *cid = c;
554 } 561 }
555 562
556 Fail: 563 Fail:
557 return error; 564 return error;
558 } 565 }
559 566
560 567
561 FT_DEFINE_SERVICE_CIDREC(cff_service_cid_info, 568 FT_DEFINE_SERVICE_CIDREC(
569 cff_service_cid_info,
562 (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros, 570 (FT_CID_GetRegistryOrderingSupplementFunc)cff_get_ros,
563 (FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid, 571 (FT_CID_GetIsInternallyCIDKeyedFunc) cff_get_is_cid,
564 (FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index 572 (FT_CID_GetCIDFromGlyphIndexFunc) cff_get_cid_from_glyph_index
565 ) 573 )
566 574
567 575
576 /*
577 * PROPERTY SERVICE
578 *
579 */
580 static FT_Error
581 cff_property_set( FT_Module module, /* CFF_Driver */
582 const char* property_name,
583 const void* value )
584 {
585 FT_Error error = FT_Err_Ok;
586 CFF_Driver driver = (CFF_Driver)module;
587
588
589 if ( !ft_strcmp( property_name, "hinting-engine" ) )
590 {
591 FT_UInt* hinting_engine = (FT_UInt*)value;
592
593
594 #ifndef CFF_CONFIG_OPTION_OLD_ENGINE
595 if ( *hinting_engine != FT_CFF_HINTING_ADOBE )
596 error = FT_ERR( Unimplemented_Feature );
597 else
598 #endif
599 driver->hinting_engine = *hinting_engine;
600
601 return error;
602 }
603 else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
604 {
605 FT_Bool* no_stem_darkening = (FT_Bool*)value;
606
607
608 driver->no_stem_darkening = *no_stem_darkening;
609
610 return error;
611 }
612
613 FT_TRACE0(( "cff_property_set: missing property `%s'\n",
614 property_name ));
615 return FT_THROW( Missing_Property );
616 }
617
618
619 static FT_Error
620 cff_property_get( FT_Module module, /* CFF_Driver */
621 const char* property_name,
622 const void* value )
623 {
624 FT_Error error = FT_Err_Ok;
625 CFF_Driver driver = (CFF_Driver)module;
626
627 FT_UInt hinting_engine = driver->hinting_engine;
628 FT_Bool no_stem_darkening = driver->no_stem_darkening;
629
630
631 if ( !ft_strcmp( property_name, "hinting-engine" ) )
632 {
633 FT_UInt* val = (FT_UInt*)value;
634
635
636 *val = hinting_engine;
637
638 return error;
639 }
640 else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
641 {
642 FT_Bool* val = (FT_Bool*)value;
643
644
645 *val = no_stem_darkening;
646
647 return error;
648 }
649
650 FT_TRACE0(( "cff_property_get: missing property `%s'\n",
651 property_name ));
652 return FT_THROW( Missing_Property );
653 }
654
655
656 FT_DEFINE_SERVICE_PROPERTIESREC(
657 cff_service_properties,
658 (FT_Properties_SetFunc)cff_property_set,
659 (FT_Properties_GetFunc)cff_property_get )
660
661
568 /*************************************************************************/ 662 /*************************************************************************/
569 /*************************************************************************/ 663 /*************************************************************************/
570 /*************************************************************************/ 664 /*************************************************************************/
571 /**** ****/ 665 /**** ****/
572 /**** ****/ 666 /**** ****/
573 /**** D R I V E R I N T E R F A C E ****/ 667 /**** D R I V E R I N T E R F A C E ****/
574 /**** ****/ 668 /**** ****/
575 /**** ****/ 669 /**** ****/
576 /*************************************************************************/ 670 /*************************************************************************/
577 /*************************************************************************/ 671 /*************************************************************************/
578 /*************************************************************************/ 672 /*************************************************************************/
673
579 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES 674 #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
580 FT_DEFINE_SERVICEDESCREC6(cff_services, 675 FT_DEFINE_SERVICEDESCREC7(
676 cff_services,
581 FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF, 677 FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF,
582 FT_SERVICE_ID_POSTSCRIPT_INFO, &FT_CFF_SERVICE_PS_INFO_GET, 678 FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
583 FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET, 679 FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
584 FT_SERVICE_ID_GLYPH_DICT, &FT_CFF_SERVICE_GLYPH_DICT_GET, 680 FT_SERVICE_ID_GLYPH_DICT, &CFF_SERVICE_GLYPH_DICT_GET,
585 FT_SERVICE_ID_TT_CMAP, &FT_CFF_SERVICE_GET_CMAP_INFO_GET, 681 FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
586 FT_SERVICE_ID_CID, &FT_CFF_SERVICE_CID_INFO_GET 682 FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
683 FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
587 ) 684 )
588 #else 685 #else
589 FT_DEFINE_SERVICEDESCREC5(cff_services, 686 FT_DEFINE_SERVICEDESCREC6(
687 cff_services,
590 FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF, 688 FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_CFF,
591 FT_SERVICE_ID_POSTSCRIPT_INFO, &FT_CFF_SERVICE_PS_INFO_GET, 689 FT_SERVICE_ID_POSTSCRIPT_INFO, &CFF_SERVICE_PS_INFO_GET,
592 FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &FT_CFF_SERVICE_PS_NAME_GET, 690 FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &CFF_SERVICE_PS_NAME_GET,
593 FT_SERVICE_ID_TT_CMAP, &FT_CFF_SERVICE_GET_CMAP_INFO_GET, 691 FT_SERVICE_ID_TT_CMAP, &CFF_SERVICE_GET_CMAP_INFO_GET,
594 FT_SERVICE_ID_CID, &FT_CFF_SERVICE_CID_INFO_GET 692 FT_SERVICE_ID_CID, &CFF_SERVICE_CID_INFO_GET,
693 FT_SERVICE_ID_PROPERTIES, &CFF_SERVICE_PROPERTIES_GET
595 ) 694 )
596 #endif 695 #endif
597 696
697
598 FT_CALLBACK_DEF( FT_Module_Interface ) 698 FT_CALLBACK_DEF( FT_Module_Interface )
599 cff_get_interface( FT_Module driver, /* CFF_Driver */ 699 cff_get_interface( FT_Module driver, /* CFF_Driver */
600 const char* module_interface ) 700 const char* module_interface )
601 { 701 {
602 FT_Library library; 702 FT_Library library;
603 FT_Module sfnt; 703 FT_Module sfnt;
604 FT_Module_Interface result; 704 FT_Module_Interface result;
605 705
606 706
607 /* FT_CFF_SERVICES_GET derefers `library' in PIC mode */ 707 /* CFF_SERVICES_GET derefers `library' in PIC mode */
608 #ifdef FT_CONFIG_OPTION_PIC 708 #ifdef FT_CONFIG_OPTION_PIC
609 if ( !driver ) 709 if ( !driver )
610 return NULL; 710 return NULL;
611 library = driver->library; 711 library = driver->library;
612 if ( !library ) 712 if ( !library )
613 return NULL; 713 return NULL;
614 #endif 714 #endif
615 715
616 result = ft_service_list_lookup( FT_CFF_SERVICES_GET, module_interface ); 716 result = ft_service_list_lookup( CFF_SERVICES_GET, module_interface );
617 if ( result != NULL ) 717 if ( result != NULL )
618 return result; 718 return result;
619 719
620 /* `driver' is not yet evaluated in non-PIC mode */ 720 /* `driver' is not yet evaluated in non-PIC mode */
621 #ifndef FT_CONFIG_OPTION_PIC 721 #ifndef FT_CONFIG_OPTION_PIC
622 if ( !driver ) 722 if ( !driver )
623 return NULL; 723 return NULL;
624 library = driver->library; 724 library = driver->library;
625 if ( !library ) 725 if ( !library )
626 return NULL; 726 return NULL;
627 #endif 727 #endif
628 728
629 /* we pass our request to the `sfnt' module */ 729 /* we pass our request to the `sfnt' module */
630 sfnt = FT_Get_Module( library, "sfnt" ); 730 sfnt = FT_Get_Module( library, "sfnt" );
631 731
632 return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0; 732 return sfnt ? sfnt->clazz->get_interface( sfnt, module_interface ) : 0;
633 } 733 }
634 734
635 735
636 /* The FT_DriverInterface structure is defined in ftdriver.h. */ 736 /* The FT_DriverInterface structure is defined in ftdriver.h. */
637 737
638 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS 738 #ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
639 #define CFF_SIZE_SELECT cff_size_select 739 #define CFF_SIZE_SELECT cff_size_select
640 #else 740 #else
641 #define CFF_SIZE_SELECT 0 741 #define CFF_SIZE_SELECT 0
642 #endif 742 #endif
643 743
644 FT_DEFINE_DRIVER( cff_driver_class, 744 FT_DEFINE_DRIVER(
745 cff_driver_class,
645 746
646 FT_MODULE_FONT_DRIVER | 747 FT_MODULE_FONT_DRIVER |
647 FT_MODULE_DRIVER_SCALABLE | 748 FT_MODULE_DRIVER_SCALABLE |
648 FT_MODULE_DRIVER_HAS_HINTER, 749 FT_MODULE_DRIVER_HAS_HINTER,
649 750
650 sizeof ( CFF_DriverRec ), 751 sizeof ( CFF_DriverRec ),
651 "cff", 752 "cff",
652 0x10000L, 753 0x10000L,
653 0x20000L, 754 0x20000L,
654 755
655 0, /* module-specific interface */ 756 0, /* module-specific interface */
656 757
657 cff_driver_init, 758 cff_driver_init,
658 cff_driver_done, 759 cff_driver_done,
659 cff_get_interface, 760 cff_get_interface,
660 761
661 /* now the specific driver fields */ 762 /* now the specific driver fields */
662 sizeof ( TT_FaceRec ), 763 sizeof ( TT_FaceRec ),
663 sizeof ( CFF_SizeRec ), 764 sizeof ( CFF_SizeRec ),
664 sizeof ( CFF_GlyphSlotRec ), 765 sizeof ( CFF_GlyphSlotRec ),
665 766
666 cff_face_init, 767 cff_face_init,
667 cff_face_done, 768 cff_face_done,
668 cff_size_init, 769 cff_size_init,
669 cff_size_done, 770 cff_size_done,
670 cff_slot_init, 771 cff_slot_init,
671 cff_slot_done, 772 cff_slot_done,
672 773
673 ft_stub_set_char_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
674 ft_stub_set_pixel_sizes, /* FT_CONFIG_OPTION_OLD_INTERNALS */
675
676 cff_glyph_load, 774 cff_glyph_load,
677 775
678 cff_get_kerning, 776 cff_get_kerning,
679 0, /* FT_Face_AttachFunc */ 777 0, /* FT_Face_AttachFunc */
680 cff_get_advances, 778 cff_get_advances,
681 779
682 cff_size_request, 780 cff_size_request,
683 781
684 CFF_SIZE_SELECT 782 CFF_SIZE_SELECT
685 ) 783 )
686 784
687 785
688 /* END */ 786 /* END */
OLDNEW
« no previous file with comments | « src/cff/cffcmap.c ('k') | src/cff/cffgload.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698