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

Side by Side Diff: third_party/freetype/src/cff/cf2ft.c

Issue 1413673003: Update bundled freetype to 2.6.1 (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: DEPS for corpus Created 5 years, 1 month 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 | « third_party/freetype/src/cff/cf2ft.h ('k') | third_party/freetype/src/cff/cf2hints.c » ('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 /* cf2ft.c */ 3 /* cf2ft.c */
4 /* */ 4 /* */
5 /* FreeType Glue Component to Adobe's Interpreter (body). */ 5 /* FreeType Glue Component to Adobe's Interpreter (body). */
6 /* */ 6 /* */
7 /* Copyright 2013-2014 Adobe Systems Incorporated. */ 7 /* Copyright 2013-2014 Adobe Systems Incorporated. */
8 /* */ 8 /* */
9 /* This software, and all works of authorship, whether in source or */ 9 /* This software, and all works of authorship, whether in source or */
10 /* object code form as indicated by the copyright notice(s) included */ 10 /* object code form as indicated by the copyright notice(s) included */
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 /* return 0 on success */ 544 /* return 0 on success */
545 FT_LOCAL_DEF( CF2_Int ) 545 FT_LOCAL_DEF( CF2_Int )
546 cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, 546 cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
547 CF2_UInt idx, 547 CF2_UInt idx,
548 CF2_Buffer buf ) 548 CF2_Buffer buf )
549 { 549 {
550 FT_ASSERT( decoder ); 550 FT_ASSERT( decoder );
551 551
552 FT_ZERO( buf ); 552 FT_ZERO( buf );
553 553
554 idx += decoder->globals_bias; 554 idx += (CF2_UInt)decoder->globals_bias;
555 if ( idx >= decoder->num_globals ) 555 if ( idx >= decoder->num_globals )
556 return TRUE; /* error */ 556 return TRUE; /* error */
557 557
558 FT_ASSERT( decoder->globals ); 558 FT_ASSERT( decoder->globals );
559 559
560 buf->start = 560 buf->start =
561 buf->ptr = decoder->globals[idx]; 561 buf->ptr = decoder->globals[idx];
562 buf->end = decoder->globals[idx + 1]; 562 buf->end = decoder->globals[idx + 1];
563 563
564 return FALSE; /* success */ 564 return FALSE; /* success */
565 } 565 }
566 566
567 567
568 /* convert AdobeStandardEncoding code to CF2_Buffer; */ 568 /* convert AdobeStandardEncoding code to CF2_Buffer; */
569 /* used for seac component */ 569 /* used for seac component */
570 FT_LOCAL_DEF( FT_Error ) 570 FT_LOCAL_DEF( FT_Error )
571 cf2_getSeacComponent( CFF_Decoder* decoder, 571 cf2_getSeacComponent( CFF_Decoder* decoder,
572 CF2_UInt code, 572 CF2_Int code,
573 CF2_Buffer buf ) 573 CF2_Buffer buf )
574 { 574 {
575 CF2_Int gid; 575 CF2_Int gid;
576 FT_Byte* charstring; 576 FT_Byte* charstring;
577 FT_ULong len; 577 FT_ULong len;
578 FT_Error error; 578 FT_Error error;
579 579
580 580
581 FT_ASSERT( decoder ); 581 FT_ASSERT( decoder );
582 582
583 FT_ZERO( buf ); 583 FT_ZERO( buf );
584 584
585 gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code ); 585 #ifdef FT_CONFIG_OPTION_INCREMENTAL
586 if ( gid < 0 ) 586 /* Incremental fonts don't necessarily have valid charsets. */
587 return FT_THROW( Invalid_Glyph_Format ); 587 /* They use the character code, not the glyph index, in this case. */
588 if ( decoder->builder.face->root.internal->incremental_interface )
589 gid = code;
590 else
591 #endif /* FT_CONFIG_OPTION_INCREMENTAL */
592 {
593 gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code );
594 if ( gid < 0 )
595 return FT_THROW( Invalid_Glyph_Format );
596 }
588 597
589 error = cff_get_glyph_data( decoder->builder.face, 598 error = cff_get_glyph_data( decoder->builder.face,
590 gid, 599 (CF2_UInt)gid,
591 &charstring, 600 &charstring,
592 &len ); 601 &len );
593 /* TODO: for now, just pass the FreeType error through */ 602 /* TODO: for now, just pass the FreeType error through */
594 if ( error ) 603 if ( error )
595 return error; 604 return error;
596 605
597 /* assume input has been validated */ 606 /* assume input has been validated */
598 FT_ASSERT( charstring + len >= charstring ); 607 FT_ASSERT( charstring + len >= charstring );
599 608
600 buf->start = charstring; 609 buf->start = charstring;
(...skipping 18 matching lines...) Expand all
619 628
620 FT_LOCAL_DEF( CF2_Int ) 629 FT_LOCAL_DEF( CF2_Int )
621 cf2_initLocalRegionBuffer( CFF_Decoder* decoder, 630 cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
622 CF2_UInt idx, 631 CF2_UInt idx,
623 CF2_Buffer buf ) 632 CF2_Buffer buf )
624 { 633 {
625 FT_ASSERT( decoder ); 634 FT_ASSERT( decoder );
626 635
627 FT_ZERO( buf ); 636 FT_ZERO( buf );
628 637
629 idx += decoder->locals_bias; 638 idx += (CF2_UInt)decoder->locals_bias;
630 if ( idx >= decoder->num_locals ) 639 if ( idx >= decoder->num_locals )
631 return TRUE; /* error */ 640 return TRUE; /* error */
632 641
633 FT_ASSERT( decoder->locals ); 642 FT_ASSERT( decoder->locals );
634 643
635 buf->start = 644 buf->start =
636 buf->ptr = decoder->locals[idx]; 645 buf->ptr = decoder->locals[idx];
637 buf->end = decoder->locals[idx + 1]; 646 buf->end = decoder->locals[idx + 1];
638 647
639 return FALSE; /* success */ 648 return FALSE; /* success */
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 691
683 FT_ASSERT( decoder ); 692 FT_ASSERT( decoder );
684 693
685 cff_builder_close_contour( &decoder->builder ); 694 cff_builder_close_contour( &decoder->builder );
686 695
687 FT_GlyphLoader_Add( decoder->builder.loader ); 696 FT_GlyphLoader_Add( decoder->builder.loader );
688 } 697 }
689 698
690 699
691 /* END */ 700 /* END */
OLDNEW
« no previous file with comments | « third_party/freetype/src/cff/cf2ft.h ('k') | third_party/freetype/src/cff/cf2hints.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698