20 #include FT_INTERNAL_CALC_H 21 #include FT_INTERNAL_DEBUG_H 22 #include FT_INTERNAL_POSTSCRIPT_HINTS_H 31 #define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) ) 40 #define FT_COMPONENT trace_t1decode 130 t1_lookup_glyph_by_stdcharcode(
T1_Decoder decoder,
135 FT_Service_PsCMaps psnames = decoder->
psnames;
139 if ( charcode < 0 || charcode > 255 )
142 glyph_name = psnames->adobe_std_strings(
143 psnames->adobe_std_encoding[charcode]);
151 name[0] == glyph_name[0] &&
193 FT_Int bchar_index, achar_index;
200 #ifdef FT_CONFIG_OPTION_INCREMENTAL 207 FT_ERROR((
"t1operator_seac: invalid nested seac\n" ));
213 FT_ERROR((
"t1operator_seac: unexpected seac\n" ));
222 #ifdef FT_CONFIG_OPTION_INCREMENTAL 230 " glyph names table not available in this font\n" ));
234 #ifdef FT_CONFIG_OPTION_INCREMENTAL 244 bchar_index = t1_lookup_glyph_by_stdcharcode( decoder, bchar );
245 achar_index = t1_lookup_glyph_by_stdcharcode( decoder, achar );
248 if ( bchar_index < 0 || achar_index < 0 )
251 " invalid seac character code arguments\n" ));
269 subg = loader->current.subglyphs;
272 subg->index = bchar_index;
280 subg->index = achar_index;
287 glyph->
subglyphs = loader->base.subglyphs;
288 glyph->
format = FT_GLYPH_FORMAT_COMPOSITE;
290 loader->current.num_subglyphs = 2;
371 FT_Int known_othersubr_result_cnt = 0;
372 FT_Int unknown_othersubr_result_cnt = 0;
378 #ifdef FT_DEBUG_LEVEL_TRACE 388 seed = ( seed ^ ( seed >> 10 ) ^ ( seed >> 20 ) ) & 0xFFFFL;
395 zone = decoder->
zones;
412 "Start charstring\n" ));
414 zone->
base = charstring_base;
415 limit = zone->
limit = charstring_base + charstring_len;
420 x = orig_x = builder->
pos_x;
421 y = orig_y = builder->
pos_y;
437 FT_ASSERT( known_othersubr_result_cnt == 0 ||
438 unknown_othersubr_result_cnt == 0 );
440 #ifdef FT_DEBUG_LEVEL_TRACE 517 FT_ERROR((
"t1_decoder_parse_charstrings:" 518 " invalid escape (12+EOF)\n" ));
553 FT_ERROR((
"t1_decoder_parse_charstrings:" 554 " invalid escape (12+%d)\n",
561 if ( ip + 4 >
limit )
563 FT_ERROR((
"t1_decoder_parse_charstrings:" 564 " unexpected EOF in integer\n" ));
581 if ( value > 32000 || value < -32000 )
585 FT_ERROR((
"t1_decoder_parse_charstrings:" 586 " no `div' after large integer\n" ));
608 FT_ERROR((
"t1_decoder_parse_charstrings:" 609 " unexpected EOF in integer\n" ));
614 value = ( ( ip[-2] - 247 ) * 256 ) + ip[-1] + 108;
616 value = -( ( ( ip[-2] - 251 ) * 256 ) + ip[-1] + 108 );
624 FT_ERROR((
"t1_decoder_parse_charstrings:" 625 " invalid byte (%d)\n", ip[-1] ));
630 if ( unknown_othersubr_result_cnt > 0 )
642 unknown_othersubr_result_cnt = 0;
649 FT_ERROR((
"t1_decoder_parse_charstrings:" 650 " no `div' after large integer\n" ));
664 FT_ERROR((
"t1_decoder_parse_charstrings: stack overflow\n" ));
668 #ifdef FT_DEBUG_LEVEL_TRACE 684 #ifdef FT_DEBUG_LEVEL_TRACE 689 if ( top - decoder->
stack < 2 )
690 goto Stack_Underflow;
708 if ( arg_cnt > top - decoder->
stack )
709 goto Stack_Underflow;
713 known_othersubr_result_cnt = 0;
714 unknown_othersubr_result_cnt = 0;
736 goto Unexpected_OtherSubr;
741 FT_ERROR((
"t1_decoder_parse_charstrings:" 742 " unexpected flex end\n" ));
749 known_othersubr_result_cnt = 2;
754 goto Unexpected_OtherSubr;
771 goto Unexpected_OtherSubr;
775 FT_ERROR((
"t1_decoder_parse_charstrings:" 776 " missing flex start\n" ));
784 if ( idx > 0 && idx < 7 )
788 (
FT_Byte)( idx == 3 || idx == 6 ) );
794 goto Unexpected_OtherSubr;
796 known_othersubr_result_cnt = 1;
805 top = decoder->
stack;
822 FT_ERROR((
"t1_decoder_parse_charstrings:" 823 " unexpected multiple masters operator\n" ));
827 num_points = (
FT_UInt)subr_no - 13 + ( subr_no == 18 );
830 FT_ERROR((
"t1_decoder_parse_charstrings:" 831 " incorrect number of multiple masters arguments\n" ));
851 delta = top + num_points;
853 for ( nn = 0; nn < num_points; nn++ )
864 known_othersubr_result_cnt = num_points;
877 if ( arg_cnt != 1 || blend ==
NULL )
878 goto Unexpected_OtherSubr;
884 goto Unexpected_OtherSubr;
897 goto Unexpected_OtherSubr;
901 known_othersubr_result_cnt = 1;
908 goto Unexpected_OtherSubr;
912 known_othersubr_result_cnt = 1;
919 goto Unexpected_OtherSubr;
923 known_othersubr_result_cnt = 1;
929 if ( arg_cnt != 2 || top[1] == 0 )
930 goto Unexpected_OtherSubr;
934 known_othersubr_result_cnt = 1;
945 if ( arg_cnt != 2 || blend ==
NULL )
946 goto Unexpected_OtherSubr;
951 goto Unexpected_OtherSubr;
966 if ( arg_cnt != 1 || blend ==
NULL )
967 goto Unexpected_OtherSubr;
972 goto Unexpected_OtherSubr;
977 known_othersubr_result_cnt = 1;
994 goto Unexpected_OtherSubr;
996 if ( top[2] > top[3] )
999 known_othersubr_result_cnt = 1;
1006 goto Unexpected_OtherSubr;
1013 if ( Rand >= 0x8000L )
1018 seed =
FT_MulFix( seed, 0x10000L - seed );
1023 known_othersubr_result_cnt = 1;
1027 if ( arg_cnt >= 0 && subr_no >= 0 )
1029 FT_ERROR((
"t1_decoder_parse_charstrings:" 1030 " unknown othersubr [%d %d], wish me luck\n",
1031 arg_cnt, subr_no ));
1032 unknown_othersubr_result_cnt = arg_cnt;
1037 Unexpected_OtherSubr:
1038 FT_ERROR((
"t1_decoder_parse_charstrings:" 1039 " invalid othersubr [%d %d]\n", arg_cnt, subr_no ));
1043 top += known_othersubr_result_cnt;
1049 FT_Int num_args = t1_args_count[op];
1054 if ( top - decoder->
stack < num_args )
1055 goto Stack_Underflow;
1063 #ifdef FT_DEBUG_LEVEL_TRACE 1075 if ( top - decoder->
stack != num_args )
1076 FT_TRACE0((
"t1_decoder_parse_charstrings:" 1077 " too much operands on the stack" 1078 " (seen %d, expected %d)\n",
1079 top - decoder->
stack, num_args ));
1112 #ifdef FT_DEBUG_LEVEL_TRACE 1143 orig_x =
x = builder->
pos_x + top[0];
1144 orig_y =
y = builder->
pos_y;
1157 return t1operator_seac( decoder,
1174 x = builder->
pos_x + top[0];
1175 y = builder->
pos_y + top[1];
1349 FT_ERROR((
"t1_decoder_parse_charstrings:" 1350 " invalid subrs index\n" ));
1356 FT_ERROR((
"t1_decoder_parse_charstrings:" 1357 " too many nested subrs\n" ));
1384 FT_ERROR((
"t1_decoder_parse_charstrings:" 1385 " invoking empty subrs\n" ));
1389 decoder->
zone = zone;
1398 if ( known_othersubr_result_cnt > 0 )
1400 known_othersubr_result_cnt--;
1405 if ( unknown_othersubr_result_cnt == 0 )
1407 FT_ERROR((
"t1_decoder_parse_charstrings:" 1408 " no more operands for othersubr\n" ));
1412 unknown_othersubr_result_cnt--;
1419 if ( zone <= decoder->zones )
1421 FT_ERROR((
"t1_decoder_parse_charstrings:" 1422 " unexpected return\n" ));
1429 decoder->
zone = zone;
1502 FT_ERROR((
"t1_decoder_parse_charstrings:" 1503 " unexpected `setcurrentpoint'\n" ));
1521 FT_ERROR((
"t1_decoder_parse_charstrings:" 1522 " unhandled opcode %d\n", op ));
1533 #ifdef FT_DEBUG_LEVEL_TRACE 1551 return FT_THROW( Stack_Underflow );
1580 FT_Service_PsCMaps psnames = 0;
1587 " the `psnames' module is not available\n" ));
1588 return FT_THROW( Unimplemented_Feature );
1603 decoder->
blend = blend;
cannot open resource broken file module version is too low unimplemented feature broken offset within table missing module invalid glyph index unsupported glyph image format invalid outline too many hints invalid object handle invalid module handle invalid size handle invalid charmap handle invalid stream handle too many extensions unlisted object invalid stream seek invalid stream read invalid frame operation invalid frame read raster corrupted negative height while rastering invalid opcode stack overflow bad argument invalid reference found ENDF opcode in execution stream invalid code range too many function definitions SFNT font table missing name table missing horizontal PostScript(post) table missing" ) FT_ERRORDEF_( Invalid_Horiz_Metrics
typedefFT_BEGIN_HEADER struct PSH_GlobalsRec_ * PSH_Globals
FT_DivFix(FT_Long a, FT_Long b)
struct T1_FaceRec_ * T1_Face
FT_BEGIN_HEADER typedef signed long FT_Pos
t1_builder_done(T1_Builder builder)
t1_builder_add_point1(T1_Builder builder, FT_Pos x, FT_Pos y)
#define FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES
#define FT_MEM_ZERO(dest, count)
#define FT_SUBGLYPH_FLAG_USE_MY_METRICS
GLint GLint GLint GLint GLint GLint y
enum FT_Render_Mode_ FT_Render_Mode
t1_builder_start_point(T1_Builder builder, FT_Pos x, FT_Pos y)
return FT_THROW(Missing_Property)
FT_Error(* T1_Decoder_Callback)(T1_Decoder decoder, FT_UInt glyph_index)
GLint GLint GLint GLint GLint x
#define FT_FACE_FIND_GLOBAL_SERVICE(face, ptr, id)
T1_Decoder_Callback parse_callback
enum T1_Operator_ T1_Operator
FT_BEGIN_HEADER typedef unsigned char FT_Bool
FT_Face_Internal internal
GLenum GLuint GLint GLenum face
t1_decoder_init(T1_Decoder decoder, FT_Face face, FT_Size size, FT_GlyphSlot slot, FT_Byte **glyph_names, PS_Blend blend, FT_Bool hinting, FT_Render_Mode hint_mode, T1_Decoder_Callback parse_callback)
typedefFT_BEGIN_HEADER struct FT_GlyphLoaderRec_ * FT_GlyphLoader
#define FT_ERROR(varformat)
#define FT_ASSERT(condition)
#define FT_TRACE4(varformat)
#define T1_MAX_SUBRS_CALLS
FT_GlyphLoader_Add(FT_GlyphLoader loader)
#define T1_MAX_CHARSTRINGS_OPERANDS
FT_CALLBACK_TABLE_DEF const T1_Decoder_FuncsRec t1_decoder_funcs
T1_Hints_SetStemFunc stem
FT_GlyphLoader_CheckSubGlyphs(FT_GlyphLoader loader, FT_UInt n_subs)
T1_ParseState parse_state
t1_decoder_parse_charstrings(T1_Decoder decoder, FT_Byte *charstring_base, FT_UInt charstring_len)
T1_Decoder_FuncsRec funcs
FT_Service_PsCMaps psnames
t1_builder_close_contour(T1_Builder builder)
GLsizei const GLfloat * value
GLboolean GLenum GLenum GLvoid * values
int jpeg_marker_parser_method routine
GLuint const GLchar * name
FT_MulFix(FT_Long a, FT_Long b)
if(!abbox) return FT_THROW(Invalid_Argument)
t1_decoder_parse_glyph(T1_Decoder decoder, FT_UInt glyph)
GLdouble GLdouble GLdouble GLdouble top
struct FT_GlyphSlotRec_ * FT_GlyphSlot
FT_Slot_Internal internal
#define FT_TRACE5(varformat)
t1_builder_add_point(T1_Builder builder, FT_Pos x, FT_Pos y, FT_Byte flag)
FT_GlyphLoader_Prepare(FT_GlyphLoader loader)
t1_builder_init(T1_Builder builder, FT_Face face, FT_Size size, FT_GlyphSlot glyph, FT_Bool hinting)
FT_TRACE0(("cff_property_set: missing property `%s'\, property_name))
T1_Hints_SetStem3Func stem3
t1_decoder_done(T1_Decoder decoder)
t1_builder_check_points(T1_Builder builder, FT_Int count)
const struct T1_Hints_FuncsRec_ * T1_Hints_Funcs
T1_Decoder_ZoneRec zones[T1_MAX_SUBRS_CALLS+1]
FT_Long stack[T1_MAX_CHARSTRINGS_OPERANDS]