📄 t1decode.c
字号:
FT_GlyphLoader_Add( builder->loader ); /* return now! */ FT_TRACE4(( "\n\n" )); return FT_Err_Ok; case op_hsbw: FT_TRACE4(( " hsbw" )); builder->left_bearing.x += top[0]; builder->advance.x = top[1]; builder->advance.y = 0; builder->last.x = x = top[0]; builder->last.y = y = 0; /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) return FT_Err_Ok; break; case op_seac: /* return immediately after the processing */ return t1operator_seac( decoder, top[0], top[1], top[2], top[3], top[4] ); case op_sbw: FT_TRACE4(( " sbw" )); builder->left_bearing.x += top[0]; builder->left_bearing.y += top[1]; builder->advance.x = top[2]; builder->advance.y = top[3]; builder->last.x = x = top[0]; builder->last.y = y = top[1]; /* the `metrics_only' indicates that we only want to compute */ /* the glyph's metrics (lsb + advance width), not load the */ /* rest of it; so exit immediately */ if ( builder->metrics_only ) return FT_Err_Ok; break; case op_closepath: FT_TRACE4(( " closepath" )); close_contour( builder ); builder->path_begun = 0; break; case op_hlineto: FT_TRACE4(( " hlineto" )); if ( start_point( builder, x, y ) ) goto Memory_Error; x += top[0]; goto Add_Line; case op_hmoveto: FT_TRACE4(( " hmoveto" )); x += top[0]; if ( !decoder->flex_state ) builder->path_begun = 0; break; case op_hvcurveto: FT_TRACE4(( " hvcurveto" )); if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) goto Memory_Error; x += top[0]; add_point( builder, x, y, 0 ); x += top[1]; y += top[2]; add_point( builder, x, y, 0 ); y += top[3]; add_point( builder, x, y, 1 ); break; case op_rlineto: FT_TRACE4(( " rlineto" )); if ( start_point( builder, x, y ) ) goto Memory_Error; x += top[0]; y += top[1]; Add_Line: if ( add_point1( builder, x, y ) ) goto Memory_Error; break; case op_rmoveto: FT_TRACE4(( " rmoveto" )); x += top[0]; y += top[1]; if ( !decoder->flex_state ) builder->path_begun = 0; break; case op_rrcurveto: FT_TRACE4(( " rcurveto" )); if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) goto Memory_Error; x += top[0]; y += top[1]; add_point( builder, x, y, 0 ); x += top[2]; y += top[3]; add_point( builder, x, y, 0 ); x += top[4]; y += top[5]; add_point( builder, x, y, 1 ); break; case op_vhcurveto: FT_TRACE4(( " vhcurveto" )); if ( start_point( builder, x, y ) || check_points( builder, 3 ) ) goto Memory_Error; y += top[0]; add_point( builder, x, y, 0 ); x += top[1]; y += top[2]; add_point( builder, x, y, 0 ); x += top[3]; add_point( builder, x, y, 1 ); break; case op_vlineto: FT_TRACE4(( " vlineto" )); if ( start_point( builder, x, y ) ) goto Memory_Error; y += top[0]; goto Add_Line; case op_vmoveto: FT_TRACE4(( " vmoveto" )); y += top[0]; if ( !decoder->flex_state ) builder->path_begun = 0; break; case op_div: FT_TRACE4(( " div" )); if ( top[1] ) { *top = top[0] / top[1]; ++top; } else { FT_ERROR(( "T1_Parse_CharStrings: division by 0\n" )); goto Syntax_Error; } break; case op_callsubr: { FT_Int index; FT_TRACE4(( " callsubr" )); index = top[0]; if ( index < 0 || index >= (FT_Int)decoder->num_subrs ) { FT_ERROR(( "T1_Parse_CharStrings: invalid subrs index\n" )); goto Syntax_Error; } if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS ) { FT_ERROR(( "T1_Parse_CharStrings: too many nested subrs\n" )); goto Syntax_Error; } zone->cursor = ip; /* save current instruction pointer */ zone++; zone->base = decoder->subrs[index] + decoder->lenIV; if (decoder->subrs_len) zone->limit = zone->base + decoder->subrs_len[index]; else zone->limit = decoder->subrs[index+1]; zone->cursor = zone->base; if ( !zone->base ) { FT_ERROR(( "T1_Parse_CharStrings: invoking empty subrs!\n" )); goto Syntax_Error; } decoder->zone = zone; ip = zone->base; limit = zone->limit; break; } case op_pop: FT_TRACE4(( " pop" )); /* theoretically, the arguments are already on the stack */ top++; break; case op_return: FT_TRACE4(( " return" )); if ( zone <= decoder->zones ) { FT_ERROR(( "T1_Parse_CharStrings: unexpected return\n" )); goto Syntax_Error; } zone--; ip = zone->cursor; limit = zone->limit; decoder->zone = zone; break; case op_dotsection: FT_TRACE4(( " dotsection" )); break; case op_hstem: FT_TRACE4(( " hstem" )); break; case op_hstem3: FT_TRACE4(( " hstem3" )); break; case op_vstem: FT_TRACE4(( " vstem" )); break; case op_vstem3: FT_TRACE4(( " vstem3" )); break; case op_setcurrentpoint: FT_TRACE4(( " setcurrentpoint" )); FT_ERROR(( "T1_Parse_CharStrings:" )); FT_ERROR(( " unexpected `setcurrentpoint'\n" )); goto Syntax_Error; default: FT_ERROR(( "T1_Parse_CharStrings: unhandled opcode %d\n", op )); goto Syntax_Error; } decoder->top = top; } /* general operator processing */ } /* while ip < limit */ FT_TRACE4(( "..end..\n\n" )); return error; Syntax_Error: return T1_Err_Syntax_Error; Stack_Underflow: return T1_Err_Stack_Underflow; Memory_Error: return builder->error; } FT_LOCAL_DEF FT_Error T1_Decoder_Parse_Glyph( T1_Decoder* decoder, FT_UInt glyph ) { return decoder->parse_callback( decoder, glyph ); } FT_LOCAL_DEF FT_Error T1_Decoder_Init( T1_Decoder* decoder, FT_Face face, FT_Size size, FT_GlyphSlot slot, FT_Byte** glyph_names, T1_Blend* blend, T1_Decoder_Callback parse_callback ) { MEM_Set( decoder, 0, sizeof ( *decoder ) ); /* retrieve PSNames interface from list of current modules */ { PSNames_Interface* psnames = 0; psnames = (PSNames_Interface*)FT_Get_Module_Interface( FT_FACE_LIBRARY(face), "psnames" ); if ( !psnames ) { FT_ERROR(( "T1_Decoder_Init: " )); FT_ERROR(( "the `psnames' module is not available\n" )); return FT_Err_Unimplemented_Feature; } decoder->psnames = psnames; } T1_Builder_Init( &decoder->builder, face, size, slot ); decoder->num_glyphs = face->num_glyphs; decoder->glyph_names = glyph_names; decoder->blend = blend; decoder->parse_callback = parse_callback; decoder->funcs = t1_decoder_funcs; return 0; } FT_LOCAL_DEF void T1_Decoder_Done( T1_Decoder* decoder ) { T1_Builder_Done( &decoder->builder ); }/* END */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -