这篇教程C++ FT_TRACE4函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中FT_TRACE4函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_TRACE4函数的具体用法?C++ FT_TRACE4怎么用?C++ FT_TRACE4使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了FT_TRACE4函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: pcf_read_TOC//.........这里部分代码省略......... tables[i] = tables[i + 1]; tables[i + 1] = tmp; have_change = 1; } if ( ( tables[i].size > tables[i + 1].offset ) || ( tables[i].offset > tables[i + 1].offset - tables[i].size ) ) { error = FT_THROW( Invalid_Offset ); goto Exit; } } if ( !have_change ) break; } /* * We now check whether the `size' and `offset' values are reasonable: * `offset' + `size' must not exceed the stream size. * * Note, however, that X11's `pcfWriteFont' routine (used by the * `bdftopcf' program to create PDF font files) has two special * features. * * - It always assigns the accelerator table a size of 100 bytes in the * TOC, regardless of its real size, which can vary between 34 and 72 * bytes. * * - Due to the way the routine is designed, it ships out the last font * table with its real size, ignoring the TOC's size value. Since * the TOC size values are always rounded up to a multiple of 4, the * difference can be up to three bytes for all tables except the * accelerator table, for which the difference can be as large as 66 * bytes. * */ tables = face->toc.tables; size = stream->size; for ( n = 0; n < toc->count - 1; n++ ) { /* we need two checks to avoid overflow */ if ( ( tables->size > size ) || ( tables->offset > size - tables->size ) ) { error = FT_THROW( Invalid_Table ); goto Exit; } tables++; } /* only check `tables->offset' for last table element ... */ if ( ( tables->offset > size ) ) { error = FT_THROW( Invalid_Table ); goto Exit; } /* ... and adjust `tables->size' to the real value if necessary */ if ( tables->size > size - tables->offset ) tables->size = size - tables->offset;#ifdef FT_DEBUG_LEVEL_TRACE { FT_UInt i, j; const char* name = "?"; FT_TRACE4(( "pcf_read_TOC:/n" )); FT_TRACE4(( " number of tables: %ld/n", face->toc.count )); tables = face->toc.tables; for ( i = 0; i < toc->count; i++ ) { for ( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] ); j++ ) if ( tables[i].type == (FT_UInt)( 1 << j ) ) name = tableNames[j]; FT_TRACE4(( " %d: type=%s, format=0x%X, " "size=%ld (0x%lX), offset=%ld (0x%lX)/n", i, name, tables[i].format, tables[i].size, tables[i].size, tables[i].offset, tables[i].offset )); } }#endif return FT_Err_Ok; Exit: FT_FREE( face->toc.tables ); return error; }
开发者ID:structuresound,项目名称:freetype,代码行数:101,
示例2: T1_Decoder_Parse_Charstrings//.........这里部分代码省略......... { FT_ERROR(( "T1_Decoder_Parse_Charstrings: " )); FT_ERROR(( "unexpected EOF in integer/n" )); goto Syntax_Error; } if ( ip[-2] < 251 ) value = ( ( (FT_Long)ip[-2] - 247 ) << 8 ) + ip[-1] + 108; else value = -( ( ( (FT_Long)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 ); } } else { FT_ERROR(( "T1_Decoder_Parse_Charstrings: " "invalid byte (%d)/n", ip[-1] )); goto Syntax_Error; } } /*********************************************************************/ /* */ /* Push value on stack, or process operator */ /* */ /* */ if ( op == op_none ) { if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS ) { FT_ERROR(( "T1_Decoder_Parse_Charstrings: stack overflow!/n" )); goto Syntax_Error; } FT_TRACE4(( " %ld", value )); *top++ = value; decoder->top = top; } else if ( op == op_callothersubr ) /* callothersubr */ { FT_TRACE4(( " callothersubr" )); if ( top - decoder->stack < 2 ) goto Stack_Underflow; top -= 2; switch ( top[1] ) { case 1: /* start flex feature */ if ( top[0] != 0 ) goto Unexpected_OtherSubr; decoder->flex_state = 1; decoder->num_flex_vectors = 0; if ( start_point( builder, x, y ) || check_points( builder, 6 ) ) goto Memory_Error; break; case 2: /* add flex vectors */ { FT_Int idx; if ( top[0] != 0 ) goto Unexpected_OtherSubr;
开发者ID:Claruarius,项目名称:stblinux-2.6.37,代码行数:67,
示例3: pcf_get_properties static FT_Error pcf_get_properties( FT_Stream stream, PCF_Face face ) { PCF_ParseProperty props = 0; PCF_Property properties = 0; FT_Int nprops, i; FT_ULong format, size; FT_Error error; FT_Memory memory = FT_FACE(face)->memory; FT_ULong string_size; FT_String* strings = 0; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_PROPERTIES, &format, &size ); if ( error ) goto Bail; if ( FT_READ_ULONG_LE( format ) ) goto Bail; FT_TRACE4(( "get_prop: format = %ld/n", format )); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) goto Bail; if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( nprops ); else (void)FT_READ_ULONG_LE( nprops ); if ( error ) goto Bail; FT_TRACE4(( "get_prop: nprop = %d/n", nprops )); if ( FT_NEW_ARRAY( props, nprops ) ) goto Bail; for ( i = 0; i < nprops; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) { if ( FT_STREAM_READ_FIELDS( pcf_property_msb_header, props + i ) ) goto Bail; } else { if ( FT_STREAM_READ_FIELDS( pcf_property_header, props + i ) ) goto Bail; } } /* pad the property array */ /* */ /* clever here - nprops is the same as the number of odd-units read, */ /* as only isStringProp are odd length (Keith Packard) */ /* */ if ( nprops & 3 ) { i = 4 - ( nprops & 3 ); FT_Stream_Skip( stream, i ); } if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( string_size ); else (void)FT_READ_ULONG_LE( string_size ); if ( error ) goto Bail; FT_TRACE4(( "get_prop: string_size = %ld/n", string_size )); if ( FT_NEW_ARRAY( strings, string_size ) ) goto Bail; error = FT_Stream_Read( stream, (FT_Byte*)strings, string_size ); if ( error ) goto Bail; if ( FT_NEW_ARRAY( properties, nprops ) ) goto Bail; for ( i = 0; i < nprops; i++ ) { /* XXX: make atom */ if ( FT_NEW_ARRAY( properties[i].name, ft_strlen( strings + props[i].name ) + 1 ) ) goto Bail; ft_strcpy( properties[i].name,strings + props[i].name ); properties[i].isString = props[i].isString; if ( props[i].isString ) { if ( FT_NEW_ARRAY( properties[i].value.atom,//.........这里部分代码省略.........
开发者ID:stefanhendriks,项目名称:dune2themaker,代码行数:101,
示例4: cff_subfont_load static FT_Error cff_subfont_load( CFF_SubFont font, CFF_Index idx, FT_UInt font_index, FT_Stream stream, FT_ULong base_offset, FT_Library library ) { FT_Error error; CFF_ParserRec parser; FT_Byte* dict = NULL; FT_ULong dict_len; CFF_FontRecDict top = &font->font_dict; CFF_Private priv = &font->private_dict; cff_parser_init( &parser, CFF_CODE_TOPDICT, &font->font_dict, library ); /* set defaults */ FT_MEM_ZERO( top, sizeof ( *top ) ); top->underline_position = -( 100L << 16 ); top->underline_thickness = 50L << 16; top->charstring_type = 2; top->font_matrix.xx = 0x10000L; top->font_matrix.yy = 0x10000L; top->cid_count = 8720; /* we use the implementation specific SID value 0xFFFF to indicate */ /* missing entries */ top->version = 0xFFFFU; top->notice = 0xFFFFU; top->copyright = 0xFFFFU; top->full_name = 0xFFFFU; top->family_name = 0xFFFFU; top->weight = 0xFFFFU; top->embedded_postscript = 0xFFFFU; top->cid_registry = 0xFFFFU; top->cid_ordering = 0xFFFFU; top->cid_font_name = 0xFFFFU; error = cff_index_access_element( idx, font_index, &dict, &dict_len ); if ( !error ) { FT_TRACE4(( " top dictionary:/n" )); error = cff_parser_run( &parser, dict, dict + dict_len ); } cff_index_forget_element( idx, &dict ); if ( error ) goto Exit; /* if it is a CID font, we stop there */ if ( top->cid_registry != 0xFFFFU ) goto Exit; /* parse the private dictionary, if any */ if ( top->private_offset && top->private_size ) { /* set defaults */ FT_MEM_ZERO( priv, sizeof ( *priv ) ); priv->blue_shift = 7; priv->blue_fuzz = 1; priv->lenIV = -1; priv->expansion_factor = (FT_Fixed)( 0.06 * 0x10000L ); priv->blue_scale = (FT_Fixed)( 0.039625 * 0x10000L * 1000 ); cff_parser_init( &parser, CFF_CODE_PRIVATE, priv, library ); if ( FT_STREAM_SEEK( base_offset + font->font_dict.private_offset ) || FT_FRAME_ENTER( font->font_dict.private_size ) ) goto Exit; FT_TRACE4(( " private dictionary:/n" )); error = cff_parser_run( &parser, (FT_Byte*)stream->cursor, (FT_Byte*)stream->limit ); FT_FRAME_EXIT(); if ( error ) goto Exit; /* ensure that `num_blue_values' is even */ priv->num_blue_values &= ~1; } /* read the local subrs, if any */ if ( priv->local_subrs_offset ) { if ( FT_STREAM_SEEK( base_offset + top->private_offset + priv->local_subrs_offset ) ) goto Exit; error = cff_index_init( &font->local_subrs_index, stream, 1 ); if ( error ) goto Exit; error = cff_index_get_pointers( &font->local_subrs_index,//.........这里部分代码省略.........
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:101,
示例5: cid_load_glyph cid_load_glyph( T1_Decoder decoder, FT_UInt glyph_index ) { CID_Face face = (CID_Face)decoder->builder.face; CID_FaceInfo cid = &face->cid; FT_Byte* p; FT_UInt fd_select; FT_Stream stream = face->cid_stream; FT_Error error = CID_Err_Ok; FT_Byte* charstring = 0; FT_Memory memory = face->root.memory; FT_ULong glyph_length = 0; PSAux_Service psaux = (PSAux_Service)face->psaux;#ifdef FT_CONFIG_OPTION_INCREMENTAL FT_Incremental_InterfaceRec *inc = face->root.internal->incremental_interface;#endif FT_TRACE4(( "cid_load_glyph: glyph index %d/n", glyph_index ));#ifdef FT_CONFIG_OPTION_INCREMENTAL /* For incremental fonts get the character data using */ /* the callback function. */ if ( inc ) { FT_Data glyph_data; error = inc->funcs->get_glyph_data( inc->object, glyph_index, &glyph_data ); if ( error ) goto Exit; p = (FT_Byte*)glyph_data.pointer; fd_select = (FT_UInt)cid_get_offset( &p, (FT_Byte)cid->fd_bytes ); if ( glyph_data.length != 0 ) { glyph_length = glyph_data.length - cid->fd_bytes; (void)FT_ALLOC( charstring, glyph_length ); if ( !error ) ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes, glyph_length ); } inc->funcs->free_glyph_data( inc->object, &glyph_data ); if ( error ) goto Exit; } else#endif /* FT_CONFIG_OPTION_INCREMENTAL */ /* For ordinary fonts read the CID font dictionary index */ /* and charstring offset from the CIDMap. */ { FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes; FT_ULong off1; if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset + glyph_index * entry_len ) || FT_FRAME_ENTER( 2 * entry_len ) ) goto Exit; p = (FT_Byte*)stream->cursor; fd_select = (FT_UInt) cid_get_offset( &p, (FT_Byte)cid->fd_bytes ); off1 = (FT_ULong)cid_get_offset( &p, (FT_Byte)cid->gd_bytes ); p += cid->fd_bytes; glyph_length = cid_get_offset( &p, (FT_Byte)cid->gd_bytes ) - off1; FT_FRAME_EXIT(); if ( fd_select >= (FT_UInt)cid->num_dicts ) { error = CID_Err_Invalid_Offset; goto Exit; } if ( glyph_length == 0 ) goto Exit; if ( FT_ALLOC( charstring, glyph_length ) ) goto Exit; if ( FT_STREAM_READ_AT( cid->data_offset + off1, charstring, glyph_length ) ) goto Exit; } /* Now set up the subrs array and parse the charstrings. */ { CID_FaceDict dict; CID_Subrs cid_subrs = face->subrs + fd_select; FT_Int cs_offset; /* Set up subrs */ decoder->num_subrs = cid_subrs->num_subrs;//.........这里部分代码省略.........
开发者ID:0302zq,项目名称:libgdx,代码行数:101,
示例6: pfr_face_init pfr_face_init( FT_Stream stream, FT_Face pfrface, FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { PFR_Face face = (PFR_Face)pfrface; FT_Error error; FT_UNUSED( num_params ); FT_UNUSED( params ); /* load the header and check it */ error = pfr_header_load( &face->header, stream ); if ( error ) goto Exit; if ( !pfr_header_check( &face->header ) ) { FT_TRACE4(( "pfr_face_init: not a valid PFR font/n" )); error = PFR_Err_Unknown_File_Format; goto Exit; } /* check face index */ { FT_UInt num_faces; error = pfr_log_font_count( stream, face->header.log_dir_offset, &num_faces ); if ( error ) goto Exit; pfrface->num_faces = num_faces; } if ( face_index < 0 ) goto Exit; if ( face_index >= pfrface->num_faces ) { FT_ERROR(( "pfr_face_init: invalid face index/n" )); error = PFR_Err_Invalid_Argument; goto Exit; } /* load the face */ error = pfr_log_font_load( &face->log_font, stream, face_index, face->header.log_dir_offset, FT_BOOL( face->header.phy_font_max_size_high != 0 ) ); if ( error ) goto Exit; /* now load the physical font descriptor */ error = pfr_phy_font_load( &face->phy_font, stream, face->log_font.phys_offset, face->log_font.phys_size ); if ( error ) goto Exit; /* now, set-up all root face fields */ { PFR_PhyFont phy_font = &face->phy_font; pfrface->face_index = face_index; pfrface->num_glyphs = phy_font->num_chars; pfrface->face_flags = FT_FACE_FLAG_SCALABLE; if ( (phy_font->flags & PFR_PHY_PROPORTIONAL) == 0 ) pfrface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH; if ( phy_font->flags & PFR_PHY_VERTICAL ) pfrface->face_flags |= FT_FACE_FLAG_VERTICAL; else pfrface->face_flags |= FT_FACE_FLAG_HORIZONTAL; if ( phy_font->num_strikes > 0 ) pfrface->face_flags |= FT_FACE_FLAG_FIXED_SIZES; if ( phy_font->num_kern_pairs > 0 ) pfrface->face_flags |= FT_FACE_FLAG_KERNING; /* If no family name was found in the "undocumented" auxiliary * data, use the font ID instead. This sucks but is better than * nothing. */ pfrface->family_name = phy_font->family_name; if ( pfrface->family_name == NULL ) pfrface->family_name = phy_font->font_id; /* note that the style name can be NULL in certain PFR fonts, * probably meaning "Regular" */ pfrface->style_name = phy_font->style_name;//.........这里部分代码省略.........
开发者ID:Bracket-,项目名称:psp-ports,代码行数:101,
示例7: pcf_get_properties static FT_Error pcf_get_properties( FT_Stream stream, PCF_Face face ) { PCF_ParseProperty props = 0; PCF_Property properties = NULL; FT_ULong nprops, i; FT_ULong format, size; FT_Error error; FT_Memory memory = FT_FACE(face)->memory; FT_ULong string_size; FT_String* strings = 0; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_PROPERTIES, &format, &size ); if ( error ) goto Bail; if ( FT_READ_ULONG_LE( format ) ) goto Bail; FT_TRACE4(( "pcf_get_properties:/n" )); FT_TRACE4(( " format = %ld/n", format )); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) goto Bail; if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( nprops ); else (void)FT_READ_ULONG_LE( nprops ); if ( error ) goto Bail; FT_TRACE4(( " nprop = %d (truncate %d props)/n", (int)nprops, nprops - (int)nprops )); nprops = (int)nprops; /* rough estimate */ if ( nprops > size / PCF_PROPERTY_SIZE ) { error = PCF_Err_Invalid_Table; goto Bail; } face->nprops = (int)nprops; if ( FT_NEW_ARRAY( props, nprops ) ) goto Bail; for ( i = 0; i < nprops; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) { if ( FT_STREAM_READ_FIELDS( pcf_property_msb_header, props + i ) ) goto Bail; } else { if ( FT_STREAM_READ_FIELDS( pcf_property_header, props + i ) ) goto Bail; } } /* pad the property array */ /* */ /* clever here - nprops is the same as the number of odd-units read, */ /* as only isStringProp are odd length (Keith Packard) */ /* */ if ( nprops & 3 ) { i = 4 - ( nprops & 3 ); if ( FT_STREAM_SKIP( i ) ) { error = PCF_Err_Invalid_Stream_Skip; goto Bail; } } if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( string_size ); else (void)FT_READ_ULONG_LE( string_size ); if ( error ) goto Bail; FT_TRACE4(( " string_size = %ld/n", string_size )); /* rough estimate */ if ( string_size > size - nprops * PCF_PROPERTY_SIZE ) { error = PCF_Err_Invalid_Table; goto Bail;//.........这里部分代码省略.........
开发者ID:151706061,项目名称:VTK,代码行数:101,
示例8: pcf_get_metrics static FT_Error pcf_get_metrics( FT_Stream stream, PCF_Face face ) { FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_ULong format, size; PCF_Metric metrics = 0; FT_ULong nmetrics, i; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_METRICS, &format, &size ); if ( error ) return error; if ( FT_READ_ULONG_LE( format ) ) goto Bail; if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) ) return PCF_Err_Invalid_File_Format; if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( nmetrics ); else (void)FT_READ_ULONG_LE( nmetrics ); } else { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_USHORT( nmetrics ); else (void)FT_READ_USHORT_LE( nmetrics ); } if ( error ) return PCF_Err_Invalid_File_Format; face->nmetrics = nmetrics; if ( !nmetrics ) return PCF_Err_Invalid_Table; FT_TRACE4(( "pcf_get_metrics:/n" )); FT_TRACE4(( " number of metrics: %d/n", nmetrics )); /* rough estimate */ if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( nmetrics > size / PCF_METRIC_SIZE ) return PCF_Err_Invalid_Table; } else { if ( nmetrics > size / PCF_COMPRESSED_METRIC_SIZE ) return PCF_Err_Invalid_Table; } if ( FT_NEW_ARRAY( face->metrics, nmetrics ) ) return PCF_Err_Out_Of_Memory; metrics = face->metrics; for ( i = 0; i < nmetrics; i++ ) { error = pcf_get_metric( stream, format, metrics + i ); metrics[i].bits = 0; FT_TRACE5(( " idx %d: width=%d, " "lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d/n", i, ( metrics + i )->characterWidth, ( metrics + i )->leftSideBearing, ( metrics + i )->rightSideBearing, ( metrics + i )->ascent, ( metrics + i )->descent, ( metrics + i )->attributes )); if ( error ) break; } if ( error ) FT_FREE( face->metrics ); Bail: return error; }
开发者ID:151706061,项目名称:VTK,代码行数:95,
示例9: pcf_get_bitmaps static FT_Error pcf_get_bitmaps( FT_Stream stream, PCF_Face face ) { FT_Error error; FT_Memory memory = FT_FACE( face )->memory; FT_Long* offsets = NULL; FT_Long bitmapSizes[GLYPHPADOPTIONS]; FT_ULong format, size; FT_ULong nbitmaps, i, sizebitmaps = 0; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_BITMAPS, &format, &size ); if ( error ) return error; error = FT_Stream_EnterFrame( stream, 8 ); if ( error ) return error; format = FT_GET_ULONG_LE(); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) nbitmaps = FT_GET_ULONG(); else nbitmaps = FT_GET_ULONG_LE(); FT_Stream_ExitFrame( stream ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return FT_THROW( Invalid_File_Format ); FT_TRACE4(( "pcf_get_bitmaps:/n" )); FT_TRACE4(( " number of bitmaps: %d/n", nbitmaps )); /* XXX: PCF_Face->nmetrics is singed FT_Long, see pcf.h */ if ( face->nmetrics < 0 || nbitmaps != ( FT_ULong )face->nmetrics ) return FT_THROW( Invalid_File_Format ); if ( FT_NEW_ARRAY( offsets, nbitmaps ) ) return error; for ( i = 0; i < nbitmaps; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_LONG( offsets[i] ); else (void)FT_READ_LONG_LE( offsets[i] ); FT_TRACE5(( " bitmap %d: offset %ld (0x%lX)/n", i, offsets[i], offsets[i] )); } if ( error ) goto Bail; for ( i = 0; i < GLYPHPADOPTIONS; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_LONG( bitmapSizes[i] ); else (void)FT_READ_LONG_LE( bitmapSizes[i] ); if ( error ) goto Bail; sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )]; FT_TRACE4(( " padding %d implies a size of %ld/n", i, bitmapSizes[i] )); } FT_TRACE4(( " %d bitmaps, padding index %ld/n", nbitmaps, PCF_GLYPH_PAD_INDEX( format ) )); FT_TRACE4(( " bitmap size = %d/n", sizebitmaps )); FT_UNUSED( sizebitmaps ); /* only used for debugging */ for ( i = 0; i < nbitmaps; i++ ) { /* rough estimate */ if ( ( offsets[i] < 0 ) || ( (FT_ULong)offsets[i] > size ) ) { FT_TRACE0(( "pcf_get_bitmaps:" " invalid offset to bitmap data of glyph %d/n", i )); } else face->metrics[i].bits = stream->pos + offsets[i]; } face->bitmapsFormat = format; Bail: FT_FREE( offsets ); return error; }
开发者ID:ONLYOFFICE,项目名称:core,代码行数:100,
示例10: pcf_get_encodings static FT_Error pcf_get_encodings( FT_Stream stream, PCF_Face face ) { FT_Error error; FT_Memory memory = FT_FACE( face )->memory; FT_ULong format, size; int firstCol, lastCol; int firstRow, lastRow; int nencoding, encodingOffset; int i, j, k; PCF_Encoding encoding = NULL; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_BDF_ENCODINGS, &format, &size ); if ( error ) return error; error = FT_Stream_EnterFrame( stream, 14 ); if ( error ) return error; format = FT_GET_ULONG_LE(); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) { firstCol = FT_GET_SHORT(); lastCol = FT_GET_SHORT(); firstRow = FT_GET_SHORT(); lastRow = FT_GET_SHORT(); face->defaultChar = FT_GET_SHORT(); } else { firstCol = FT_GET_SHORT_LE(); lastCol = FT_GET_SHORT_LE(); firstRow = FT_GET_SHORT_LE(); lastRow = FT_GET_SHORT_LE(); face->defaultChar = FT_GET_SHORT_LE(); } FT_Stream_ExitFrame( stream ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return FT_THROW( Invalid_File_Format ); FT_TRACE4(( "pdf_get_encodings:/n" )); FT_TRACE4(( " firstCol %d, lastCol %d, firstRow %d, lastRow %d/n", firstCol, lastCol, firstRow, lastRow )); nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 ); if ( FT_NEW_ARRAY( encoding, nencoding ) ) return FT_THROW( Out_Of_Memory ); error = FT_Stream_EnterFrame( stream, 2 * nencoding ); if ( error ) goto Bail; k = 0; for ( i = firstRow; i <= lastRow; i++ ) { for ( j = firstCol; j <= lastCol; j++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) encodingOffset = FT_GET_SHORT(); else encodingOffset = FT_GET_SHORT_LE(); if ( encodingOffset != -1 ) { encoding[k].enc = i * 256 + j; encoding[k].glyph = (FT_Short)encodingOffset; FT_TRACE5(( " code %d (0x%04X): idx %d/n", encoding[k].enc, encoding[k].enc, encoding[k].glyph )); k++; } } } FT_Stream_ExitFrame( stream ); if ( FT_RENEW_ARRAY( encoding, nencoding, k ) ) goto Bail; face->nencodings = k; face->encodings = encoding; return error; Bail: FT_FREE( encoding ); return error;//.........这里部分代码省略.........
开发者ID:ONLYOFFICE,项目名称:core,代码行数:101,
示例11: af_face_globals_compute_style_coverage//.........这里部分代码省略......... break; if ( gindex < (FT_ULong)globals->glyph_count && ( gstyles[gindex] & AF_STYLE_MASK ) == (FT_UShort)ss ) gstyles[gindex] |= AF_NONBASE; } } } else { /* get glyphs not directly addressable by cmap */ af_shaper_get_coverage( globals, style_class, gstyles, 0 ); } } /* handle the remaining default OpenType features ... */ for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) { AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss]; if ( style_class->coverage == AF_COVERAGE_DEFAULT ) af_shaper_get_coverage( globals, style_class, gstyles, 0 ); } /* ... and finally the default OpenType features of the default script */ af_shaper_get_coverage( globals, AF_STYLE_CLASSES_GET[dflt], gstyles, 1 ); /* mark ASCII digits */ for ( i = 0x30; i <= 0x39; i++ ) { FT_UInt gindex = FT_Get_Char_Index( face, i ); if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count ) gstyles[gindex] |= AF_DIGIT; } Exit: /* * By default, all uncovered glyphs are set to the fallback style. * XXX: Shouldn't we disable hinting or do something similar? */ if ( globals->module->fallback_style != AF_STYLE_UNASSIGNED ) { FT_Long nn; for ( nn = 0; nn < globals->glyph_count; nn++ ) { if ( ( gstyles[nn] & AF_STYLE_MASK ) == AF_STYLE_UNASSIGNED ) { gstyles[nn] &= ~AF_STYLE_MASK; gstyles[nn] |= globals->module->fallback_style; } } }#ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE4(( "/n" "style coverage/n" "==============/n" "/n" )); for ( ss = 0; AF_STYLE_CLASSES_GET[ss]; ss++ ) { AF_StyleClass style_class = AF_STYLE_CLASSES_GET[ss]; FT_UInt count = 0; FT_Long idx; FT_TRACE4(( "%s:/n", af_style_names[style_class->style] )); for ( idx = 0; idx < globals->glyph_count; idx++ ) { if ( ( gstyles[idx] & AF_STYLE_MASK ) == style_class->style ) { if ( !( count % 10 ) ) FT_TRACE4(( " " )); FT_TRACE4(( " %d", idx )); count++; if ( !( count % 10 ) ) FT_TRACE4(( "/n" )); } } if ( !count ) FT_TRACE4(( " (none)/n" )); if ( count % 10 ) FT_TRACE4(( "/n" )); }#endif /* FT_DEBUG_LEVEL_TRACE */ FT_Set_Charmap( face, old_charmap ); return error; }
开发者ID:AaronNGray,项目名称:texlive-libs,代码行数:101,
示例12: otv_GDEF_validate//.........这里部分代码省略......... otvalid->root = ftvalid; FT_TRACE3(( "validating GDEF table/n" )); OTV_INIT; OTV_LIMIT_CHECK( 4 ); if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; version = FT_NEXT_USHORT( p ); /* minorVersion */ table_size = 10; switch ( version ) { case 0: /* MarkAttachClassDef has been added to the OpenType */ /* specification without increasing GDEF's version, */ /* so we use this ugly hack to find out whether the */ /* table is needed actually. */ need_MarkAttachClassDef = FT_BOOL( otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); if ( need_MarkAttachClassDef ) { OTV_LIMIT_CHECK( 8 ); table_size += 2; } else OTV_LIMIT_CHECK( 6 ); /* OpenType < 1.2 */ break; case 2: OTV_LIMIT_CHECK( 10 ); table_size += 4; break; case 3: OTV_LIMIT_CHECK( 14 ); table_size += 8; break; default: FT_INVALID_FORMAT; } otvalid->glyph_count = glyph_count; OTV_OPTIONAL_OFFSET( GlyphClassDef ); OTV_SIZE_CHECK( GlyphClassDef ); if ( GlyphClassDef ) otv_ClassDef_validate( table + GlyphClassDef, otvalid ); OTV_OPTIONAL_OFFSET( AttachListOffset ); OTV_SIZE_CHECK( AttachListOffset ); if ( AttachListOffset ) { OTV_NEST2( AttachList, AttachPoint ); OTV_RUN( table + AttachListOffset, otvalid ); } OTV_OPTIONAL_OFFSET( LigCaretListOffset ); OTV_SIZE_CHECK( LigCaretListOffset ); if ( LigCaretListOffset ) { OTV_NEST3( LigCaretList, LigGlyph, CaretValue ); OTV_RUN( table + LigCaretListOffset, otvalid ); } if ( need_MarkAttachClassDef ) { OTV_OPTIONAL_OFFSET( MarkAttachClassDef ); OTV_SIZE_CHECK( MarkAttachClassDef ); if ( MarkAttachClassDef ) otv_ClassDef_validate( table + MarkAttachClassDef, otvalid ); } if ( version > 0 ) { OTV_OPTIONAL_OFFSET( MarkGlyphSetsDef ); OTV_SIZE_CHECK( MarkGlyphSetsDef ); if ( MarkGlyphSetsDef ) otv_MarkGlyphSets_validate( table + MarkGlyphSetsDef, otvalid ); } if ( version > 2 ) { OTV_OPTIONAL_OFFSET32( itemVarStore ); OTV_SIZE_CHECK32( itemVarStore ); if ( itemVarStore ) OTV_TRACE(( " [omitting itemVarStore validation]/n" )); /* XXX */ } FT_TRACE4(( "/n" )); }
开发者ID:ImageMagick,项目名称:ttf,代码行数:101,
示例13: otv_BASE_validate otv_BASE_validate( FT_Bytes table, FT_Validator ftvalid ) { OTV_ValidatorRec otvalidrec; OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; FT_UInt table_size; FT_UShort version; OTV_OPTIONAL_TABLE( HorizAxis ); OTV_OPTIONAL_TABLE( VertAxis ); OTV_OPTIONAL_TABLE32( itemVarStore ); otvalid->root = ftvalid; FT_TRACE3(( "validating BASE table/n" )); OTV_INIT; OTV_LIMIT_CHECK( 4 ); if ( FT_NEXT_USHORT( p ) != 1 ) /* majorVersion */ FT_INVALID_FORMAT; version = FT_NEXT_USHORT( p ); /* minorVersion */ table_size = 8; switch ( version ) { case 0: OTV_LIMIT_CHECK( 4 ); break; case 1: OTV_LIMIT_CHECK( 8 ); table_size += 4; break; default: FT_INVALID_FORMAT; } OTV_OPTIONAL_OFFSET( HorizAxis ); OTV_SIZE_CHECK( HorizAxis ); if ( HorizAxis ) otv_Axis_validate( table + HorizAxis, otvalid ); OTV_OPTIONAL_OFFSET( VertAxis ); OTV_SIZE_CHECK( VertAxis ); if ( VertAxis ) otv_Axis_validate( table + VertAxis, otvalid ); if ( version > 0 ) { OTV_OPTIONAL_OFFSET32( itemVarStore ); OTV_SIZE_CHECK32( itemVarStore ); if ( itemVarStore ) OTV_TRACE(( " [omitting itemVarStore validation]/n" )); /* XXX */ } FT_TRACE4(( "/n" )); }
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:63,
示例14: tt_size_run_fpgm tt_size_run_fpgm( TT_Size size, FT_Bool pedantic ) { TT_Face face = (TT_Face)size->root.face; TT_ExecContext exec; FT_Error error; exec = size->context; error = TT_Load_Context( exec, face, size ); if ( error ) return error; exec->callTop = 0; exec->top = 0; exec->period = 64; exec->phase = 0; exec->threshold = 0; exec->instruction_trap = FALSE; exec->F_dot_P = 0x4000L; exec->pedantic_hinting = pedantic; { FT_Size_Metrics* size_metrics = &exec->metrics; TT_Size_Metrics* tt_metrics = &exec->tt_metrics; size_metrics->x_ppem = 0; size_metrics->y_ppem = 0; size_metrics->x_scale = 0; size_metrics->y_scale = 0; tt_metrics->ppem = 0; tt_metrics->scale = 0; tt_metrics->ratio = 0x10000L; } /* allow font program execution */ TT_Set_CodeRange( exec, tt_coderange_font, face->font_program, (FT_Long)face->font_program_size ); /* disable CVT and glyph programs coderange */ TT_Clear_CodeRange( exec, tt_coderange_cvt ); TT_Clear_CodeRange( exec, tt_coderange_glyph ); if ( face->font_program_size > 0 ) { TT_Goto_CodeRange( exec, tt_coderange_font, 0 ); FT_TRACE4(( "Executing `fpgm' table./n" )); error = face->interpreter( exec );#ifdef FT_DEBUG_LEVEL_TRACE if ( error ) FT_TRACE4(( " interpretation failed with error code 0x%x/n", error ));#endif } else error = FT_Err_Ok; size->bytecode_ready = error; if ( !error ) TT_Save_Context( exec, size ); return error; }
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:73,
示例15: pcf_read_TOC static FT_Error pcf_read_TOC( FT_Stream stream, PCF_Face face ) { FT_Error error; PCF_Toc toc = &face->toc; PCF_Table tables; FT_Memory memory = FT_FACE(face)->memory; FT_UInt n; if ( FT_STREAM_SEEK ( 0 ) || FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) ) return PCF_Err_Cannot_Open_Resource; if ( toc->version != PCF_FILE_VERSION || toc->count > FT_ARRAY_MAX( face->toc.tables ) || toc->count == 0 ) return PCF_Err_Invalid_File_Format; if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) ) return PCF_Err_Out_Of_Memory; tables = face->toc.tables; for ( n = 0; n < toc->count; n++ ) { if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) ) goto Exit; tables++; } /* Sort tables and check for overlaps. Because they are almost */ /* always ordered already, an in-place bubble sort with simultaneous */ /* boundary checking seems appropriate. */ tables = face->toc.tables; for ( n = 0; n < toc->count - 1; n++ ) { FT_UInt i, have_change; have_change = 0; for ( i = 0; i < toc->count - 1 - n; i++ ) { PCF_TableRec tmp; if ( tables[i].offset > tables[i + 1].offset ) { tmp = tables[i]; tables[i] = tables[i + 1]; tables[i + 1] = tmp; have_change = 1; } if ( ( tables[i].size > tables[i + 1].offset ) || ( tables[i].offset > tables[i + 1].offset - tables[i].size ) ) return PCF_Err_Invalid_Offset; } if ( !have_change ) break; }#ifdef FT_DEBUG_LEVEL_TRACE { FT_UInt i, j; const char* name = "?"; FT_TRACE4(( "pcf_read_TOC:/n" )); FT_TRACE4(( " number of tables: %ld/n", face->toc.count )); tables = face->toc.tables; for ( i = 0; i < toc->count; i++ ) { for ( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] ); j++ ) if ( tables[i].type == (FT_UInt)( 1 << j ) ) name = tableNames[j]; FT_TRACE4(( " %d: type=%s, format=0x%X, " "size=%ld (0x%lX), offset=%ld (0x%lX)/n", i, name, tables[i].format, tables[i].size, tables[i].size, tables[i].offset, tables[i].offset )); } }#endif return PCF_Err_Ok; Exit://.........这里部分代码省略.........
开发者ID:151706061,项目名称:VTK,代码行数:101,
示例16: tt_size_run_prep tt_size_run_prep( TT_Size size, FT_Bool pedantic ) { TT_Face face = (TT_Face)size->root.face; TT_ExecContext exec; FT_Error error; exec = size->context; error = TT_Load_Context( exec, face, size ); if ( error ) return error; exec->callTop = 0; exec->top = 0; exec->instruction_trap = FALSE; exec->pedantic_hinting = pedantic; TT_Set_CodeRange( exec, tt_coderange_cvt, face->cvt_program, (FT_Long)face->cvt_program_size ); TT_Clear_CodeRange( exec, tt_coderange_glyph ); if ( face->cvt_program_size > 0 ) { TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 ); FT_TRACE4(( "Executing `prep' table./n" )); error = face->interpreter( exec );#ifdef FT_DEBUG_LEVEL_TRACE if ( error ) FT_TRACE4(( " interpretation failed with error code 0x%x/n", error ));#endif } else error = FT_Err_Ok; size->cvt_ready = error; /* UNDOCUMENTED! The MS rasterizer doesn't allow the following */ /* graphics state variables to be modified by the CVT program. */ exec->GS.dualVector.x = 0x4000; exec->GS.dualVector.y = 0; exec->GS.projVector.x = 0x4000; exec->GS.projVector.y = 0x0; exec->GS.freeVector.x = 0x4000; exec->GS.freeVector.y = 0x0; exec->GS.rp0 = 0; exec->GS.rp1 = 0; exec->GS.rp2 = 0; exec->GS.gep0 = 1; exec->GS.gep1 = 1; exec->GS.gep2 = 1; exec->GS.loop = 1; /* save as default graphics state */ size->GS = exec->GS; TT_Save_Context( exec, size ); return error; }
开发者ID:CCExtractor,项目名称:ccextractor,代码行数:72,
示例17: pcf_get_bitmaps static FT_Error pcf_get_bitmaps( FT_Stream stream, PCF_Face face ) { FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_Long* offsets; FT_Long bitmapSizes[GLYPHPADOPTIONS]; FT_ULong format, size; int nbitmaps, i, sizebitmaps = 0; char* bitmaps; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_BITMAPS, &format, &size ); if ( error ) return error; error = FT_Stream_EnterFrame( stream, 8 ); if ( error ) return error; format = FT_GET_ULONG_LE(); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) nbitmaps = FT_GET_ULONG(); else nbitmaps = FT_GET_ULONG_LE(); FT_Stream_ExitFrame( stream ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return PCF_Err_Invalid_File_Format; if ( nbitmaps != face->nmetrics ) return PCF_Err_Invalid_File_Format; if ( FT_NEW_ARRAY( offsets, nbitmaps ) ) return error; FT_TRACE4(( "pcf_get_bitmaps:/n" )); for ( i = 0; i < nbitmaps; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_LONG( offsets[i] ); else (void)FT_READ_LONG_LE( offsets[i] ); FT_TRACE4(( " bitmap %d: offset %ld (0x%lX)/n", i, offsets[i], offsets[i] )); } if ( error ) goto Bail; for ( i = 0; i < GLYPHPADOPTIONS; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_LONG( bitmapSizes[i] ); else (void)FT_READ_LONG_LE( bitmapSizes[i] ); if ( error ) goto Bail; sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX( format )]; FT_TRACE4(( " padding %d implies a size of %ld/n", i, bitmapSizes[i] )); } FT_TRACE4(( " %d bitmaps, padding index %ld/n", nbitmaps, PCF_GLYPH_PAD_INDEX( format ) )); FT_TRACE4(( " bitmap size = %d/n", sizebitmaps )); FT_UNUSED( sizebitmaps ); /* only used for debugging */ for ( i = 0; i < nbitmaps; i++ ) face->metrics[i].bits = stream->pos + offsets[i]; face->bitmapsFormat = format; FT_FREE ( offsets ); return error; Bail: FT_FREE ( offsets ); FT_FREE ( bitmaps ); return error; }
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:92,
示例18: cf2_interpT2CharString//.........这里部分代码省略......... if ( cf2_buf_isEnd( charstring ) ) { /* If we've reached the end of the charstring, simulate a */ /* cf2_cmdRETURN or cf2_cmdENDCHAR. */ if ( charstringIndex ) op1 = cf2_cmdRETURN; /* end of buffer for subroutine */ else op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */ } else op1 = (FT_Byte)cf2_buf_readByte( charstring ); /* check for errors once per loop */ if ( *error ) goto exit; instructionLimit--; if ( instructionLimit == 0 ) { lastError = FT_THROW( Invalid_Glyph_Format ); goto exit; } switch( op1 ) { case cf2_cmdRESERVED_0: case cf2_cmdRESERVED_2: case cf2_cmdRESERVED_9: case cf2_cmdRESERVED_13: case cf2_cmdRESERVED_15: case cf2_cmdRESERVED_16: case cf2_cmdRESERVED_17: /* we may get here if we have a prior error */ FT_TRACE4(( " unknown op (%d)/n", op1 )); break; case cf2_cmdHSTEMHM: case cf2_cmdHSTEM: FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm/n" : " hstem/n" )); /* never add hints after the mask is computed */ if ( cf2_hintmask_isValid( &hintMask ) ) FT_TRACE4(( "cf2_interpT2CharString:" " invalid horizontal hint mask/n" )); cf2_doStems( font, opStack, &hStemHintArray, width, &haveWidth, 0 ); break; case cf2_cmdVSTEMHM: case cf2_cmdVSTEM: FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm/n" : " vstem/n" )); /* never add hints after the mask is computed */ if ( cf2_hintmask_isValid( &hintMask ) ) FT_TRACE4(( "cf2_interpT2CharString:" " invalid vertical hint mask/n" )); cf2_doStems( font, opStack, &vStemHintArray, width,
开发者ID:120pulsations,项目名称:Torque2D,代码行数:67,
示例19: pcf_get_encodings static FT_Error pcf_get_encodings( FT_Stream stream, PCF_Face face ) { FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_ULong format, size; int firstCol, lastCol; int firstRow, lastRow; int nencoding, encodingOffset; int i, j; PCF_Encoding tmpEncoding, encoding = 0; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_BDF_ENCODINGS, &format, &size ); if ( error ) return error; error = FT_Stream_EnterFrame( stream, 14 ); if ( error ) return error; format = FT_GET_ULONG_LE(); if ( PCF_BYTE_ORDER( format ) == MSBFirst ) { firstCol = FT_GET_SHORT(); lastCol = FT_GET_SHORT(); firstRow = FT_GET_SHORT(); lastRow = FT_GET_SHORT(); face->defaultChar = FT_GET_SHORT(); } else { firstCol = FT_GET_SHORT_LE(); lastCol = FT_GET_SHORT_LE(); firstRow = FT_GET_SHORT_LE(); lastRow = FT_GET_SHORT_LE(); face->defaultChar = FT_GET_SHORT_LE(); } FT_Stream_ExitFrame( stream ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) return PCF_Err_Invalid_File_Format; FT_TRACE4(( "pdf_get_encodings:/n" )); FT_TRACE4(( " firstCol %d, lastCol %d, firstRow %d, lastRow %d/n", firstCol, lastCol, firstRow, lastRow )); nencoding = ( lastCol - firstCol + 1 ) * ( lastRow - firstRow + 1 ); if ( FT_NEW_ARRAY( tmpEncoding, nencoding ) ) return PCF_Err_Out_Of_Memory; error = FT_Stream_EnterFrame( stream, 2 * nencoding ); if ( error ) goto Bail; for ( i = 0, j = 0 ; i < nencoding; i++ ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) encodingOffset = FT_GET_SHORT(); else encodingOffset = FT_GET_SHORT_LE(); if ( encodingOffset != -1 ) { tmpEncoding[j].enc = ( ( ( i / ( lastCol - firstCol + 1 ) ) + firstRow ) * 256 ) + ( ( i % ( lastCol - firstCol + 1 ) ) + firstCol ); tmpEncoding[j].glyph = (FT_Short)encodingOffset; FT_TRACE4(( " code %d (0x%04X): idx %d/n", tmpEncoding[j].enc, tmpEncoding[j].enc, tmpEncoding[j].glyph )); j++; } } FT_Stream_ExitFrame( stream ); if ( FT_NEW_ARRAY( encoding, j ) ) goto Bail; for ( i = 0; i < j; i++ ) { encoding[i].enc = tmpEncoding[i].enc; encoding[i].glyph = tmpEncoding[i].glyph; } face->nencodings = j;//.........这里部分代码省略.........
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:101,
示例20: otv_GDEF_validate otv_GDEF_validate( FT_Bytes table, FT_Bytes gsub, FT_Bytes gpos, FT_Validator ftvalid ) { OTV_ValidatorRec validrec; OTV_Validator valid = &validrec; FT_Bytes p = table; FT_UInt table_size; FT_Bool need_MarkAttachClassDef; OTV_OPTIONAL_TABLE( GlyphClassDef ); OTV_OPTIONAL_TABLE( AttachListOffset ); OTV_OPTIONAL_TABLE( LigCaretListOffset ); OTV_OPTIONAL_TABLE( MarkAttachClassDef ); valid->root = ftvalid; FT_TRACE3(( "validating GDEF table/n" )); OTV_INIT; OTV_LIMIT_CHECK( 12 ); if ( FT_NEXT_ULONG( p ) != 0x10000UL ) /* Version */ FT_INVALID_FORMAT; /* MarkAttachClassDef has been added to the OpenType */ /* specification without increasing GDEF's version, */ /* so we use this ugly hack to find out whether the */ /* table is needed actually. */ need_MarkAttachClassDef = FT_BOOL( otv_GSUBGPOS_have_MarkAttachmentType_flag( gsub ) || otv_GSUBGPOS_have_MarkAttachmentType_flag( gpos ) ); if ( need_MarkAttachClassDef ) table_size = 12; /* OpenType >= 1.2 */ else table_size = 10; /* OpenType < 1.2 */ OTV_OPTIONAL_OFFSET( GlyphClassDef ); OTV_SIZE_CHECK( GlyphClassDef ); if ( GlyphClassDef ) otv_ClassDef_validate( table + GlyphClassDef, valid ); OTV_OPTIONAL_OFFSET( AttachListOffset ); OTV_SIZE_CHECK( AttachListOffset ); if ( AttachListOffset ) { OTV_NEST2( AttachList, AttachPoint ); OTV_RUN( table + AttachListOffset, valid ); } OTV_OPTIONAL_OFFSET( LigCaretListOffset ); OTV_SIZE_CHECK( LigCaretListOffset ); if ( LigCaretListOffset ) { OTV_NEST3( LigCaretList, LigGlyph, CaretValue ); OTV_RUN( table + LigCaretListOffset, valid ); } if ( need_MarkAttachClassDef ) { OTV_OPTIONAL_OFFSET( MarkAttachClassDef ); OTV_SIZE_CHECK( MarkAttachClassDef ); if ( MarkAttachClassDef ) otv_ClassDef_validate( table + MarkAttachClassDef, valid ); } FT_TRACE4(( "/n" )); }
开发者ID:BlairArchibald,项目名称:Alexandria,代码行数:72,
示例21: pcf_read_TOC static FT_Error pcf_read_TOC( FT_Stream stream, PCF_Face face ) { FT_Error error; PCF_Toc toc = &face->toc; PCF_Table tables; FT_Memory memory = FT_FACE(face)->memory; FT_UInt n; if ( FT_STREAM_SEEK ( 0 ) || FT_STREAM_READ_FIELDS ( pcf_toc_header, toc ) ) return PCF_Err_Cannot_Open_Resource; if ( toc->version != PCF_FILE_VERSION ) return PCF_Err_Invalid_File_Format; if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) ) return PCF_Err_Out_Of_Memory; tables = face->toc.tables; for ( n = 0; n < toc->count; n++ ) { if ( FT_STREAM_READ_FIELDS( pcf_table_header, tables ) ) goto Exit; tables++; }#if defined( FT_DEBUG_LEVEL_TRACE ) { FT_UInt i, j; const char* name = "?"; FT_TRACE4(( "pcf_read_TOC:/n" )); FT_TRACE4(( " number of tables: %ld/n", face->toc.count )); tables = face->toc.tables; for ( i = 0; i < toc->count; i++ ) { for( j = 0; j < sizeof ( tableNames ) / sizeof ( tableNames[0] ); j++ ) if ( tables[i].type == (FT_UInt)( 1 << j ) ) name = tableNames[j]; FT_TRACE4(( " %d: type=%s, format=0x%X, " "size=%ld (0x%lX), offset=%ld (0x%lX)/n", i, name, tables[i].format, tables[i].size, tables[i].size, tables[i].offset, tables[i].offset )); } }#endif return PCF_Err_Ok; Exit: FT_FREE( face->toc.tables ); return error; }
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:65,
示例22: cff_font_load//.........这里部分代码省略......... subfont_index = (FT_UInt)( face_index & 0xFFFF ); if ( face_index > 0 && subfont_index >= font->name_index.count ) { FT_ERROR(( "cff_font_load:" " invalid subfont index for pure CFF font (%d)/n", subfont_index )); error = FT_THROW( Invalid_Argument ); goto Exit; } font->num_faces = font->name_index.count; } else { subfont_index = 0; if ( font->name_index.count > 1 ) { FT_ERROR(( "cff_font_load:" " invalid CFF font with multiple subfonts/n" " " " in SFNT wrapper/n" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } } /* in case of a font format check, simply exit now */ if ( face_index < 0 ) goto Exit; /* now, parse the top-level font dictionary */ FT_TRACE4(( "parsing top-level/n" )); error = cff_subfont_load( &font->top_font, &font->font_dict_index, subfont_index, stream, base_offset, library ); if ( error ) goto Exit; if ( FT_STREAM_SEEK( base_offset + dict->charstrings_offset ) ) goto Exit; error = cff_index_init( &font->charstrings_index, stream, 0 ); if ( error ) goto Exit; /* now, check for a CID font */ if ( dict->cid_registry != 0xFFFFU ) { CFF_IndexRec fd_index; CFF_SubFont sub = NULL; FT_UInt idx; /* this is a CID-keyed font, we must now allocate a table of */ /* sub-fonts, then load each of them separately */ if ( FT_STREAM_SEEK( base_offset + dict->cid_fd_array_offset ) ) goto Exit; error = cff_index_init( &fd_index, stream, 0 ); if ( error ) goto Exit;
开发者ID:Johnny-Martin,项目名称:ComBase,代码行数:67,
示例23: gxv_just_validate gxv_just_validate( FT_Bytes table, FT_Face face, FT_Validator ftvalid ) { FT_Bytes p = table; FT_Bytes limit = 0; GXV_ValidatorRec gxvalidrec; GXV_Validator gxvalid = &gxvalidrec; GXV_just_DataRec justrec; GXV_just_Data just = &justrec; FT_ULong version; FT_UShort format; FT_UShort horizOffset; FT_UShort vertOffset; GXV_ODTECT( 3, odtect ); GXV_ODTECT_INIT( odtect ); gxvalid->root = ftvalid; gxvalid->table_data = just; gxvalid->face = face; FT_TRACE3(( "validating `just' table/n" )); GXV_INIT; limit = gxvalid->root->limit; GXV_LIMIT_CHECK( 4 + 2 + 2 + 2 ); version = FT_NEXT_ULONG( p ); format = FT_NEXT_USHORT( p ); horizOffset = FT_NEXT_USHORT( p ); vertOffset = FT_NEXT_USHORT( p ); gxv_odtect_add_range( table, p - table, "just header", odtect ); /* Version 1.0 (always:2000) */ GXV_TRACE(( " (version = 0x%08x)/n", version )); if ( version != 0x00010000UL ) FT_INVALID_FORMAT; /* format 0 (always:2000) */ GXV_TRACE(( " (format = 0x%04x)/n", format )); if ( format != 0x0000 ) FT_INVALID_FORMAT; GXV_TRACE(( " (horizOffset = %d)/n", horizOffset )); GXV_TRACE(( " (vertOffset = %d)/n", vertOffset )); /* validate justData */ if ( 0 < horizOffset ) { gxv_just_justData_validate( table + horizOffset, limit, gxvalid ); gxv_odtect_add_range( table + horizOffset, gxvalid->subtable_length, "horizJustData", odtect ); } if ( 0 < vertOffset ) { gxv_just_justData_validate( table + vertOffset, limit, gxvalid ); gxv_odtect_add_range( table + vertOffset, gxvalid->subtable_length, "vertJustData", odtect ); } gxv_odtect_validate( odtect, gxvalid ); FT_TRACE4(( "/n" )); }
开发者ID:OpenTechEngine,项目名称:OpenTechBFG,代码行数:72,
示例24: gxv_trak_validate gxv_trak_validate( FT_Bytes table, FT_Face face, FT_Validator ftvalid ) { FT_Bytes p = table; FT_Bytes limit = 0; GXV_ValidatorRec validrec; GXV_Validator valid = &validrec; GXV_trak_DataRec trakrec; GXV_trak_Data trak = &trakrec; FT_ULong version; FT_UShort format; FT_UShort horizOffset; FT_UShort vertOffset; FT_UShort reserved; GXV_ODTECT( 3, odtect ); GXV_ODTECT_INIT( odtect ); valid->root = ftvalid; valid->table_data = trak; valid->face = face; limit = valid->root->limit; FT_TRACE3(( "validating `trak' table/n" )); GXV_INIT; GXV_LIMIT_CHECK( 4 + 2 + 2 + 2 + 2 ); version = FT_NEXT_ULONG( p ); format = FT_NEXT_USHORT( p ); horizOffset = FT_NEXT_USHORT( p ); vertOffset = FT_NEXT_USHORT( p ); reserved = FT_NEXT_USHORT( p ); GXV_TRACE(( " (version = 0x%08x)/n", version )); GXV_TRACE(( " (format = 0x%04x)/n", format )); GXV_TRACE(( " (horizOffset = 0x%04x)/n", horizOffset )); GXV_TRACE(( " (vertOffset = 0x%04x)/n", vertOffset )); GXV_TRACE(( " (reserved = 0x%04x)/n", reserved )); /* Version 1.0 (always:1996) */ if ( version != 0x00010000UL ) FT_INVALID_FORMAT; /* format 0 (always:1996) */ if ( format != 0x0000 ) FT_INVALID_FORMAT; GXV_32BIT_ALIGNMENT_VALIDATE( horizOffset ); GXV_32BIT_ALIGNMENT_VALIDATE( vertOffset ); /* Reserved Fixed Value (always) */ if ( reserved != 0x0000 ) FT_INVALID_DATA; /* validate trackData */ if ( 0 < horizOffset ) { gxv_trak_trackData_validate( table + horizOffset, limit, valid ); gxv_odtect_add_range( table + horizOffset, valid->subtable_length, "horizJustData", odtect ); } if ( 0 < vertOffset ) { gxv_trak_trackData_validate( table + vertOffset, limit, valid ); gxv_odtect_add_range( table + vertOffset, valid->subtable_length, "vertJustData", odtect ); } gxv_odtect_validate( odtect, valid ); FT_TRACE4(( "/n" )); }
开发者ID:2or3,项目名称:PlaygroundOSS,代码行数:78,
示例25: cff_face_init//.........这里部分代码省略......... goto Exit; cff->pshinter = pshinter; cff->psnames = psnames; cffface->face_index = face_index; /* Complement the root flags with some interesting information. */ /* Note that this is only necessary for pure CFF and CEF fonts; */ /* SFNT based fonts use the `name' table instead. */ cffface->num_glyphs = (FT_Long)cff->num_glyphs; dict = &cff->top_font.font_dict; /* we need the `PSNames' module for CFF and CEF formats */ /* which aren't CID-keyed */ if ( dict->cid_registry == 0xFFFFU && !psnames ) { FT_ERROR(( "cff_face_init:" " cannot open CFF & CEF fonts/n" " " " without the `PSNames' module/n" )); error = FT_THROW( Missing_Module ); goto Exit; }#ifdef FT_DEBUG_LEVEL_TRACE { FT_UInt idx; FT_String* s; FT_TRACE4(( "SIDs/n" )); /* dump string index, including default strings for convenience */ for ( idx = 0; idx < cff->num_strings + 390; idx++ ) { s = cff_index_get_sid_string( cff, idx ); if ( s ) FT_TRACE4((" %5d %s/n", idx, s )); } }#endif /* FT_DEBUG_LEVEL_TRACE */ if ( !dict->has_font_matrix ) dict->units_per_em = pure_cff ? 1000 : face->root.units_per_EM; /* Normalize the font matrix so that `matrix->xx' is 1; the */ /* scaling is done with `units_per_em' then (at this point, */ /* it already contains the scaling factor, but without */ /* normalization of the matrix). */ /* */ /* Note that the offsets must be expressed in integer font */ /* units. */ { FT_Matrix* matrix = &dict->font_matrix; FT_Vector* offset = &dict->font_offset; FT_ULong* upm = &dict->units_per_em; FT_Fixed temp = FT_ABS( matrix->yy ); if ( temp != 0x10000L ) { *upm = (FT_ULong)FT_DivFix( (FT_Long)*upm, temp );
开发者ID:structuresound,项目名称:freetype,代码行数:67,
示例26: af_get_coverage FT_Error af_get_coverage( AF_FaceGlobals globals, AF_StyleClass style_class, FT_Byte* gstyles ) { hb_face_t* face; hb_set_t* gsub_lookups; /* GSUB lookups for a given script */ hb_set_t* gsub_glyphs; /* glyphs covered by GSUB lookups */ hb_set_t* gpos_lookups; /* GPOS lookups for a given script */ hb_set_t* gpos_glyphs; /* glyphs covered by GPOS lookups */ hb_script_t script; const hb_tag_t* coverage_tags; hb_tag_t script_tags[] = { HB_TAG_NONE, HB_TAG_NONE, HB_TAG_NONE, HB_TAG_NONE }; hb_codepoint_t idx;#ifdef FT_DEBUG_LEVEL_TRACE int count;#endif if ( !globals || !style_class || !gstyles ) return FT_THROW( Invalid_Argument ); face = hb_font_get_face( globals->hb_font ); gsub_lookups = hb_set_create(); gsub_glyphs = hb_set_create(); gpos_lookups = hb_set_create(); gpos_glyphs = hb_set_create(); coverage_tags = coverages[style_class->coverage]; script = scripts[style_class->script]; /* Convert a HarfBuzz script tag into the corresponding OpenType */ /* tag or tags -- some Indic scripts like Devanagari have an old */ /* and a new set of features. */ hb_ot_tags_from_script( script, &script_tags[0], &script_tags[1] ); /* `hb_ot_tags_from_script' usually returns HB_OT_TAG_DEFAULT_SCRIPT */ /* as the second tag. We change that to HB_TAG_NONE except for the */ /* default script. */ if ( style_class->script == globals->module->default_script && style_class->coverage == AF_COVERAGE_DEFAULT ) { if ( script_tags[0] == HB_TAG_NONE ) script_tags[0] = HB_OT_TAG_DEFAULT_SCRIPT; else { if ( script_tags[1] == HB_TAG_NONE ) script_tags[1] = HB_OT_TAG_DEFAULT_SCRIPT; else if ( script_tags[1] != HB_OT_TAG_DEFAULT_SCRIPT ) script_tags[2] = HB_OT_TAG_DEFAULT_SCRIPT; } } else { if ( script_tags[1] == HB_OT_TAG_DEFAULT_SCRIPT ) script_tags[1] = HB_TAG_NONE; } hb_ot_layout_collect_lookups( face, HB_OT_TAG_GSUB, script_tags, NULL, coverage_tags, gsub_lookups ); if ( hb_set_is_empty( gsub_lookups ) ) goto Exit; /* nothing to do */ hb_ot_layout_collect_lookups( face, HB_OT_TAG_GPOS, script_tags, NULL, coverage_tags, gpos_lookups ); FT_TRACE4(( "GSUB lookups (style `%s'):/n" " ", af_style_names[style_class->style] ));#ifdef FT_DEBUG_LEVEL_TRACE count = 0;#endif for ( idx = -1; hb_set_next( gsub_lookups, &idx ); ) {#ifdef FT_DEBUG_LEVEL_TRACE FT_TRACE4(( " %d", idx )); count++;#endif /* get output coverage of GSUB feature *///.........这里部分代码省略.........
开发者ID:preet,项目名称:ks_text,代码行数:101,
示例27: gxv_feat_validate gxv_feat_validate( FT_Bytes table, FT_Face face, FT_Validator ftvalid ) { GXV_ValidatorRec validrec; GXV_Validator valid = &validrec; GXV_feat_DataRec featrec; GXV_feat_Data feat = &featrec; FT_Bytes p = table; FT_Bytes limit = 0; FT_UInt featureNameCount; FT_UInt i; FT_Int last_feature; valid->root = ftvalid; valid->table_data = feat; valid->face = face; FT_TRACE3(( "validating `feat' table/n" )); GXV_INIT; feat->reserved_size = 0; /* version + featureNameCount + none_0 + none_1 */ GXV_LIMIT_CHECK( 4 + 2 + 2 + 4 ); feat->reserved_size += 4 + 2 + 2 + 4; if ( FT_NEXT_ULONG( p ) != 0x00010000UL ) /* Version */ FT_INVALID_FORMAT; featureNameCount = FT_NEXT_USHORT( p ); GXV_TRACE(( " (featureNameCount = %d)/n", featureNameCount )); if ( valid->root->level != FT_VALIDATE_PARANOID ) p += 6; /* skip (none) and (none) */ else { if ( FT_NEXT_USHORT( p ) != 0 ) FT_INVALID_DATA; if ( FT_NEXT_ULONG( p ) != 0 ) FT_INVALID_DATA; } feat->reserved_size += featureNameCount * ( 2 + 2 + 4 + 2 + 2 ); for ( last_feature = -1, i = 0; i < featureNameCount; i++ ) { gxv_feat_name_validate( p, limit, valid ); if ( valid->root->level == FT_VALIDATE_PARANOID && (FT_Int)GXV_FEAT_DATA( feature ) <= last_feature ) FT_INVALID_FORMAT; last_feature = GXV_FEAT_DATA( feature ); p += 2 + 2 + 4 + 2 + 2; } FT_TRACE4(( "/n" )); }
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:65,
示例28: pcf_get_metrics static FT_Error pcf_get_metrics( FT_Stream stream, PCF_Face face ) { FT_Error error = PCF_Err_Ok; FT_Memory memory = FT_FACE(face)->memory; FT_ULong format = 0; FT_ULong size = 0; PCF_Metric metrics = 0; int i; int nmetrics = -1; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_METRICS, &format, &size ); if ( error ) return error; error = FT_READ_ULONG_LE( format ); if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) ) return PCF_Err_Invalid_File_Format; if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( nmetrics ); else (void)FT_READ_ULONG_LE( nmetrics ); } else { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_USHORT( nmetrics ); else (void)FT_READ_USHORT_LE( nmetrics ); } if ( error || nmetrics == -1 ) return PCF_Err_Invalid_File_Format; face->nmetrics = nmetrics; if ( FT_NEW_ARRAY( face->metrics, nmetrics ) ) return PCF_Err_Out_Of_Memory; metrics = face->metrics; for ( i = 0; i < nmetrics; i++ ) { pcf_get_metric( stream, format, metrics + i ); metrics[i].bits = 0; FT_TRACE4(( "%d : width=%d, " "lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d/n", i, ( metrics + i )->characterWidth, ( metrics + i )->leftSideBearing, ( metrics + i )->rightSideBearing, ( metrics + i )->ascent, ( metrics + i )->descent, ( metrics + i )->attributes )); if ( error ) break; } if ( error ) FT_FREE( face->metrics ); return error; }
开发者ID:stefanhendriks,项目名称:dune2themaker,代码行数:75,
示例29: pcf_get_metrics static FT_Error pcf_get_metrics( FT_Stream stream, PCF_Face face ) { FT_Error error; FT_Memory memory = FT_FACE( face )->memory; FT_ULong format, size; PCF_Metric metrics = NULL; FT_ULong nmetrics, i; error = pcf_seek_to_table_type( stream, face->toc.tables, face->toc.count, PCF_METRICS, &format, &size ); if ( error ) return error; if ( FT_READ_ULONG_LE( format ) ) goto Bail; if ( !PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) && !PCF_FORMAT_MATCH( format, PCF_COMPRESSED_METRICS ) ) return FT_THROW( Invalid_File_Format ); if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_ULONG( nmetrics ); else (void)FT_READ_ULONG_LE( nmetrics ); } else { if ( PCF_BYTE_ORDER( format ) == MSBFirst ) (void)FT_READ_USHORT( nmetrics ); else (void)FT_READ_USHORT_LE( nmetrics ); } if ( error ) return FT_THROW( Invalid_File_Format ); face->nmetrics = nmetrics; if ( !nmetrics ) return FT_THROW( Invalid_Table ); FT_TRACE4(( "pcf_get_metrics:/n" )); FT_TRACE4(( " number of metrics: %d/n", nmetrics )); /* rough estimate */ if ( PCF_FORMAT_MATCH( format, PCF_DEFAULT_FORMAT ) ) { if ( nmetrics > size / PCF_METRIC_SIZE ) return FT_THROW( Invalid_Table ); } else { if ( nmetrics > size / PCF_COMPRESSED_METRIC_SIZE ) return FT_THROW( Invalid_Table ); } if ( FT_NEW_ARRAY( face->metrics, nmetrics ) ) return FT_THROW( Out_Of_Memory ); metrics = face->metrics; for ( i = 0; i < nmetrics; i++, metrics++ ) { error = pcf_get_metric( stream, format, metrics ); metrics->bits = 0; FT_TRACE5(( " idx %d: width=%d, " "lsb=%d, rsb=%d, ascent=%d, descent=%d, swidth=%d/n", i, metrics->characterWidth, metrics->leftSideBearing, metrics->rightSideBearing, metrics->ascent, metrics->descent, metrics->attributes )); if ( error ) break; /* sanity checks -- those values are used in `PCF_Glyph_Load' to */ /* compute a glyph's bitmap dimensions, thus setting them to zero in */ /* case of an error disables this particular glyph only */ if ( metrics->rightSideBearing < metrics->leftSideBearing || metrics->ascent + metrics->descent < 0 ) { metrics->characterWidth = 0; metrics->leftSideBearing = 0; metrics->rightSideBearing = 0; metrics->ascent = 0; metrics->descent = 0;//.........这里部分代码省略.........
开发者ID:structuresound,项目名称:freetype,代码行数:101,
注:本文中的FT_TRACE4函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ FT_UNUSED函数代码示例 C++ FT_TRACE3函数代码示例 |