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

Side by Side Diff: third_party/freetype/src/truetype/ttobjs.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/truetype/ttobjs.h ('k') | third_party/freetype/src/truetype/ttpic.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 /* ttobjs.c */ 3 /* ttobjs.c */
4 /* */ 4 /* */
5 /* Objects manager (body). */ 5 /* Objects manager (body). */
6 /* */ 6 /* */
7 /* Copyright 1996-2013 */ 7 /* Copyright 1996-2013 */
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/internal/ftdebug.h" 20 #include FT_INTERNAL_DEBUG_H
21 #include "../../include/freetype/internal/ftstream.h" 21 #include FT_INTERNAL_STREAM_H
22 #include "../../include/freetype/tttags.h" 22 #include FT_TRUETYPE_TAGS_H
23 #include "../../include/freetype/internal/sfnt.h" 23 #include FT_INTERNAL_SFNT_H
24 #include "../../include/freetype/ftttdrv.h" 24 #include FT_TRUETYPE_DRIVER_H
25 25
26 #include "ttgload.h" 26 #include "ttgload.h"
27 #include "ttpload.h" 27 #include "ttpload.h"
28 28
29 #include "tterrors.h" 29 #include "tterrors.h"
30 30
31 #ifdef TT_USE_BYTECODE_INTERPRETER 31 #ifdef TT_USE_BYTECODE_INTERPRETER
32 #include "ttinterp.h" 32 #include "ttinterp.h"
33 #endif 33 #endif
34 34
35 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING 35 #ifdef TT_CONFIG_OPTION_UNPATENTED_HINTING
36 #include "../../include/freetype/ttunpat.h" 36 #include FT_TRUETYPE_UNPATENTED_H
37 #endif 37 #endif
38 38
39 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT 39 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
40 #include "ttgxvar.h" 40 #include "ttgxvar.h"
41 #endif 41 #endif
42 42
43 /*************************************************************************/ 43 /*************************************************************************/
44 /* */ 44 /* */
45 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ 45 /* The macro FT_COMPONENT is used in trace mode. It is an implicit */
46 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */ 46 /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 #endif /* TT_USE_BYTECODE_INTERPRETER */ 143 #endif /* TT_USE_BYTECODE_INTERPRETER */
144 144
145 145
146 /* Compare the face with a list of well-known `tricky' fonts. */ 146 /* Compare the face with a list of well-known `tricky' fonts. */
147 /* This list shall be expanded as we find more of them. */ 147 /* This list shall be expanded as we find more of them. */
148 148
149 static FT_Bool 149 static FT_Bool
150 tt_check_trickyness_family( FT_String* name ) 150 tt_check_trickyness_family( FT_String* name )
151 { 151 {
152 152
153 #define TRICK_NAMES_MAX_CHARACTERS 16 153 #define TRICK_NAMES_MAX_CHARACTERS 19
154 #define TRICK_NAMES_COUNT 8 154 #define TRICK_NAMES_COUNT 9
155 155
156 static const char trick_names[TRICK_NAMES_COUNT] 156 static const char trick_names[TRICK_NAMES_COUNT]
157 [TRICK_NAMES_MAX_CHARACTERS + 1] = 157 [TRICK_NAMES_MAX_CHARACTERS + 1] =
158 { 158 {
159 "DFKaiSho-SB", /* dfkaisb.ttf */ 159 "DFKaiSho-SB", /* dfkaisb.ttf */
160 "DFKaiShu", 160 "DFKaiShu",
161 "DFKai-SB", /* kaiu.ttf */ 161 "DFKai-SB", /* kaiu.ttf */
162 "HuaTianKaiTi?", /* htkt2.ttf */ 162 "HuaTianKaiTi?", /* htkt2.ttf */
163 "HuaTianSongTi?", /* htst3.ttf */ 163 "HuaTianSongTi?", /* htst3.ttf */
164 "MingLiU", /* mingliu.ttf & mingliu.ttc */ 164 "Ming(for ISO10646)", /* hkscsiic.ttf & iicore.ttf */
165 "PMingLiU", /* mingliu.ttc */ 165 "MingLiU", /* mingliu.ttf & mingliu.ttc */
166 "MingLi43", /* mingli.ttf */ 166 "PMingLiU", /* mingliu.ttc */
167 "MingLi43", /* mingli.ttf */
167 }; 168 };
168 169
169 int nn; 170 int nn;
170 171
171 172
172 for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ ) 173 for ( nn = 0; nn < TRICK_NAMES_COUNT; nn++ )
173 if ( ft_strstr( name, trick_names[nn] ) ) 174 if ( ft_strstr( name, trick_names[nn] ) )
174 return TRUE; 175 return TRUE;
175 176
176 return FALSE; 177 return FALSE;
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 error = FT_THROW( Missing_Module ); 526 error = FT_THROW( Missing_Module );
526 goto Exit; 527 goto Exit;
527 } 528 }
528 529
529 /* create input stream from resource */ 530 /* create input stream from resource */
530 if ( FT_STREAM_SEEK( 0 ) ) 531 if ( FT_STREAM_SEEK( 0 ) )
531 goto Exit; 532 goto Exit;
532 533
533 /* check that we have a valid TrueType file */ 534 /* check that we have a valid TrueType file */
534 error = sfnt->init_face( stream, face, face_index, num_params, params ); 535 error = sfnt->init_face( stream, face, face_index, num_params, params );
536
537 /* Stream may have changed. */
538 stream = face->root.stream;
539
535 if ( error ) 540 if ( error )
536 goto Exit; 541 goto Exit;
537 542
538 /* We must also be able to accept Mac/GX fonts, as well as OT ones. */ 543 /* We must also be able to accept Mac/GX fonts, as well as OT ones. */
539 /* The 0x00020000 tag is completely undocumented; some fonts from */ 544 /* The 0x00020000 tag is completely undocumented; some fonts from */
540 /* Arphic made for Chinese Windows 3.1 have this. */ 545 /* Arphic made for Chinese Windows 3.1 have this. */
541 if ( face->format_tag != 0x00010000L && /* MS fonts */ 546 if ( face->format_tag != 0x00010000L && /* MS fonts */
542 face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */ 547 face->format_tag != 0x00020000L && /* CJK fonts for Win 3.1 */
543 face->format_tag != TTAG_true ) /* Mac fonts */ 548 face->format_tag != TTAG_true ) /* Mac fonts */
544 { 549 {
545 FT_TRACE2(( " not a TTF font\n" )); 550 FT_TRACE2(( " not a TTF font\n" ));
546 goto Bad_Format; 551 goto Bad_Format;
547 } 552 }
548 » else
549 » {
550 » » FT_ULong table_len;
551 » » if (face->goto_table( face, TTAG_CFF, stream, &table_len) != TT_ Err_Table_Missing &&
552 » » » face->goto_table( face, TTAG_loca, stream, &table_len) = = TT_Err_Table_Missing)
553 » » {
554 » » » FT_TRACE2(( "[not a valid TTF font]\n" ));
555 » » » goto Bad_Format;
556 » » }
557 » }
558 553
559 #ifdef TT_USE_BYTECODE_INTERPRETER 554 #ifdef TT_USE_BYTECODE_INTERPRETER
560 ttface->face_flags |= FT_FACE_FLAG_HINTER; 555 ttface->face_flags |= FT_FACE_FLAG_HINTER;
561 #endif 556 #endif
562 557
563 /* If we are performing a simple font format check, exit immediately. */ 558 /* If we are performing a simple font format check, exit immediately. */
564 if ( face_index < 0 ) 559 if ( face_index < 0 )
565 return FT_Err_Ok; 560 return FT_Err_Ok;
566 561
567 /* Load font directory */ 562 /* Load font directory */
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 753
759 /* debugging instances have their own context */ 754 /* debugging instances have their own context */
760 if ( size->debug ) 755 if ( size->debug )
761 exec = size->context; 756 exec = size->context;
762 else 757 else
763 exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context; 758 exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
764 759
765 if ( !exec ) 760 if ( !exec )
766 return FT_THROW( Could_Not_Find_Context ); 761 return FT_THROW( Could_Not_Find_Context );
767 762
768 TT_Load_Context( exec, face, size ); 763 error = TT_Load_Context( exec, face, size );
764 if ( error )
765 return error;
769 766
770 exec->callTop = 0; 767 exec->callTop = 0;
771 exec->top = 0; 768 exec->top = 0;
772 769
773 exec->period = 64; 770 exec->period = 64;
774 exec->phase = 0; 771 exec->phase = 0;
775 exec->threshold = 0; 772 exec->threshold = 0;
776 773
777 exec->instruction_trap = FALSE; 774 exec->instruction_trap = FALSE;
778 exec->F_dot_P = 0x4000L; 775 exec->F_dot_P = 0x4000L;
(...skipping 20 matching lines...) Expand all
799 tt_coderange_font, 796 tt_coderange_font,
800 face->font_program, 797 face->font_program,
801 face->font_program_size ); 798 face->font_program_size );
802 799
803 /* disable CVT and glyph programs coderange */ 800 /* disable CVT and glyph programs coderange */
804 TT_Clear_CodeRange( exec, tt_coderange_cvt ); 801 TT_Clear_CodeRange( exec, tt_coderange_cvt );
805 TT_Clear_CodeRange( exec, tt_coderange_glyph ); 802 TT_Clear_CodeRange( exec, tt_coderange_glyph );
806 803
807 if ( face->font_program_size > 0 ) 804 if ( face->font_program_size > 0 )
808 { 805 {
809 error = TT_Goto_CodeRange( exec, tt_coderange_font, 0 ); 806 TT_Goto_CodeRange( exec, tt_coderange_font, 0 );
810 807
811 if ( !error ) 808 FT_TRACE4(( "Executing `fpgm' table.\n" ));
812 { 809 error = face->interpreter( exec );
813 FT_TRACE4(( "Executing `fpgm' table.\n" ));
814
815 error = face->interpreter( exec );
816 }
817 } 810 }
818 else 811 else
819 error = FT_Err_Ok; 812 error = FT_Err_Ok;
820 813
814 size->bytecode_ready = error;
815
821 if ( !error ) 816 if ( !error )
822 TT_Save_Context( exec, size ); 817 TT_Save_Context( exec, size );
823 818
824 return error; 819 return error;
825 } 820 }
826 821
827 822
828 /*************************************************************************/ 823 /*************************************************************************/
829 /* */ 824 /* */
830 /* <Function> */ 825 /* <Function> */
(...skipping 21 matching lines...) Expand all
852 847
853 /* debugging instances have their own context */ 848 /* debugging instances have their own context */
854 if ( size->debug ) 849 if ( size->debug )
855 exec = size->context; 850 exec = size->context;
856 else 851 else
857 exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context; 852 exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
858 853
859 if ( !exec ) 854 if ( !exec )
860 return FT_THROW( Could_Not_Find_Context ); 855 return FT_THROW( Could_Not_Find_Context );
861 856
862 TT_Load_Context( exec, face, size ); 857 error = TT_Load_Context( exec, face, size );
858 if ( error )
859 return error;
863 860
864 exec->callTop = 0; 861 exec->callTop = 0;
865 exec->top = 0; 862 exec->top = 0;
866 863
867 exec->instruction_trap = FALSE; 864 exec->instruction_trap = FALSE;
868 865
869 exec->pedantic_hinting = pedantic; 866 exec->pedantic_hinting = pedantic;
870 867
871 TT_Set_CodeRange( exec, 868 TT_Set_CodeRange( exec,
872 tt_coderange_cvt, 869 tt_coderange_cvt,
873 face->cvt_program, 870 face->cvt_program,
874 face->cvt_program_size ); 871 face->cvt_program_size );
875 872
876 TT_Clear_CodeRange( exec, tt_coderange_glyph ); 873 TT_Clear_CodeRange( exec, tt_coderange_glyph );
877 874
878 if ( face->cvt_program_size > 0 ) 875 if ( face->cvt_program_size > 0 )
879 { 876 {
880 error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 ); 877 TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
881 878
882 if ( !error && !size->debug ) 879 if ( !size->debug )
883 { 880 {
884 FT_TRACE4(( "Executing `prep' table.\n" )); 881 FT_TRACE4(( "Executing `prep' table.\n" ));
885 882
886 error = face->interpreter( exec ); 883 error = face->interpreter( exec );
887 } 884 }
888 } 885 }
889 else 886 else
890 error = FT_Err_Ok; 887 error = FT_Err_Ok;
891 888
889 size->cvt_ready = error;
890
892 /* UNDOCUMENTED! The MS rasterizer doesn't allow the following */ 891 /* UNDOCUMENTED! The MS rasterizer doesn't allow the following */
893 /* graphics state variables to be modified by the CVT program. */ 892 /* graphics state variables to be modified by the CVT program. */
894 893
895 exec->GS.dualVector.x = 0x4000; 894 exec->GS.dualVector.x = 0x4000;
896 exec->GS.dualVector.y = 0; 895 exec->GS.dualVector.y = 0;
897 exec->GS.projVector.x = 0x4000; 896 exec->GS.projVector.x = 0x4000;
898 exec->GS.projVector.y = 0x0; 897 exec->GS.projVector.y = 0x0;
899 exec->GS.freeVector.x = 0x4000; 898 exec->GS.freeVector.x = 0x4000;
900 exec->GS.freeVector.y = 0x0; 899 exec->GS.freeVector.y = 0x0;
901 900
902 exec->GS.rp0 = 0; 901 exec->GS.rp0 = 0;
903 exec->GS.rp1 = 0; 902 exec->GS.rp1 = 0;
904 exec->GS.rp2 = 0; 903 exec->GS.rp2 = 0;
905 904
906 exec->GS.gep0 = 1; 905 exec->GS.gep0 = 1;
907 exec->GS.gep1 = 1; 906 exec->GS.gep1 = 1;
908 exec->GS.gep2 = 1; 907 exec->GS.gep2 = 1;
909 908
910 exec->GS.loop = 1; 909 exec->GS.loop = 1;
911 910
912 /* save as default graphics state */ 911 /* save as default graphics state */
913 size->GS = exec->GS; 912 size->GS = exec->GS;
914 913
915 TT_Save_Context( exec, size ); 914 TT_Save_Context( exec, size );
916 915
917 return error; 916 return error;
918 } 917 }
919 918
920 #endif /* TT_USE_BYTECODE_INTERPRETER */
921
922
923 #ifdef TT_USE_BYTECODE_INTERPRETER
924 919
925 static void 920 static void
926 tt_size_done_bytecode( FT_Size ftsize ) 921 tt_size_done_bytecode( FT_Size ftsize )
927 { 922 {
928 TT_Size size = (TT_Size)ftsize; 923 TT_Size size = (TT_Size)ftsize;
929 TT_Face face = (TT_Face)ftsize->face; 924 TT_Face face = (TT_Face)ftsize->face;
930 FT_Memory memory = face->root.memory; 925 FT_Memory memory = face->root.memory;
931 926
932 927
933 if ( size->debug ) 928 if ( size->debug )
(...skipping 17 matching lines...) Expand all
951 FT_FREE( size->instruction_defs ); 946 FT_FREE( size->instruction_defs );
952 947
953 size->num_function_defs = 0; 948 size->num_function_defs = 0;
954 size->max_function_defs = 0; 949 size->max_function_defs = 0;
955 size->num_instruction_defs = 0; 950 size->num_instruction_defs = 0;
956 size->max_instruction_defs = 0; 951 size->max_instruction_defs = 0;
957 952
958 size->max_func = 0; 953 size->max_func = 0;
959 size->max_ins = 0; 954 size->max_ins = 0;
960 955
961 size->bytecode_ready = 0; 956 size->bytecode_ready = -1;
962 size->cvt_ready = 0; 957 size->cvt_ready = -1;
963 } 958 }
964 959
965 960
966 /* Initialize bytecode-related fields in the size object. */ 961 /* Initialize bytecode-related fields in the size object. */
967 /* We do this only if bytecode interpretation is really needed. */ 962 /* We do this only if bytecode interpretation is really needed. */
968 static FT_Error 963 static FT_Error
969 tt_size_init_bytecode( FT_Size ftsize, 964 tt_size_init_bytecode( FT_Size ftsize,
970 FT_Bool pedantic ) 965 FT_Bool pedantic )
971 { 966 {
972 FT_Error error; 967 FT_Error error;
973 TT_Size size = (TT_Size)ftsize; 968 TT_Size size = (TT_Size)ftsize;
974 TT_Face face = (TT_Face)ftsize->face; 969 TT_Face face = (TT_Face)ftsize->face;
975 FT_Memory memory = face->root.memory; 970 FT_Memory memory = face->root.memory;
976 FT_Int i;
977 971
978 FT_UShort n_twilight; 972 FT_UShort n_twilight;
979 TT_MaxProfile* maxp = &face->max_profile; 973 TT_MaxProfile* maxp = &face->max_profile;
980 974
981 975
982 size->bytecode_ready = 1; 976 size->bytecode_ready = -1;
983 size->cvt_ready = 0; 977 size->cvt_ready = -1;
984 978
985 size->max_function_defs = maxp->maxFunctionDefs; 979 size->max_function_defs = maxp->maxFunctionDefs;
986 size->max_instruction_defs = maxp->maxInstructionDefs; 980 size->max_instruction_defs = maxp->maxInstructionDefs;
987 981
988 size->num_function_defs = 0; 982 size->num_function_defs = 0;
989 size->num_instruction_defs = 0; 983 size->num_instruction_defs = 0;
990 984
991 size->max_func = 0; 985 size->max_func = 0;
992 size->max_ins = 0; 986 size->max_ins = 0;
993 987
994 size->cvt_size = face->cvt_size; 988 size->cvt_size = face->cvt_size;
995 size->storage_size = maxp->maxStorage; 989 size->storage_size = maxp->maxStorage;
996 990
997 /* Set default metrics */ 991 /* Set default metrics */
998 { 992 {
999 TT_Size_Metrics* metrics = &size->ttmetrics; 993 TT_Size_Metrics* metrics = &size->ttmetrics;
1000 994
1001 995
1002 metrics->rotated = FALSE; 996 metrics->rotated = FALSE;
1003 metrics->stretched = FALSE; 997 metrics->stretched = FALSE;
1004 998
1005 /* set default compensation (all 0) */ 999 /* set default engine compensation */
1006 for ( i = 0; i < 4; i++ ) 1000 metrics->compensations[0] = 0; /* gray */
1007 metrics->compensations[i] = 0; 1001 metrics->compensations[1] = 0; /* black */
1002 metrics->compensations[2] = 0; /* white */
1003 metrics->compensations[3] = 0; /* reserved */
1008 } 1004 }
1009 1005
1010 /* allocate function defs, instruction defs, cvt, and storage area */ 1006 /* allocate function defs, instruction defs, cvt, and storage area */
1011 if ( FT_NEW_ARRAY( size->function_defs, size->max_function_defs ) || 1007 if ( FT_NEW_ARRAY( size->function_defs, size->max_function_defs ) ||
1012 FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) || 1008 FT_NEW_ARRAY( size->instruction_defs, size->max_instruction_defs ) ||
1013 FT_NEW_ARRAY( size->cvt, size->cvt_size ) || 1009 FT_NEW_ARRAY( size->cvt, size->cvt_size ) ||
1014 FT_NEW_ARRAY( size->storage, size->storage_size ) ) 1010 FT_NEW_ARRAY( size->storage, size->storage_size ) )
1015 goto Exit; 1011 goto Exit;
1016 1012
1017 /* reserve twilight zone */ 1013 /* reserve twilight zone */
(...skipping 16 matching lines...) Expand all
1034 1030
1035 1031
1036 face->interpreter = (TT_Interpreter) 1032 face->interpreter = (TT_Interpreter)
1037 library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE]; 1033 library->debug_hooks[FT_DEBUG_HOOK_TRUETYPE];
1038 if ( !face->interpreter ) 1034 if ( !face->interpreter )
1039 face->interpreter = (TT_Interpreter)TT_RunIns; 1035 face->interpreter = (TT_Interpreter)TT_RunIns;
1040 } 1036 }
1041 1037
1042 /* Fine, now run the font program! */ 1038 /* Fine, now run the font program! */
1043 error = tt_size_run_fpgm( size, pedantic ); 1039 error = tt_size_run_fpgm( size, pedantic );
1044 /* It seems fpgm proc is causing some problem for some font, so we ignor e the error. TESTDOC: Bug #12690 - Restaurantkarte_Oktober09+Wild.pdf*/
1045 if ( error )
1046 tt_size_done_bytecode( ftsize );
1047 return TT_Err_Ok;
1048 1040
1049 Exit: 1041 Exit:
1050 if ( error ) 1042 if ( error )
1051 tt_size_done_bytecode( ftsize ); 1043 tt_size_done_bytecode( ftsize );
1052 1044
1053 return error; 1045 return error;
1054 } 1046 }
1055 1047
1056 1048
1057 FT_LOCAL_DEF( FT_Error ) 1049 FT_LOCAL_DEF( FT_Error )
1058 tt_size_ready_bytecode( TT_Size size, 1050 tt_size_ready_bytecode( TT_Size size,
1059 FT_Bool pedantic ) 1051 FT_Bool pedantic )
1060 { 1052 {
1061 FT_Error error = FT_Err_Ok; 1053 FT_Error error = FT_Err_Ok;
1062 1054
1063 1055
1064 if ( !size->bytecode_ready ) 1056 if ( size->bytecode_ready < 0 )
1065 {
1066 error = tt_size_init_bytecode( (FT_Size)size, pedantic ); 1057 error = tt_size_init_bytecode( (FT_Size)size, pedantic );
1067 if ( error ) 1058
1068 goto Exit; 1059 if ( error || size->bytecode_ready )
1069 } 1060 goto Exit;
1070 1061
1071 /* rescale CVT when needed */ 1062 /* rescale CVT when needed */
1072 if ( !size->cvt_ready ) 1063 if ( size->cvt_ready < 0 )
1073 { 1064 {
1074 FT_UInt i; 1065 FT_UInt i;
1075 TT_Face face = (TT_Face)size->root.face; 1066 TT_Face face = (TT_Face)size->root.face;
1076 1067
1077 1068
1078 /* Scale the cvt values to the new ppem. */ 1069 /* Scale the cvt values to the new ppem. */
1079 /* We use by default the y ppem to scale the CVT. */ 1070 /* We use by default the y ppem to scale the CVT. */
1080 for ( i = 0; i < size->cvt_size; i++ ) 1071 for ( i = 0; i < size->cvt_size; i++ )
1081 size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale ); 1072 size->cvt[i] = FT_MulFix( face->cvt[i], size->ttmetrics.scale );
1082 1073
1083 /* all twilight points are originally zero */ 1074 /* all twilight points are originally zero */
1084 for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ ) 1075 for ( i = 0; i < (FT_UInt)size->twilight.n_points; i++ )
1085 { 1076 {
1086 size->twilight.org[i].x = 0; 1077 size->twilight.org[i].x = 0;
1087 size->twilight.org[i].y = 0; 1078 size->twilight.org[i].y = 0;
1088 size->twilight.cur[i].x = 0; 1079 size->twilight.cur[i].x = 0;
1089 size->twilight.cur[i].y = 0; 1080 size->twilight.cur[i].y = 0;
1090 } 1081 }
1091 1082
1092 /* clear storage area */ 1083 /* clear storage area */
1093 for ( i = 0; i < (FT_UInt)size->storage_size; i++ ) 1084 for ( i = 0; i < (FT_UInt)size->storage_size; i++ )
1094 size->storage[i] = 0; 1085 size->storage[i] = 0;
1095 1086
1096 size->GS = tt_default_graphics_state; 1087 size->GS = tt_default_graphics_state;
1097 1088
1098 tt_size_run_prep( size, pedantic );/* It seems prep proc is causing some p roblem for some font, so we ignore the error. TESTDOC: Bug #5025 - naredba-rd-16 -296.pdf */ 1089 error = tt_size_run_prep( size, pedantic );
1099 » /* However we can't disable the prep. TESTDOC: Bug #0063 - 050826_diff er_table.pdf, page #4 */
1100 if ( !error )
1101 size->cvt_ready = 1;
1102 } 1090 }
1103 1091
1104 Exit: 1092 Exit:
1105 return error; 1093 return error;
1106 } 1094 }
1107 1095
1108 #endif /* TT_USE_BYTECODE_INTERPRETER */ 1096 #endif /* TT_USE_BYTECODE_INTERPRETER */
1109 1097
1110 1098
1111 /*************************************************************************/ 1099 /*************************************************************************/
(...skipping 10 matching lines...) Expand all
1122 /* <Return> */ 1110 /* <Return> */
1123 /* FreeType error code. 0 means success. */ 1111 /* FreeType error code. 0 means success. */
1124 /* */ 1112 /* */
1125 FT_LOCAL_DEF( FT_Error ) 1113 FT_LOCAL_DEF( FT_Error )
1126 tt_size_init( FT_Size ttsize ) /* TT_Size */ 1114 tt_size_init( FT_Size ttsize ) /* TT_Size */
1127 { 1115 {
1128 TT_Size size = (TT_Size)ttsize; 1116 TT_Size size = (TT_Size)ttsize;
1129 FT_Error error = FT_Err_Ok; 1117 FT_Error error = FT_Err_Ok;
1130 1118
1131 #ifdef TT_USE_BYTECODE_INTERPRETER 1119 #ifdef TT_USE_BYTECODE_INTERPRETER
1132 size->bytecode_ready = 0; 1120 size->bytecode_ready = -1;
1133 size->cvt_ready = 0; 1121 size->cvt_ready = -1;
1134 #endif 1122 #endif
1135 1123
1136 size->ttmetrics.valid = FALSE; 1124 size->ttmetrics.valid = FALSE;
1137 size->strike_index = 0xFFFFFFFFUL; 1125 size->strike_index = 0xFFFFFFFFUL;
1138 1126
1139 return error; 1127 return error;
1140 } 1128 }
1141 1129
1142 1130
1143 /*************************************************************************/ 1131 /*************************************************************************/
1144 /* */ 1132 /* */
1145 /* <Function> */ 1133 /* <Function> */
1146 /* tt_size_done */ 1134 /* tt_size_done */
1147 /* */ 1135 /* */
1148 /* <Description> */ 1136 /* <Description> */
1149 /* The TrueType size object finalizer. */ 1137 /* The TrueType size object finalizer. */
1150 /* */ 1138 /* */
1151 /* <Input> */ 1139 /* <Input> */
1152 /* size :: A handle to the target size object. */ 1140 /* size :: A handle to the target size object. */
1153 /* */ 1141 /* */
1154 FT_LOCAL_DEF( void ) 1142 FT_LOCAL_DEF( void )
1155 tt_size_done( FT_Size ttsize ) /* TT_Size */ 1143 tt_size_done( FT_Size ttsize ) /* TT_Size */
1156 { 1144 {
1157 TT_Size size = (TT_Size)ttsize; 1145 TT_Size size = (TT_Size)ttsize;
1158 1146
1159 1147
1160 #ifdef TT_USE_BYTECODE_INTERPRETER 1148 #ifdef TT_USE_BYTECODE_INTERPRETER
1161 if ( size->bytecode_ready ) 1149 if ( size->bytecode_ready >= 0 )
1162 tt_size_done_bytecode( ttsize ); 1150 tt_size_done_bytecode( ttsize );
1163 #endif 1151 #endif
1164 1152
1165 size->ttmetrics.valid = FALSE; 1153 size->ttmetrics.valid = FALSE;
1166 } 1154 }
1167 1155
1168 1156
1169 /*************************************************************************/ 1157 /*************************************************************************/
1170 /* */ 1158 /* */
1171 /* <Function> */ 1159 /* <Function> */
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 else 1220 else
1233 { 1221 {
1234 size->ttmetrics.scale = metrics->y_scale; 1222 size->ttmetrics.scale = metrics->y_scale;
1235 size->ttmetrics.ppem = metrics->y_ppem; 1223 size->ttmetrics.ppem = metrics->y_ppem;
1236 size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem, 1224 size->ttmetrics.x_ratio = FT_DivFix( metrics->x_ppem,
1237 metrics->y_ppem ); 1225 metrics->y_ppem );
1238 size->ttmetrics.y_ratio = 0x10000L; 1226 size->ttmetrics.y_ratio = 0x10000L;
1239 } 1227 }
1240 1228
1241 #ifdef TT_USE_BYTECODE_INTERPRETER 1229 #ifdef TT_USE_BYTECODE_INTERPRETER
1242 size->cvt_ready = 0; 1230 size->cvt_ready = -1;
1243 #endif /* TT_USE_BYTECODE_INTERPRETER */ 1231 #endif /* TT_USE_BYTECODE_INTERPRETER */
1244 1232
1245 if ( !error ) 1233 if ( !error )
1246 size->ttmetrics.valid = TRUE; 1234 size->ttmetrics.valid = TRUE;
1247 1235
1248 return error; 1236 return error;
1249 } 1237 }
1250 1238
1251 1239
1252 /*************************************************************************/ 1240 /*************************************************************************/
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 /* FreeType error code. 0 means success. */ 1325 /* FreeType error code. 0 means success. */
1338 /* */ 1326 /* */
1339 FT_LOCAL_DEF( FT_Error ) 1327 FT_LOCAL_DEF( FT_Error )
1340 tt_slot_init( FT_GlyphSlot slot ) 1328 tt_slot_init( FT_GlyphSlot slot )
1341 { 1329 {
1342 return FT_GlyphLoader_CreateExtra( slot->internal->loader ); 1330 return FT_GlyphLoader_CreateExtra( slot->internal->loader );
1343 } 1331 }
1344 1332
1345 1333
1346 /* END */ 1334 /* END */
OLDNEW
« no previous file with comments | « third_party/freetype/src/truetype/ttobjs.h ('k') | third_party/freetype/src/truetype/ttpic.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698