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

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

Issue 815103002: Update freetype to 2.5.4. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Adjust GYP and GN Created 6 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 | « third_party/freetype/src/cff/cffdrivr.h ('k') | third_party/freetype/src/cff/cfferrs.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-2013 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
18 18
19 #include "../../include/ft2build.h" 19 #include <ft2build.h>
20 #include "../../include/freetype/freetype.h" 20 #include FT_FREETYPE_H
21 #include "../../include/freetype/internal/ftdebug.h" 21 #include FT_INTERNAL_DEBUG_H
22 #include "../../include/freetype/internal/ftstream.h" 22 #include FT_INTERNAL_STREAM_H
23 #include "../../include/freetype/internal/sfnt.h" 23 #include FT_INTERNAL_SFNT_H
24 #include "../../include/freetype/internal/services/svcid.h" 24 #include FT_SERVICE_CID_H
25 #include "../../include/freetype/internal/services/svpsinfo.h" 25 #include FT_SERVICE_POSTSCRIPT_INFO_H
26 #include "../../include/freetype/internal/services/svpostnm.h" 26 #include FT_SERVICE_POSTSCRIPT_NAME_H
27 #include "../../include/freetype/internal/services/svttcmap.h" 27 #include FT_SERVICE_TT_CMAP_H
28 28
29 #include "cffdrivr.h" 29 #include "cffdrivr.h"
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 "../../include/freetype/internal/services/svxf86nm.h" 38 #include FT_SERVICE_XFREE86_NAME_H
39 #include "../../include/freetype/internal/services/svgldict.h" 39 #include FT_SERVICE_GLYPH_DICT_H
40 #include "../../include/freetype/internal/services/svprop.h" 40 #include FT_SERVICE_PROPERTIES_H
41 #include "../../include/freetype/ftcffdrv.h" 41 #include FT_CFF_DRIVER_H
42
43 42
44 43
45 /*************************************************************************/ 44 /*************************************************************************/
46 /* */ 45 /* */
47 /* 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 */
48 /* 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 */
49 /* messages during execution. */ 48 /* messages during execution. */
50 /* */ 49 /* */
51 #undef FT_COMPONENT 50 #undef FT_COMPONENT
52 #define FT_COMPONENT trace_cffdriver 51 #define FT_COMPONENT trace_cffdriver
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 FT_Int32 load_flags ) 157 FT_Int32 load_flags )
159 { 158 {
160 FT_Error error; 159 FT_Error error;
161 CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot; 160 CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot;
162 CFF_Size size = (CFF_Size)cffsize; 161 CFF_Size size = (CFF_Size)cffsize;
163 162
164 163
165 if ( !slot ) 164 if ( !slot )
166 return FT_THROW( Invalid_Slot_Handle ); 165 return FT_THROW( Invalid_Slot_Handle );
167 166
167 FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index ));
168
168 /* check whether we want a scaled outline or bitmap */ 169 /* check whether we want a scaled outline or bitmap */
169 if ( !size ) 170 if ( !size )
170 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING; 171 load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
171 172
172 /* reset the size object if necessary */ 173 /* reset the size object if necessary */
173 if ( load_flags & FT_LOAD_NO_SCALE ) 174 if ( load_flags & FT_LOAD_NO_SCALE )
174 size = NULL; 175 size = NULL;
175 176
176 if ( size ) 177 if ( size )
177 { 178 {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 */ 581 */
581 static FT_Error 582 static FT_Error
582 cff_property_set( FT_Module module, /* CFF_Driver */ 583 cff_property_set( FT_Module module, /* CFF_Driver */
583 const char* property_name, 584 const char* property_name,
584 const void* value ) 585 const void* value )
585 { 586 {
586 FT_Error error = FT_Err_Ok; 587 FT_Error error = FT_Err_Ok;
587 CFF_Driver driver = (CFF_Driver)module; 588 CFF_Driver driver = (CFF_Driver)module;
588 589
589 590
590 if ( !ft_strcmp( property_name, "hinting-engine" ) ) 591 if ( !ft_strcmp( property_name, "darkening-parameters" ) )
592 {
593 FT_Int* darken_params = (FT_Int*)value;
594
595 FT_Int x1 = darken_params[0];
596 FT_Int y1 = darken_params[1];
597 FT_Int x2 = darken_params[2];
598 FT_Int y2 = darken_params[3];
599 FT_Int x3 = darken_params[4];
600 FT_Int y3 = darken_params[5];
601 FT_Int x4 = darken_params[6];
602 FT_Int y4 = darken_params[7];
603
604
605 if ( x1 < 0 || x2 < 0 || x3 < 0 || x4 < 0 ||
606 y1 < 0 || y2 < 0 || y3 < 0 || y4 < 0 ||
607 x1 > x2 || x2 > x3 || x3 > x4 ||
608 y1 > 500 || y2 > 500 || y3 > 500 || y4 > 500 )
609 return FT_THROW( Invalid_Argument );
610
611 driver->darken_params[0] = x1;
612 driver->darken_params[1] = y1;
613 driver->darken_params[2] = x2;
614 driver->darken_params[3] = y2;
615 driver->darken_params[4] = x3;
616 driver->darken_params[5] = y3;
617 driver->darken_params[6] = x4;
618 driver->darken_params[7] = y4;
619
620 return error;
621 }
622 else if ( !ft_strcmp( property_name, "hinting-engine" ) )
591 { 623 {
592 FT_UInt* hinting_engine = (FT_UInt*)value; 624 FT_UInt* hinting_engine = (FT_UInt*)value;
593 625
594 626
595 #ifndef CFF_CONFIG_OPTION_OLD_ENGINE 627 #ifndef CFF_CONFIG_OPTION_OLD_ENGINE
596 if ( *hinting_engine != FT_CFF_HINTING_ADOBE ) 628 if ( *hinting_engine != FT_CFF_HINTING_ADOBE )
597 error = FT_ERR( Unimplemented_Feature ); 629 error = FT_ERR( Unimplemented_Feature );
598 else 630 else
599 #endif 631 #endif
600 driver->hinting_engine = *hinting_engine; 632 driver->hinting_engine = *hinting_engine;
(...skipping 17 matching lines...) Expand all
618 650
619 651
620 static FT_Error 652 static FT_Error
621 cff_property_get( FT_Module module, /* CFF_Driver */ 653 cff_property_get( FT_Module module, /* CFF_Driver */
622 const char* property_name, 654 const char* property_name,
623 const void* value ) 655 const void* value )
624 { 656 {
625 FT_Error error = FT_Err_Ok; 657 FT_Error error = FT_Err_Ok;
626 CFF_Driver driver = (CFF_Driver)module; 658 CFF_Driver driver = (CFF_Driver)module;
627 659
628 FT_UInt hinting_engine = driver->hinting_engine; 660
629 FT_Bool no_stem_darkening = driver->no_stem_darkening; 661 if ( !ft_strcmp( property_name, "darkening-parameters" ) )
662 {
663 FT_Int* darken_params = driver->darken_params;
664 FT_Int* val = (FT_Int*)value;
630 665
631 666
632 if ( !ft_strcmp( property_name, "hinting-engine" ) ) 667 val[0] = darken_params[0];
668 val[1] = darken_params[1];
669 val[2] = darken_params[2];
670 val[3] = darken_params[3];
671 val[4] = darken_params[4];
672 val[5] = darken_params[5];
673 val[6] = darken_params[6];
674 val[7] = darken_params[7];
675
676 return error;
677 }
678 else if ( !ft_strcmp( property_name, "hinting-engine" ) )
633 { 679 {
634 FT_UInt* val = (FT_UInt*)value; 680 FT_UInt hinting_engine = driver->hinting_engine;
681 FT_UInt* val = (FT_UInt*)value;
635 682
636 683
637 *val = hinting_engine; 684 *val = hinting_engine;
638 685
639 return error; 686 return error;
640 } 687 }
641 else if ( !ft_strcmp( property_name, "no-stem-darkening" ) ) 688 else if ( !ft_strcmp( property_name, "no-stem-darkening" ) )
642 { 689 {
643 FT_Bool* val = (FT_Bool*)value; 690 FT_Bool no_stem_darkening = driver->no_stem_darkening;
691 FT_Bool* val = (FT_Bool*)value;
644 692
645 693
646 *val = no_stem_darkening; 694 *val = no_stem_darkening;
647 695
648 return error; 696 return error;
649 } 697 }
650 698
651 FT_TRACE0(( "cff_property_get: missing property `%s'\n", 699 FT_TRACE0(( "cff_property_get: missing property `%s'\n",
652 property_name )); 700 property_name ));
653 return FT_THROW( Missing_Property ); 701 return FT_THROW( Missing_Property );
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 0, /* FT_Face_AttachFunc */ 826 0, /* FT_Face_AttachFunc */
779 cff_get_advances, 827 cff_get_advances,
780 828
781 cff_size_request, 829 cff_size_request,
782 830
783 CFF_SIZE_SELECT 831 CFF_SIZE_SELECT
784 ) 832 )
785 833
786 834
787 /* END */ 835 /* END */
OLDNEW
« no previous file with comments | « third_party/freetype/src/cff/cffdrivr.h ('k') | third_party/freetype/src/cff/cfferrs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698