| 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-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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 FT_THROW( Syntax_Error ); |
| 209 } |
| 210 |
| 211 if ( decoder->builder.metrics_only ) |
| 212 { |
| 213 FT_ERROR(( "t1operator_seac: unexpected seac\n" )); |
| 214 return FT_THROW( Syntax_Error ); |
| 209 } | 215 } |
| 210 | 216 |
| 211 /* seac weirdness */ | 217 /* seac weirdness */ |
| 212 adx += decoder->builder.left_bearing.x; | 218 adx += decoder->builder.left_bearing.x; |
| 213 | 219 |
| 214 /* `glyph_names' is set to 0 for CID fonts which do not */ | 220 /* `glyph_names' is set to 0 for CID fonts which do not */ |
| 215 /* include an encoding. How can we deal with these? */ | 221 /* include an encoding. How can we deal with these? */ |
| 216 #ifdef FT_CONFIG_OPTION_INCREMENTAL | 222 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
| 217 if ( decoder->glyph_names == 0 && | 223 if ( decoder->glyph_names == 0 && |
| 218 !face->root.internal->incremental_interface ) | 224 !face->root.internal->incremental_interface ) |
| 219 #else | 225 #else |
| 220 if ( decoder->glyph_names == 0 ) | 226 if ( decoder->glyph_names == 0 ) |
| 221 #endif /* FT_CONFIG_OPTION_INCREMENTAL */ | 227 #endif /* FT_CONFIG_OPTION_INCREMENTAL */ |
| 222 { | 228 { |
| 223 FT_ERROR(( "t1operator_seac:" | 229 FT_ERROR(( "t1operator_seac:" |
| 224 " glyph names table not available in this font\n" )); | 230 " glyph names table not available in this font\n" )); |
| 225 return PSaux_Err_Syntax_Error; | 231 return FT_THROW( Syntax_Error ); |
| 226 } | 232 } |
| 227 | 233 |
| 228 #ifdef FT_CONFIG_OPTION_INCREMENTAL | 234 #ifdef FT_CONFIG_OPTION_INCREMENTAL |
| 229 if ( face->root.internal->incremental_interface ) | 235 if ( face->root.internal->incremental_interface ) |
| 230 { | 236 { |
| 231 /* the caller must handle the font encoding also */ | 237 /* the caller must handle the font encoding also */ |
| 232 bchar_index = bchar; | 238 bchar_index = bchar; |
| 233 achar_index = achar; | 239 achar_index = achar; |
| 234 } | 240 } |
| 235 else | 241 else |
| 236 #endif | 242 #endif |
| 237 { | 243 { |
| 238 bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar ); | 244 bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar ); |
| 239 achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar ); | 245 achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar ); |
| 240 } | 246 } |
| 241 | 247 |
| 242 if ( bchar_index < 0 || achar_index < 0 ) | 248 if ( bchar_index < 0 || achar_index < 0 ) |
| 243 { | 249 { |
| 244 FT_ERROR(( "t1operator_seac:" | 250 FT_ERROR(( "t1operator_seac:" |
| 245 " invalid seac character code arguments\n" )); | 251 " invalid seac character code arguments\n" )); |
| 246 return PSaux_Err_Syntax_Error; | 252 return FT_THROW( Syntax_Error ); |
| 247 } | 253 } |
| 248 | 254 |
| 249 /* if we are trying to load a composite glyph, do not load the */ | 255 /* if we are trying to load a composite glyph, do not load the */ |
| 250 /* accent character and return the array of subglyphs. */ | 256 /* accent character and return the array of subglyphs. */ |
| 251 if ( decoder->builder.no_recurse ) | 257 if ( decoder->builder.no_recurse ) |
| 252 { | 258 { |
| 253 FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; | 259 FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph; |
| 254 FT_GlyphLoader loader = glyph->internal->loader; | 260 FT_GlyphLoader loader = glyph->internal->loader; |
| 255 FT_SubGlyph subg; | 261 FT_SubGlyph subg; |
| 256 | 262 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 0, | 408 0, |
| 403 sizeof ( decoder->buildchar[0] ) * decoder->len_buildchar ); | 409 sizeof ( decoder->buildchar[0] ) * decoder->len_buildchar ); |
| 404 | 410 |
| 405 FT_TRACE4(( "\n" | 411 FT_TRACE4(( "\n" |
| 406 "Start charstring\n" )); | 412 "Start charstring\n" )); |
| 407 | 413 |
| 408 zone->base = charstring_base; | 414 zone->base = charstring_base; |
| 409 limit = zone->limit = charstring_base + charstring_len; | 415 limit = zone->limit = charstring_base + charstring_len; |
| 410 ip = zone->cursor = zone->base; | 416 ip = zone->cursor = zone->base; |
| 411 | 417 |
| 412 error = PSaux_Err_Ok; | 418 error = FT_Err_Ok; |
| 413 | 419 |
| 414 x = orig_x = builder->pos_x; | 420 x = orig_x = builder->pos_x; |
| 415 y = orig_y = builder->pos_y; | 421 y = orig_y = builder->pos_y; |
| 416 | 422 |
| 417 /* begin hints recording session, if any */ | 423 /* begin hints recording session, if any */ |
| 418 if ( hinter ) | 424 if ( hinter ) |
| 419 hinter->open( hinter->hints ); | 425 hinter->open( hinter->hints ); |
| 420 | 426 |
| 421 large_int = FALSE; | 427 large_int = FALSE; |
| 422 | 428 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 break; | 558 break; |
| 553 | 559 |
| 554 case 255: /* four bytes integer */ | 560 case 255: /* four bytes integer */ |
| 555 if ( ip + 4 > limit ) | 561 if ( ip + 4 > limit ) |
| 556 { | 562 { |
| 557 FT_ERROR(( "t1_decoder_parse_charstrings:" | 563 FT_ERROR(( "t1_decoder_parse_charstrings:" |
| 558 " unexpected EOF in integer\n" )); | 564 " unexpected EOF in integer\n" )); |
| 559 goto Syntax_Error; | 565 goto Syntax_Error; |
| 560 } | 566 } |
| 561 | 567 |
| 562 value = (FT_Int32)( ( (FT_Long)ip[0] << 24 ) | | 568 value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | |
| 563 ( (FT_Long)ip[1] << 16 ) | | 569 ( (FT_UInt32)ip[1] << 16 ) | |
| 564 ( (FT_Long)ip[2] << 8 ) | | 570 ( (FT_UInt32)ip[2] << 8 ) | |
| 565 ip[3] ); | 571 (FT_UInt32)ip[3] ); |
| 566 ip += 4; | 572 ip += 4; |
| 567 | 573 |
| 568 /* According to the specification, values > 32000 or < -32000 must */ | 574 /* According to the specification, values > 32000 or < -32000 must */ |
| 569 /* be followed by a `div' operator to make the result be in the */ | 575 /* be followed by a `div' operator to make the result be in the */ |
| 570 /* range [-32000;32000]. We expect that the second argument of */ | 576 /* range [-32000;32000]. We expect that the second argument of */ |
| 571 /* `div' is not a large number. Additionally, we don't handle */ | 577 /* `div' is not a large number. Additionally, we don't handle */ |
| 572 /* stuff like `<large1> <large2> <num> div <num> div' or */ | 578 /* stuff like `<large1> <large2> <num> div <num> div' or */ |
| 573 /* <large1> <large2> <num> div div'. This is probably not allowed */ | 579 /* <large1> <large2> <num> div div'. This is probably not allowed */ |
| 574 /* anyway. */ | 580 /* anyway. */ |
| 575 if ( value > 32000 || value < -32000 ) | 581 if ( value > 32000 || value < -32000 ) |
| 576 { | 582 { |
| 577 if ( large_int ) | 583 if ( large_int ) |
| 578 { | 584 { |
| 579 FT_ERROR(( "t1_decoder_parse_charstrings:" | 585 FT_ERROR(( "t1_decoder_parse_charstrings:" |
| 580 " no `div' after large integer\n" )); | 586 " no `div' after large integer\n" )); |
| 581 } | 587 } |
| 582 else | 588 else |
| 583 large_int = TRUE; | 589 large_int = TRUE; |
| 584 } | 590 } |
| 585 else | 591 else |
| 586 { | 592 { |
| 587 if ( !large_int ) | 593 if ( !large_int ) |
| 588 value <<= 16; | 594 value = (FT_Int32)( (FT_UInt32)value << 16 ); |
| 589 } | 595 } |
| 590 | 596 |
| 591 break; | 597 break; |
| 592 | 598 |
| 593 default: | 599 default: |
| 594 if ( ip[-1] >= 32 ) | 600 if ( ip[-1] >= 32 ) |
| 595 { | 601 { |
| 596 if ( ip[-1] < 247 ) | 602 if ( ip[-1] < 247 ) |
| 597 value = (FT_Int32)ip[-1] - 139; | 603 value = (FT_Int32)ip[-1] - 139; |
| 598 else | 604 else |
| 599 { | 605 { |
| 600 if ( ++ip > limit ) | 606 if ( ++ip > limit ) |
| 601 { | 607 { |
| 602 FT_ERROR(( "t1_decoder_parse_charstrings:" | 608 FT_ERROR(( "t1_decoder_parse_charstrings:" |
| 603 " unexpected EOF in integer\n" )); | 609 " unexpected EOF in integer\n" )); |
| 604 goto Syntax_Error; | 610 goto Syntax_Error; |
| 605 } | 611 } |
| 606 | 612 |
| 607 if ( ip[-2] < 251 ) | 613 if ( ip[-2] < 251 ) |
| 608 value = ( ( (FT_Int32)ip[-2] - 247 ) << 8 ) + ip[-1] + 108; | 614 value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108; |
| 609 else | 615 else |
| 610 value = -( ( ( (FT_Int32)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 ); | 616 value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 ); |
| 611 } | 617 } |
| 612 | 618 |
| 613 if ( !large_int ) | 619 if ( !large_int ) |
| 614 value <<= 16; | 620 value = (FT_Int32)( (FT_UInt32)value << 16 ); |
| 615 } | 621 } |
| 616 else | 622 else |
| 617 { | 623 { |
| 618 FT_ERROR(( "t1_decoder_parse_charstrings:" | 624 FT_ERROR(( "t1_decoder_parse_charstrings:" |
| 619 " invalid byte (%d)\n", ip[-1] )); | 625 " invalid byte (%d)\n", ip[-1] )); |
| 620 goto Syntax_Error; | 626 goto Syntax_Error; |
| 621 } | 627 } |
| 622 } | 628 } |
| 623 | 629 |
| 624 if ( unknown_othersubr_result_cnt > 0 ) | 630 if ( unknown_othersubr_result_cnt > 0 ) |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 known_othersubr_result_cnt = 2; | 749 known_othersubr_result_cnt = 2; |
| 744 break; | 750 break; |
| 745 | 751 |
| 746 case 1: /* start flex feature */ | 752 case 1: /* start flex feature */ |
| 747 if ( arg_cnt != 0 ) | 753 if ( arg_cnt != 0 ) |
| 748 goto Unexpected_OtherSubr; | 754 goto Unexpected_OtherSubr; |
| 749 | 755 |
| 750 decoder->flex_state = 1; | 756 decoder->flex_state = 1; |
| 751 decoder->num_flex_vectors = 0; | 757 decoder->num_flex_vectors = 0; |
| 752 if ( ( error = t1_builder_start_point( builder, x, y ) ) | 758 if ( ( error = t1_builder_start_point( builder, x, y ) ) |
| 753 != PSaux_Err_Ok || | 759 != FT_Err_Ok || |
| 754 ( error = t1_builder_check_points( builder, 6 ) ) | 760 ( error = t1_builder_check_points( builder, 6 ) ) |
| 755 != PSaux_Err_Ok ) | 761 != FT_Err_Ok ) |
| 756 goto Fail; | 762 goto Fail; |
| 757 break; | 763 break; |
| 758 | 764 |
| 759 case 2: /* add flex vectors */ | 765 case 2: /* add flex vectors */ |
| 760 { | 766 { |
| 761 FT_Int idx; | 767 FT_Int idx; |
| 762 | 768 |
| 763 | 769 |
| 764 if ( arg_cnt != 0 ) | 770 if ( arg_cnt != 0 ) |
| 765 goto Unexpected_OtherSubr; | 771 goto Unexpected_OtherSubr; |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1116 FT_TRACE4(( "%d ", decoder->buildchar[i] )); | 1122 FT_TRACE4(( "%d ", decoder->buildchar[i] )); |
| 1117 | 1123 |
| 1118 FT_TRACE4(( "]\n" )); | 1124 FT_TRACE4(( "]\n" )); |
| 1119 } | 1125 } |
| 1120 | 1126 |
| 1121 #endif /* FT_DEBUG_LEVEL_TRACE */ | 1127 #endif /* FT_DEBUG_LEVEL_TRACE */ |
| 1122 | 1128 |
| 1123 FT_TRACE4(( "\n" )); | 1129 FT_TRACE4(( "\n" )); |
| 1124 | 1130 |
| 1125 /* return now! */ | 1131 /* return now! */ |
| 1126 return PSaux_Err_Ok; | 1132 return FT_Err_Ok; |
| 1127 | 1133 |
| 1128 case op_hsbw: | 1134 case op_hsbw: |
| 1129 FT_TRACE4(( " hsbw" )); | 1135 FT_TRACE4(( " hsbw" )); |
| 1130 | 1136 |
| 1131 builder->parse_state = T1_Parse_Have_Width; | 1137 builder->parse_state = T1_Parse_Have_Width; |
| 1132 | 1138 |
| 1133 builder->left_bearing.x += top[0]; | 1139 builder->left_bearing.x += top[0]; |
| 1134 builder->advance.x = top[1]; | 1140 builder->advance.x = top[1]; |
| 1135 builder->advance.y = 0; | 1141 builder->advance.y = 0; |
| 1136 | 1142 |
| 1137 orig_x = x = builder->pos_x + top[0]; | 1143 orig_x = x = builder->pos_x + top[0]; |
| 1138 orig_y = y = builder->pos_y; | 1144 orig_y = y = builder->pos_y; |
| 1139 | 1145 |
| 1140 FT_UNUSED( orig_y ); | 1146 FT_UNUSED( orig_y ); |
| 1141 | 1147 |
| 1142 /* the `metrics_only' indicates that we only want to compute */ | 1148 /* the `metrics_only' indicates that we only want to compute */ |
| 1143 /* the glyph's metrics (lsb + advance width), not load the */ | 1149 /* the glyph's metrics (lsb + advance width), not load the */ |
| 1144 /* rest of it; so exit immediately */ | 1150 /* rest of it; so exit immediately */ |
| 1145 if ( builder->metrics_only ) | 1151 if ( builder->metrics_only ) |
| 1146 return PSaux_Err_Ok; | 1152 return FT_Err_Ok; |
| 1147 | 1153 |
| 1148 break; | 1154 break; |
| 1149 | 1155 |
| 1150 case op_seac: | 1156 case op_seac: |
| 1151 return t1operator_seac( decoder, | 1157 return t1operator_seac( decoder, |
| 1152 top[0], | 1158 top[0], |
| 1153 top[1], | 1159 top[1], |
| 1154 top[2], | 1160 top[2], |
| 1155 Fix2Int( top[3] ), | 1161 Fix2Int( top[3] ), |
| 1156 Fix2Int( top[4] ) ); | 1162 Fix2Int( top[4] ) ); |
| 1157 | 1163 |
| 1158 case op_sbw: | 1164 case op_sbw: |
| 1159 FT_TRACE4(( " sbw" )); | 1165 FT_TRACE4(( " sbw" )); |
| 1160 | 1166 |
| 1161 builder->parse_state = T1_Parse_Have_Width; | 1167 builder->parse_state = T1_Parse_Have_Width; |
| 1162 | 1168 |
| 1163 builder->left_bearing.x += top[0]; | 1169 builder->left_bearing.x += top[0]; |
| 1164 builder->left_bearing.y += top[1]; | 1170 builder->left_bearing.y += top[1]; |
| 1165 builder->advance.x = top[2]; | 1171 builder->advance.x = top[2]; |
| 1166 builder->advance.y = top[3]; | 1172 builder->advance.y = top[3]; |
| 1167 | 1173 |
| 1168 x = builder->pos_x + top[0]; | 1174 x = builder->pos_x + top[0]; |
| 1169 y = builder->pos_y + top[1]; | 1175 y = builder->pos_y + top[1]; |
| 1170 | 1176 |
| 1171 /* the `metrics_only' indicates that we only want to compute */ | 1177 /* the `metrics_only' indicates that we only want to compute */ |
| 1172 /* the glyph's metrics (lsb + advance width), not load the */ | 1178 /* the glyph's metrics (lsb + advance width), not load the */ |
| 1173 /* rest of it; so exit immediately */ | 1179 /* rest of it; so exit immediately */ |
| 1174 if ( builder->metrics_only ) | 1180 if ( builder->metrics_only ) |
| 1175 return PSaux_Err_Ok; | 1181 return FT_Err_Ok; |
| 1176 | 1182 |
| 1177 break; | 1183 break; |
| 1178 | 1184 |
| 1179 case op_closepath: | 1185 case op_closepath: |
| 1180 FT_TRACE4(( " closepath" )); | 1186 FT_TRACE4(( " closepath" )); |
| 1181 | 1187 |
| 1182 /* if there is no path, `closepath' is a no-op */ | 1188 /* if there is no path, `closepath' is a no-op */ |
| 1183 if ( builder->parse_state == T1_Parse_Have_Path || | 1189 if ( builder->parse_state == T1_Parse_Have_Path || |
| 1184 builder->parse_state == T1_Parse_Have_Moveto ) | 1190 builder->parse_state == T1_Parse_Have_Moveto ) |
| 1185 t1_builder_close_contour( builder ); | 1191 t1_builder_close_contour( builder ); |
| 1186 | 1192 |
| 1187 builder->parse_state = T1_Parse_Have_Width; | 1193 builder->parse_state = T1_Parse_Have_Width; |
| 1188 break; | 1194 break; |
| 1189 | 1195 |
| 1190 case op_hlineto: | 1196 case op_hlineto: |
| 1191 FT_TRACE4(( " hlineto" )); | 1197 FT_TRACE4(( " hlineto" )); |
| 1192 | 1198 |
| 1193 if ( ( error = t1_builder_start_point( builder, x, y ) ) | 1199 if ( ( error = t1_builder_start_point( builder, x, y ) ) |
| 1194 != PSaux_Err_Ok ) | 1200 != FT_Err_Ok ) |
| 1195 goto Fail; | 1201 goto Fail; |
| 1196 | 1202 |
| 1197 x += top[0]; | 1203 x += top[0]; |
| 1198 goto Add_Line; | 1204 goto Add_Line; |
| 1199 | 1205 |
| 1200 case op_hmoveto: | 1206 case op_hmoveto: |
| 1201 FT_TRACE4(( " hmoveto" )); | 1207 FT_TRACE4(( " hmoveto" )); |
| 1202 | 1208 |
| 1203 x += top[0]; | 1209 x += top[0]; |
| 1204 if ( !decoder->flex_state ) | 1210 if ( !decoder->flex_state ) |
| 1205 { | 1211 { |
| 1206 if ( builder->parse_state == T1_Parse_Start ) | 1212 if ( builder->parse_state == T1_Parse_Start ) |
| 1207 goto Syntax_Error; | 1213 goto Syntax_Error; |
| 1208 builder->parse_state = T1_Parse_Have_Moveto; | 1214 builder->parse_state = T1_Parse_Have_Moveto; |
| 1209 } | 1215 } |
| 1210 break; | 1216 break; |
| 1211 | 1217 |
| 1212 case op_hvcurveto: | 1218 case op_hvcurveto: |
| 1213 FT_TRACE4(( " hvcurveto" )); | 1219 FT_TRACE4(( " hvcurveto" )); |
| 1214 | 1220 |
| 1215 if ( ( error = t1_builder_start_point( builder, x, y ) ) | 1221 if ( ( error = t1_builder_start_point( builder, x, y ) ) |
| 1216 != PSaux_Err_Ok || | 1222 != FT_Err_Ok || |
| 1217 ( error = t1_builder_check_points( builder, 3 ) ) | 1223 ( error = t1_builder_check_points( builder, 3 ) ) |
| 1218 != PSaux_Err_Ok ) | 1224 != FT_Err_Ok ) |
| 1219 goto Fail; | 1225 goto Fail; |
| 1220 | 1226 |
| 1221 x += top[0]; | 1227 x += top[0]; |
| 1222 t1_builder_add_point( builder, x, y, 0 ); | 1228 t1_builder_add_point( builder, x, y, 0 ); |
| 1223 x += top[1]; | 1229 x += top[1]; |
| 1224 y += top[2]; | 1230 y += top[2]; |
| 1225 t1_builder_add_point( builder, x, y, 0 ); | 1231 t1_builder_add_point( builder, x, y, 0 ); |
| 1226 y += top[3]; | 1232 y += top[3]; |
| 1227 t1_builder_add_point( builder, x, y, 1 ); | 1233 t1_builder_add_point( builder, x, y, 1 ); |
| 1228 break; | 1234 break; |
| 1229 | 1235 |
| 1230 case op_rlineto: | 1236 case op_rlineto: |
| 1231 FT_TRACE4(( " rlineto" )); | 1237 FT_TRACE4(( " rlineto" )); |
| 1232 | 1238 |
| 1233 if ( ( error = t1_builder_start_point( builder, x, y ) ) | 1239 if ( ( error = t1_builder_start_point( builder, x, y ) ) |
| 1234 != PSaux_Err_Ok ) | 1240 != FT_Err_Ok ) |
| 1235 goto Fail; | 1241 goto Fail; |
| 1236 | 1242 |
| 1237 x += top[0]; | 1243 x += top[0]; |
| 1238 y += top[1]; | 1244 y += top[1]; |
| 1239 | 1245 |
| 1240 Add_Line: | 1246 Add_Line: |
| 1241 if ( ( error = t1_builder_add_point1( builder, x, y ) ) | 1247 if ( ( error = t1_builder_add_point1( builder, x, y ) ) |
| 1242 != PSaux_Err_Ok ) | 1248 != FT_Err_Ok ) |
| 1243 goto Fail; | 1249 goto Fail; |
| 1244 break; | 1250 break; |
| 1245 | 1251 |
| 1246 case op_rmoveto: | 1252 case op_rmoveto: |
| 1247 FT_TRACE4(( " rmoveto" )); | 1253 FT_TRACE4(( " rmoveto" )); |
| 1248 | 1254 |
| 1249 x += top[0]; | 1255 x += top[0]; |
| 1250 y += top[1]; | 1256 y += top[1]; |
| 1251 if ( !decoder->flex_state ) | 1257 if ( !decoder->flex_state ) |
| 1252 { | 1258 { |
| 1253 if ( builder->parse_state == T1_Parse_Start ) | 1259 if ( builder->parse_state == T1_Parse_Start ) |
| 1254 goto Syntax_Error; | 1260 goto Syntax_Error; |
| 1255 builder->parse_state = T1_Parse_Have_Moveto; | 1261 builder->parse_state = T1_Parse_Have_Moveto; |
| 1256 } | 1262 } |
| 1257 break; | 1263 break; |
| 1258 | 1264 |
| 1259 case op_rrcurveto: | 1265 case op_rrcurveto: |
| 1260 FT_TRACE4(( " rrcurveto" )); | 1266 FT_TRACE4(( " rrcurveto" )); |
| 1261 | 1267 |
| 1262 if ( ( error = t1_builder_start_point( builder, x, y ) ) | 1268 if ( ( error = t1_builder_start_point( builder, x, y ) ) |
| 1263 != PSaux_Err_Ok || | 1269 != FT_Err_Ok || |
| 1264 ( error = t1_builder_check_points( builder, 3 ) ) | 1270 ( error = t1_builder_check_points( builder, 3 ) ) |
| 1265 != PSaux_Err_Ok ) | 1271 != FT_Err_Ok ) |
| 1266 goto Fail; | 1272 goto Fail; |
| 1267 | 1273 |
| 1268 x += top[0]; | 1274 x += top[0]; |
| 1269 y += top[1]; | 1275 y += top[1]; |
| 1270 t1_builder_add_point( builder, x, y, 0 ); | 1276 t1_builder_add_point( builder, x, y, 0 ); |
| 1271 | 1277 |
| 1272 x += top[2]; | 1278 x += top[2]; |
| 1273 y += top[3]; | 1279 y += top[3]; |
| 1274 t1_builder_add_point( builder, x, y, 0 ); | 1280 t1_builder_add_point( builder, x, y, 0 ); |
| 1275 | 1281 |
| 1276 x += top[4]; | 1282 x += top[4]; |
| 1277 y += top[5]; | 1283 y += top[5]; |
| 1278 t1_builder_add_point( builder, x, y, 1 ); | 1284 t1_builder_add_point( builder, x, y, 1 ); |
| 1279 break; | 1285 break; |
| 1280 | 1286 |
| 1281 case op_vhcurveto: | 1287 case op_vhcurveto: |
| 1282 FT_TRACE4(( " vhcurveto" )); | 1288 FT_TRACE4(( " vhcurveto" )); |
| 1283 | 1289 |
| 1284 if ( ( error = t1_builder_start_point( builder, x, y ) ) | 1290 if ( ( error = t1_builder_start_point( builder, x, y ) ) |
| 1285 != PSaux_Err_Ok || | 1291 != FT_Err_Ok || |
| 1286 ( error = t1_builder_check_points( builder, 3 ) ) | 1292 ( error = t1_builder_check_points( builder, 3 ) ) |
| 1287 != PSaux_Err_Ok ) | 1293 != FT_Err_Ok ) |
| 1288 goto Fail; | 1294 goto Fail; |
| 1289 | 1295 |
| 1290 y += top[0]; | 1296 y += top[0]; |
| 1291 t1_builder_add_point( builder, x, y, 0 ); | 1297 t1_builder_add_point( builder, x, y, 0 ); |
| 1292 x += top[1]; | 1298 x += top[1]; |
| 1293 y += top[2]; | 1299 y += top[2]; |
| 1294 t1_builder_add_point( builder, x, y, 0 ); | 1300 t1_builder_add_point( builder, x, y, 0 ); |
| 1295 x += top[3]; | 1301 x += top[3]; |
| 1296 t1_builder_add_point( builder, x, y, 1 ); | 1302 t1_builder_add_point( builder, x, y, 1 ); |
| 1297 break; | 1303 break; |
| 1298 | 1304 |
| 1299 case op_vlineto: | 1305 case op_vlineto: |
| 1300 FT_TRACE4(( " vlineto" )); | 1306 FT_TRACE4(( " vlineto" )); |
| 1301 | 1307 |
| 1302 if ( ( error = t1_builder_start_point( builder, x, y ) ) | 1308 if ( ( error = t1_builder_start_point( builder, x, y ) ) |
| 1303 != PSaux_Err_Ok ) | 1309 != FT_Err_Ok ) |
| 1304 goto Fail; | 1310 goto Fail; |
| 1305 | 1311 |
| 1306 y += top[0]; | 1312 y += top[0]; |
| 1307 goto Add_Line; | 1313 goto Add_Line; |
| 1308 | 1314 |
| 1309 case op_vmoveto: | 1315 case op_vmoveto: |
| 1310 FT_TRACE4(( " vmoveto" )); | 1316 FT_TRACE4(( " vmoveto" )); |
| 1311 | 1317 |
| 1312 y += top[0]; | 1318 y += top[0]; |
| 1313 if ( !decoder->flex_state ) | 1319 if ( !decoder->flex_state ) |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1532 } /* general operator processing */ | 1538 } /* general operator processing */ |
| 1533 | 1539 |
| 1534 } /* while ip < limit */ | 1540 } /* while ip < limit */ |
| 1535 | 1541 |
| 1536 FT_TRACE4(( "..end..\n\n" )); | 1542 FT_TRACE4(( "..end..\n\n" )); |
| 1537 | 1543 |
| 1538 Fail: | 1544 Fail: |
| 1539 return error; | 1545 return error; |
| 1540 | 1546 |
| 1541 Syntax_Error: | 1547 Syntax_Error: |
| 1542 return PSaux_Err_Syntax_Error; | 1548 return FT_THROW( Syntax_Error ); |
| 1543 | 1549 |
| 1544 Stack_Underflow: | 1550 Stack_Underflow: |
| 1545 return PSaux_Err_Stack_Underflow; | 1551 return FT_THROW( Stack_Underflow ); |
| 1546 } | 1552 } |
| 1547 | 1553 |
| 1548 | 1554 |
| 1549 /* parse a single Type 1 glyph */ | 1555 /* parse a single Type 1 glyph */ |
| 1550 FT_LOCAL_DEF( FT_Error ) | 1556 FT_LOCAL_DEF( FT_Error ) |
| 1551 t1_decoder_parse_glyph( T1_Decoder decoder, | 1557 t1_decoder_parse_glyph( T1_Decoder decoder, |
| 1552 FT_UInt glyph ) | 1558 FT_UInt glyph ) |
| 1553 { | 1559 { |
| 1554 return decoder->parse_callback( decoder, glyph ); | 1560 return decoder->parse_callback( decoder, glyph ); |
| 1555 } | 1561 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1572 /* retrieve PSNames interface from list of current modules */ | 1578 /* retrieve PSNames interface from list of current modules */ |
| 1573 { | 1579 { |
| 1574 FT_Service_PsCMaps psnames = 0; | 1580 FT_Service_PsCMaps psnames = 0; |
| 1575 | 1581 |
| 1576 | 1582 |
| 1577 FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); | 1583 FT_FACE_FIND_GLOBAL_SERVICE( face, psnames, POSTSCRIPT_CMAPS ); |
| 1578 if ( !psnames ) | 1584 if ( !psnames ) |
| 1579 { | 1585 { |
| 1580 FT_ERROR(( "t1_decoder_init:" | 1586 FT_ERROR(( "t1_decoder_init:" |
| 1581 " the `psnames' module is not available\n" )); | 1587 " the `psnames' module is not available\n" )); |
| 1582 return PSaux_Err_Unimplemented_Feature; | 1588 return FT_THROW( Unimplemented_Feature ); |
| 1583 } | 1589 } |
| 1584 | 1590 |
| 1585 decoder->psnames = psnames; | 1591 decoder->psnames = psnames; |
| 1586 } | 1592 } |
| 1587 | 1593 |
| 1588 t1_builder_init( &decoder->builder, face, size, slot, hinting ); | 1594 t1_builder_init( &decoder->builder, face, size, slot, hinting ); |
| 1589 | 1595 |
| 1590 /* decoder->buildchar and decoder->len_buildchar have to be */ | 1596 /* decoder->buildchar and decoder->len_buildchar have to be */ |
| 1591 /* initialized by the caller since we cannot know the length */ | 1597 /* initialized by the caller since we cannot know the length */ |
| 1592 /* of the BuildCharArray */ | 1598 /* of the BuildCharArray */ |
| 1593 | 1599 |
| 1594 decoder->num_glyphs = (FT_UInt)face->num_glyphs; | 1600 decoder->num_glyphs = (FT_UInt)face->num_glyphs; |
| 1595 decoder->glyph_names = glyph_names; | 1601 decoder->glyph_names = glyph_names; |
| 1596 decoder->hint_mode = hint_mode; | 1602 decoder->hint_mode = hint_mode; |
| 1597 decoder->blend = blend; | 1603 decoder->blend = blend; |
| 1598 decoder->parse_callback = parse_callback; | 1604 decoder->parse_callback = parse_callback; |
| 1599 | 1605 |
| 1600 decoder->funcs = t1_decoder_funcs; | 1606 decoder->funcs = t1_decoder_funcs; |
| 1601 | 1607 |
| 1602 return PSaux_Err_Ok; | 1608 return FT_Err_Ok; |
| 1603 } | 1609 } |
| 1604 | 1610 |
| 1605 | 1611 |
| 1606 /* finalize T1 decoder */ | 1612 /* finalize T1 decoder */ |
| 1607 FT_LOCAL_DEF( void ) | 1613 FT_LOCAL_DEF( void ) |
| 1608 t1_decoder_done( T1_Decoder decoder ) | 1614 t1_decoder_done( T1_Decoder decoder ) |
| 1609 { | 1615 { |
| 1610 t1_builder_done( &decoder->builder ); | 1616 t1_builder_done( &decoder->builder ); |
| 1611 } | 1617 } |
| 1612 | 1618 |
| 1613 | 1619 |
| 1614 /* END */ | 1620 /* END */ |
| OLD | NEW |