本文整理汇总了C++中TT_Face类的典型用法代码示例。如果您正苦于以下问题:C++ TT_Face类的具体用法?C++ TT_Face怎么用?C++ TT_Face使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TT_Face类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tt_face_load_loca
tt_face_load_loca( TT_Face face,
FT_Stream stream )
{
FT_Error error;
FT_ULong table_len;
/* we need the size of the `glyf' table for malformed `loca' tables */
error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
if ( error )
goto Exit;
FT_TRACE2(( "Locations " ));
error = face->goto_table( face, TTAG_loca, stream, &table_len );
if ( error )
{
error = TT_Err_Locations_Missing;
goto Exit;
}
if ( face->header.Index_To_Loc_Format != 0 )
{
if ( table_len >= 0x40000L )
{
FT_TRACE2(( "table too large!\n" ));
error = TT_Err_Invalid_Table;
goto Exit;
}
face->num_locations = (FT_UInt)( table_len >> 2 );
}
else
{
if ( table_len >= 0x20000L )
示例2: tt_face_load_loca
tt_face_load_loca( TT_Face face,
FT_Stream stream )
{
FT_Error error;
FT_ULong table_len;
FT_Int shift;
/* we need the size of the `glyf' table for malformed `loca' tables */
error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
/* it is possible that a font doesn't have a glyf table at all */
/* or its size is zero */
if ( FT_ERR_EQ( error, Table_Missing ) )
{
face->glyf_len = 0;
face->glyf_offset = 0;
}
else if ( error )
goto Exit;
else
{
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( face->root.internal->incremental_interface )
face->glyf_offset = 0;
else
#endif
face->glyf_offset = FT_STREAM_POS();
}
FT_TRACE2(( "Locations " ));
error = face->goto_table( face, TTAG_loca, stream, &table_len );
if ( error )
{
error = FT_THROW( Locations_Missing );
goto Exit;
}
if ( face->header.Index_To_Loc_Format != 0 )
{
shift = 2;
if ( table_len >= 0x40000L )
{
FT_TRACE2(( "table too large\n" ));
table_len = 0x3FFFFL;
}
face->num_locations = table_len >> shift;
}
示例3: load_post_names
static FT_Error
load_post_names( TT_Face face )
{
FT_Stream stream;
FT_Error error;
FT_Fixed format;
/* get a stream for the face's resource */
stream = face->root.stream;
/* seek to the beginning of the PS names table */
error = face->goto_table( face, TTAG_post, stream, 0 );
if ( error )
goto Exit;
format = face->postscript.FormatType;
/* go to beginning of subtable */
if ( FT_STREAM_SKIP( 32 ) )
goto Exit;
/* now read postscript table */
if ( format == 0x00020000L )
error = load_format_20( face, stream );
else if ( format == 0x00028000L )
error = load_format_25( face, stream );
else
error = SFNT_Err_Invalid_File_Format;
face->postscript_names.loaded = 1;
Exit:
return error;
}
示例4: tt_face_load_hmtx
tt_face_load_hmtx( TT_Face face,
FT_Stream stream,
FT_Bool vertical )
{
FT_Error error;
FT_ULong tag, table_size;
FT_ULong* ptable_offset;
FT_ULong* ptable_size;
if ( vertical )
{
tag = TTAG_vmtx;
ptable_offset = &face->vert_metrics_offset;
ptable_size = &face->vert_metrics_size;
}
else
{
tag = TTAG_hmtx;
ptable_offset = &face->horz_metrics_offset;
ptable_size = &face->horz_metrics_size;
}
error = face->goto_table( face, tag, stream, &table_size );
if ( error )
goto Fail;
*ptable_size = table_size;
*ptable_offset = FT_STREAM_POS();
Fail:
return error;
}
示例5: tt_size_run_prep
tt_size_run_prep( TT_Size size )
{
TT_Face face = (TT_Face)size->root.face;
TT_ExecContext exec;
FT_Error error;
/* debugging instances have their own context */
if ( size->debug )
exec = size->context;
else
exec = ( (TT_Driver)FT_FACE_DRIVER( face ) )->context;
if ( !exec )
return TT_Err_Could_Not_Find_Context;
TT_Load_Context( exec, face, size );
exec->callTop = 0;
exec->top = 0;
exec->instruction_trap = FALSE;
TT_Set_CodeRange( exec,
tt_coderange_cvt,
face->cvt_program,
face->cvt_program_size );
TT_Clear_CodeRange( exec, tt_coderange_glyph );
if ( face->cvt_program_size > 0 )
{
error = TT_Goto_CodeRange( exec, tt_coderange_cvt, 0 );
if ( !error && !size->debug )
error = face->interpreter( exec );
}
else
error = TT_Err_Ok;
/* save as default graphics state */
size->GS = exec->GS;
TT_Save_Context( exec, size );
return error;
}
示例6: tt_face_load_gasp
tt_face_load_gasp( TT_Face face,
FT_Stream stream )
{
FT_Error error;
FT_Memory memory = stream->memory;
FT_UInt j,num_ranges;
TT_GaspRange gaspranges;
/* the gasp table is optional */
error = face->goto_table( face, TTAG_gasp, stream, 0 );
if ( error )
goto Exit;
if ( FT_FRAME_ENTER( 4L ) )
goto Exit;
face->gasp.version = FT_GET_USHORT();
face->gasp.numRanges = FT_GET_USHORT();
FT_FRAME_EXIT();
/* only support versions 0 and 1 of the table */
if ( face->gasp.version >= 2 )
{
face->gasp.numRanges = 0;
error = SFNT_Err_Invalid_Table;
goto Exit;
}
num_ranges = face->gasp.numRanges;
FT_TRACE3(( "numRanges: %u\n", num_ranges ));
if ( FT_QNEW_ARRAY( gaspranges, num_ranges ) ||
FT_FRAME_ENTER( num_ranges * 4L ) )
goto Exit;
face->gasp.gaspRanges = gaspranges;
for ( j = 0; j < num_ranges; j++ )
{
gaspranges[j].maxPPEM = FT_GET_USHORT();
gaspranges[j].gaspFlag = FT_GET_USHORT();
FT_TRACE3(( "gaspRange %d: rangeMaxPPEM %5d, rangeGaspBehavior 0x%x\n",
j,
gaspranges[j].maxPPEM,
gaspranges[j].gaspFlag ));
}
FT_FRAME_EXIT();
Exit:
return error;
}
示例7: tt_face_load_generic_header
static FT_Error
tt_face_load_generic_header( TT_Face face,
FT_Stream stream,
FT_ULong tag )
{
FT_Error error;
TT_Header* header;
static const FT_Frame_Field header_fields[] =
{
#undef FT_STRUCTURE
#define FT_STRUCTURE TT_Header
FT_FRAME_START( 54 ),
FT_FRAME_ULONG ( Table_Version ),
FT_FRAME_ULONG ( Font_Revision ),
FT_FRAME_LONG ( CheckSum_Adjust ),
FT_FRAME_LONG ( Magic_Number ),
FT_FRAME_USHORT( Flags ),
FT_FRAME_USHORT( Units_Per_EM ),
FT_FRAME_LONG ( Created[0] ),
FT_FRAME_LONG ( Created[1] ),
FT_FRAME_LONG ( Modified[0] ),
FT_FRAME_LONG ( Modified[1] ),
FT_FRAME_SHORT ( xMin ),
FT_FRAME_SHORT ( yMin ),
FT_FRAME_SHORT ( xMax ),
FT_FRAME_SHORT ( yMax ),
FT_FRAME_USHORT( Mac_Style ),
FT_FRAME_USHORT( Lowest_Rec_PPEM ),
FT_FRAME_SHORT ( Font_Direction ),
FT_FRAME_SHORT ( Index_To_Loc_Format ),
FT_FRAME_SHORT ( Glyph_Data_Format ),
FT_FRAME_END
};
error = face->goto_table( face, tag, stream, 0 );
if ( error )
goto Exit;
header = &face->header;
if ( FT_STREAM_READ_FIELDS( header_fields, header ) )
goto Exit;
FT_TRACE3(( "Units per EM: %4u\n", header->Units_Per_EM ));
FT_TRACE3(( "IndexToLoc: %4d\n", header->Index_To_Loc_Format ));
Exit:
return error;
}
示例8: tt_face_load_loca
tt_face_load_loca( TT_Face face,
FT_Stream stream )
{
FT_Error error;
FT_ULong table_len;
FT_Int shift;
/* we need the size of the `glyf' table for malformed `loca' tables */
error = face->goto_table( face, TTAG_glyf, stream, &face->glyf_len );
/* it is possible that a font doesn't have a glyf table at all */
/* or its size is zero */
if ( FT_ERR_EQ( error, Table_Missing ) )
face->glyf_len = 0;
else if ( error )
goto Exit;
FT_TRACE2(( "Locations " ));
error = face->goto_table( face, TTAG_loca, stream, &table_len );
if ( error )
{
error = FT_THROW( Locations_Missing );
goto Exit;
}
if ( face->header.Index_To_Loc_Format != 0 )
{
shift = 2;
if ( table_len >= 0x40000L )
{
FT_TRACE2(( "table too large\n" ));
error = FT_THROW( Invalid_Table );
goto Exit;
}
face->num_locations = table_len >> shift;
}
示例9: tt_face_load_hmtx
tt_face_load_hmtx( TT_Face face,
FT_Stream stream,
FT_Bool vertical )
{
FT_Error error;
FT_ULong table_size;
FT_Byte** ptable;
FT_ULong* ptable_size;
if ( vertical )
{
error = face->goto_table( face, TTAG_vmtx, stream, &table_size );
if ( error )
goto Fail;
ptable = &face->vert_metrics;
ptable_size = &face->vert_metrics_size;
}
else
{
error = face->goto_table( face, TTAG_hmtx, stream, &table_size );
if ( error )
goto Fail;
ptable = &face->horz_metrics;
ptable_size = &face->horz_metrics_size;
}
if ( FT_FRAME_EXTRACT( table_size, *ptable ) )
goto Fail;
*ptable_size = table_size;
Fail:
return error;
}
示例10: tt_face_load_cmap
tt_face_load_cmap( TT_Face face,
FT_Stream stream )
{
FT_Error error;
error = face->goto_table( face, TTAG_cmap, stream, &face->cmap_size );
if ( error )
goto Exit;
if ( FT_FRAME_EXTRACT( face->cmap_size, face->cmap_table ) )
face->cmap_size = 0;
Exit:
return error;
}
示例11: TT_Load_Locations
FT_LOCAL_DEF
FT_Error TT_Load_Locations( TT_Face face,
FT_Stream stream )
{
FT_Error error;
FT_Memory memory = stream->memory;
FT_Short LongOffsets;
FT_ULong table_len;
FT_TRACE2(( "Locations " ));
LongOffsets = face->header.Index_To_Loc_Format;
error = face->goto_table( face, TTAG_loca, stream, &table_len );
if ( error )
{
error = TT_Err_Locations_Missing;
goto Exit;
}
if ( LongOffsets != 0 )
{
face->num_locations = (FT_UShort)( table_len >> 2 );
FT_TRACE2(( "(32bit offsets): %12d ", face->num_locations ));
if ( ALLOC_ARRAY( face->glyph_locations,
face->num_locations,
FT_Long ) )
goto Exit;
if ( ACCESS_Frame( face->num_locations * 4L ) )
goto Exit;
{
FT_Long* loc = face->glyph_locations;
FT_Long* limit = loc + face->num_locations;
for ( ; loc < limit; loc++ )
*loc = GET_Long();
}
FORGET_Frame();
}
示例12: Load_Post_Names
static
FT_Error Load_Post_Names( TT_Face face )
{
FT_Stream stream;
FT_Error error;
FT_Fixed format;
/* get a stream for the face's resource */
stream = face->root.stream;
/* seek to the beginning of the PS names table */
error = face->goto_table( face, TTAG_post, stream, 0 );
if ( error )
goto Exit;
format = face->postscript.FormatType;
/* go to beginning of subtable */
if ( FILE_Skip( 32 ) )
goto Exit;
/* now read postscript table */
switch ( format )
{
case 0x00020000L:
error = Load_Format_20( face, stream );
break;
case 0x00028000L:
error = Load_Format_25( face, stream );
break;
default:
error = TT_Err_Invalid_File_Format;
}
face->postscript_names.loaded = 1;
Exit:
return error;
}
示例13: tt_face_load_pclt
tt_face_load_pclt( TT_Face face,
FT_Stream stream )
{
static const FT_Frame_Field pclt_fields[] =
{
#undef FT_STRUCTURE
#define FT_STRUCTURE TT_PCLT
FT_FRAME_START( 54 ),
FT_FRAME_ULONG ( Version ),
FT_FRAME_ULONG ( FontNumber ),
FT_FRAME_USHORT( Pitch ),
FT_FRAME_USHORT( xHeight ),
FT_FRAME_USHORT( Style ),
FT_FRAME_USHORT( TypeFamily ),
FT_FRAME_USHORT( CapHeight ),
FT_FRAME_BYTES ( TypeFace, 16 ),
FT_FRAME_BYTES ( CharacterComplement, 8 ),
FT_FRAME_BYTES ( FileName, 6 ),
FT_FRAME_CHAR ( StrokeWeight ),
FT_FRAME_CHAR ( WidthType ),
FT_FRAME_BYTE ( SerifStyle ),
FT_FRAME_BYTE ( Reserved ),
FT_FRAME_END
};
FT_Error error;
TT_PCLT* pclt = &face->pclt;
/* optional table */
error = face->goto_table( face, TTAG_PCLT, stream, 0 );
if ( error )
goto Exit;
if ( FT_STREAM_READ_FIELDS( pclt_fields, pclt ) )
goto Exit;
Exit:
return error;
}
示例14: tt_face_load_post
tt_face_load_post( TT_Face face,
FT_Stream stream )
{
FT_Error error;
TT_Postscript* post = &face->postscript;
static const FT_Frame_Field post_fields[] =
{
#undef FT_STRUCTURE
#define FT_STRUCTURE TT_Postscript
FT_FRAME_START( 32 ),
FT_FRAME_ULONG( FormatType ),
FT_FRAME_ULONG( italicAngle ),
FT_FRAME_SHORT( underlinePosition ),
FT_FRAME_SHORT( underlineThickness ),
FT_FRAME_ULONG( isFixedPitch ),
FT_FRAME_ULONG( minMemType42 ),
FT_FRAME_ULONG( maxMemType42 ),
FT_FRAME_ULONG( minMemType1 ),
FT_FRAME_ULONG( maxMemType1 ),
FT_FRAME_END
};
error = face->goto_table( face, TTAG_post, stream, 0 );
if ( error )
return error;
if ( FT_STREAM_READ_FIELDS( post_fields, post ) )
return error;
/* we don't load the glyph names, we do that in another */
/* module (ttpost). */
FT_TRACE3(( "FormatType: 0x%x\n", post->FormatType ));
FT_TRACE3(( "isFixedPitch: %s\n", post->isFixedPitch
? " yes" : " no" ));
return SFNT_Err_Ok;
}
示例15: tt_get_sfnt_checksum
static FT_ULong
tt_get_sfnt_checksum( TT_Face face,
FT_UShort i )
{
#if 0 /* if we believe the written value, use following part. */
if ( face->dir_tables[i].CheckSum )
return face->dir_tables[i].CheckSum;
#endif
if ( !face->goto_table )
return 0;
if ( face->goto_table( face,
face->dir_tables[i].Tag,
face->root.stream,
NULL ) )
return 0;
return (FT_ULong)tt_synth_sfnt_checksum( face->root.stream,
face->dir_tables[i].Length );
}