OLD | NEW |
1 /***************************************************************************/ | 1 /***************************************************************************/ |
2 /* */ | 2 /* */ |
3 /* t1decode.c */ | 3 /* t1decode.c */ |
4 /* */ | 4 /* */ |
5 /* PostScript Type 1 decoding routines (body). */ | 5 /* PostScript Type 1 decoding routines (body). */ |
6 /* */ | 6 /* */ |
7 /* Copyright 2000-2011 by */ | 7 /* Copyright 2000-2011 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, */ |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 FT_Error error; | 192 FT_Error error; |
193 FT_Int bchar_index, achar_index; | 193 FT_Int bchar_index, achar_index; |
194 #if 0 | 194 #if 0 |
195 FT_Int n_base_points; | 195 FT_Int n_base_points; |
196 FT_Outline* base = decoder->builder.base; | 196 FT_Outline* base = decoder->builder.base; |
197 #endif | 197 #endif |
198 FT_Vector left_bearing, advance; | 198 FT_Vector left_bearing, advance; |
199 | 199 |
200 #ifdef FT_CONFIG_OPTION_INCREMENTAL | 200 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
201 T1_Face face = (T1_Face)decoder->builder.face; | 201 T1_Face face = (T1_Face)decoder->builder.face; |
202 #endif | 202 #endif |
203 | 203 |
204 | 204 |
205 if ( decoder->seac ) | 205 if ( decoder->seac ) |
206 { | 206 { |
207 FT_ERROR(( "t1operator_seac: invalid nested seac\n" )); | 207 FT_ERROR(( "t1operator_seac: invalid nested seac\n" )); |
208 return PSaux_Err_Syntax_Error; | 208 return PSaux_Err_Syntax_Error; |
209 } | 209 } |
210 | 210 |
211 /* seac weirdness */ | 211 /* seac weirdness */ |
212 adx += decoder->builder.left_bearing.x; | 212 adx += decoder->builder.left_bearing.x; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 hinter = (T1_Hints_Funcs)builder->hints_funcs; | 393 hinter = (T1_Hints_Funcs)builder->hints_funcs; |
394 | 394 |
395 /* a font that reads BuildCharArray without setting */ | 395 /* a font that reads BuildCharArray without setting */ |
396 /* its values first is buggy, but ... */ | 396 /* its values first is buggy, but ... */ |
397 FT_ASSERT( ( decoder->len_buildchar == 0 ) == | 397 FT_ASSERT( ( decoder->len_buildchar == 0 ) == |
398 ( decoder->buildchar == NULL ) ); | 398 ( decoder->buildchar == NULL ) ); |
399 | 399 |
400 if ( decoder->buildchar && decoder->len_buildchar > 0 ) | 400 if ( decoder->buildchar && decoder->len_buildchar > 0 ) |
401 ft_memset( &decoder->buildchar[0], | 401 ft_memset( &decoder->buildchar[0], |
402 0, | 402 0, |
403 sizeof( decoder->buildchar[0] ) * decoder->len_buildchar ); | 403 sizeof ( decoder->buildchar[0] ) * decoder->len_buildchar ); |
404 | 404 |
405 FT_TRACE4(( "\n" | 405 FT_TRACE4(( "\n" |
406 "Start charstring\n" )); | 406 "Start charstring\n" )); |
407 | 407 |
408 zone->base = charstring_base; | 408 zone->base = charstring_base; |
409 limit = zone->limit = charstring_base + charstring_len; | 409 limit = zone->limit = charstring_base + charstring_len; |
410 ip = zone->cursor = zone->base; | 410 ip = zone->cursor = zone->base; |
411 | 411 |
412 error = PSaux_Err_Ok; | 412 error = PSaux_Err_Ok; |
413 | 413 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 break; | 757 break; |
758 | 758 |
759 case 2: /* add flex vectors */ | 759 case 2: /* add flex vectors */ |
760 { | 760 { |
761 FT_Int idx; | 761 FT_Int idx; |
762 | 762 |
763 | 763 |
764 if ( arg_cnt != 0 ) | 764 if ( arg_cnt != 0 ) |
765 goto Unexpected_OtherSubr; | 765 goto Unexpected_OtherSubr; |
766 | 766 |
| 767 if ( decoder->flex_state == 0 ) |
| 768 { |
| 769 FT_ERROR(( "t1_decoder_parse_charstrings:" |
| 770 " missing flex start\n" )); |
| 771 goto Syntax_Error; |
| 772 } |
| 773 |
767 /* note that we should not add a point for index 0; */ | 774 /* note that we should not add a point for index 0; */ |
768 /* this will move our current position to the flex */ | 775 /* this will move our current position to the flex */ |
769 /* point without adding any point to the outline */ | 776 /* point without adding any point to the outline */ |
770 idx = decoder->num_flex_vectors++; | 777 idx = decoder->num_flex_vectors++; |
771 if ( idx > 0 && idx < 7 ) | 778 if ( idx > 0 && idx < 7 ) |
772 t1_builder_add_point( builder, | 779 t1_builder_add_point( builder, |
773 x, | 780 x, |
774 y, | 781 y, |
775 (FT_Byte)( idx == 3 || idx == 6 ) ); | 782 (FT_Byte)( idx == 3 || idx == 6 ) ); |
776 } | 783 } |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 | 873 |
867 idx = Fix2Int( top[0] ); | 874 idx = Fix2Int( top[0] ); |
868 | 875 |
869 if ( idx < 0 || | 876 if ( idx < 0 || |
870 idx + blend->num_designs > decoder->len_buildchar ) | 877 idx + blend->num_designs > decoder->len_buildchar ) |
871 goto Unexpected_OtherSubr; | 878 goto Unexpected_OtherSubr; |
872 | 879 |
873 ft_memcpy( &decoder->buildchar[idx], | 880 ft_memcpy( &decoder->buildchar[idx], |
874 blend->weight_vector, | 881 blend->weight_vector, |
875 blend->num_designs * | 882 blend->num_designs * |
876 sizeof( blend->weight_vector[0] ) ); | 883 sizeof ( blend->weight_vector[0] ) ); |
877 } | 884 } |
878 break; | 885 break; |
879 | 886 |
880 case 20: | 887 case 20: |
881 /* <arg1> <arg2> 2 20 callothersubr pop */ | 888 /* <arg1> <arg2> 2 20 callothersubr pop */ |
882 /* ==> push <arg1> + <arg2> onto T1 stack */ | 889 /* ==> push <arg1> + <arg2> onto T1 stack */ |
883 if ( arg_cnt != 2 ) | 890 if ( arg_cnt != 2 ) |
884 goto Unexpected_OtherSubr; | 891 goto Unexpected_OtherSubr; |
885 | 892 |
886 top[0] += top[1]; /* XXX (over|under)flow */ | 893 top[0] += top[1]; /* XXX (over|under)flow */ |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 #ifdef FT_DEBUG_LEVEL_TRACE | 1106 #ifdef FT_DEBUG_LEVEL_TRACE |
1100 | 1107 |
1101 if ( decoder->len_buildchar > 0 ) | 1108 if ( decoder->len_buildchar > 0 ) |
1102 { | 1109 { |
1103 FT_UInt i; | 1110 FT_UInt i; |
1104 | 1111 |
1105 | 1112 |
1106 FT_TRACE4(( "BuildCharArray = [ " )); | 1113 FT_TRACE4(( "BuildCharArray = [ " )); |
1107 | 1114 |
1108 for ( i = 0; i < decoder->len_buildchar; ++i ) | 1115 for ( i = 0; i < decoder->len_buildchar; ++i ) |
1109 FT_TRACE4(( "%d ", decoder->buildchar[ i ] )); | 1116 FT_TRACE4(( "%d ", decoder->buildchar[i] )); |
1110 | 1117 |
1111 FT_TRACE4(( "]\n" )); | 1118 FT_TRACE4(( "]\n" )); |
1112 } | 1119 } |
1113 | 1120 |
1114 #endif /* FT_DEBUG_LEVEL_TRACE */ | 1121 #endif /* FT_DEBUG_LEVEL_TRACE */ |
1115 | 1122 |
1116 FT_TRACE4(( "\n" )); | 1123 FT_TRACE4(( "\n" )); |
1117 | 1124 |
1118 /* return now! */ | 1125 /* return now! */ |
1119 return PSaux_Err_Ok; | 1126 return PSaux_Err_Ok; |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1598 | 1605 |
1599 /* finalize T1 decoder */ | 1606 /* finalize T1 decoder */ |
1600 FT_LOCAL_DEF( void ) | 1607 FT_LOCAL_DEF( void ) |
1601 t1_decoder_done( T1_Decoder decoder ) | 1608 t1_decoder_done( T1_Decoder decoder ) |
1602 { | 1609 { |
1603 t1_builder_done( &decoder->builder ); | 1610 t1_builder_done( &decoder->builder ); |
1604 } | 1611 } |
1605 | 1612 |
1606 | 1613 |
1607 /* END */ | 1614 /* END */ |
OLD | NEW |