本文整理汇总了C++中FT_FACE函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_FACE函数的具体用法?C++ FT_FACE怎么用?C++ FT_FACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FT_FACE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cff_get_ps_name
static const char*
cff_get_ps_name( CFF_Face face )
{
CFF_Font cff = (CFF_Font)face->extra.data;
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
/* following the OpenType specification 1.7, we return the name stored */
/* in the `name' table for a CFF wrapped into an SFNT container */
if ( FT_IS_SFNT( FT_FACE( face ) ) && sfnt )
{
FT_Library library = FT_FACE_LIBRARY( face );
FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
FT_Service_PsFontName service =
(FT_Service_PsFontName)ft_module_get_service(
sfnt_module,
FT_SERVICE_ID_POSTSCRIPT_FONT_NAME,
0 );
if ( service && service->get_ps_font_name )
return service->get_ps_font_name( FT_FACE( face ) );
}
return (const char*)cff->font_name;
}
示例2: fnt_face_done_fonts
static void
fnt_face_done_fonts( FNT_Face face )
{
FT_Memory memory = FT_FACE(face)->memory;
FT_Stream stream = FT_FACE(face)->stream;
FNT_Font* cur = face->fonts;
FNT_Font* limit = cur + face->num_fonts;
for ( ; cur < limit; cur++ )
fnt_font_done( cur, stream );
FREE( face->fonts );
face->num_fonts = 0;
}
示例3: fnt_font_done
static void
fnt_font_done( FNT_Face face )
{
FT_Memory memory = FT_FACE( face )->memory;
FT_Stream stream = FT_FACE( face )->stream;
FNT_Font font = face->font;
if ( !font )
return;
if ( font->fnt_frame )
FT_FRAME_RELEASE( font->fnt_frame );
FT_FREE( font );
face->font = 0;
}
示例4: cff_metrics_adjust
static void
cff_metrics_adjust( CFF_Face face )
{
FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var;
var->metrics_adjust( FT_FACE( face ) );
}
示例5: cff_get_mm_var
static FT_Error
cff_get_mm_var( CFF_Face face,
FT_MM_Var* *master )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
return mm->get_mm_var( FT_FACE( face ), master );
}
示例6: cff_set_instance
static FT_Error
cff_set_instance( CFF_Face face,
FT_UInt instance_index )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
return mm->set_instance( FT_FACE( face ), instance_index );
}
示例7: cff_set_mm_blend
static FT_Error
cff_set_mm_blend( CFF_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
return mm->set_mm_blend( FT_FACE( face ), num_coords, coords );
}
示例8: cff_get_mm_weightvector
static FT_Error
cff_get_mm_weightvector( CFF_Face face,
FT_UInt* len,
FT_Fixed* weightvector )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
return mm->get_mm_weightvector( FT_FACE( face ), len, weightvector );
}
示例9: cff_get_var_design
static FT_Error
cff_get_var_design( CFF_Face face,
FT_UInt num_coords,
FT_Fixed* coords )
{
FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
return mm->get_var_design( FT_FACE( face ), num_coords, coords );
}
示例10: cff_hadvance_adjust
static FT_Error
cff_hadvance_adjust( CFF_Face face,
FT_UInt gindex,
FT_Int *avalue )
{
FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var;
return var->hadvance_adjust( FT_FACE( face ), gindex, avalue );
}
示例11: tt_face_get_colr_layer
tt_face_get_colr_layer( TT_Face face,
FT_UInt base_glyph,
FT_UInt *aglyph_index,
FT_UInt *acolor_index,
FT_LayerIterator* iterator )
{
Colr* colr = (Colr*)face->colr;
BaseGlyphRecord glyph_record;
if ( !colr )
return 0;
if ( !iterator->p )
{
FT_ULong offset;
/* first call to function */
iterator->layer = 0;
if ( !find_base_glyph_record( colr->base_glyphs,
colr->num_base_glyphs,
base_glyph,
&glyph_record ) )
return 0;
if ( glyph_record.num_layers )
iterator->num_layers = glyph_record.num_layers;
else
return 0;
offset = LAYER_SIZE * glyph_record.first_layer_index;
if ( offset + LAYER_SIZE * glyph_record.num_layers > colr->table_size )
return 0;
iterator->p = colr->layers + offset;
}
if ( iterator->layer >= iterator->num_layers )
return 0;
*aglyph_index = FT_NEXT_USHORT( iterator->p );
*acolor_index = FT_NEXT_USHORT( iterator->p );
if ( *aglyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs ) ||
( *acolor_index != 0xFFFF &&
*acolor_index >= face->palette_data.num_palette_entries ) )
return 0;
iterator->layer++;
return 1;
}
示例12: tt_face_free_bdf_props
tt_face_free_bdf_props( TT_Face face )
{
TT_BDF bdf = &face->bdf;
if ( bdf->loaded )
{
FT_Stream stream = FT_FACE(face)->stream;
if ( bdf->table != NULL )
FT_FRAME_RELEASE( bdf->table );
bdf->table_end = NULL;
bdf->strings = NULL;
bdf->strings_size = 0;
}
}
示例13: FNT_Size_Set_Pixels
static FT_Error
FNT_Size_Set_Pixels( FT_Size size )
{
FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
FT_Face root = FT_FACE( face );
if ( size->metrics.y_ppem == root->available_sizes->height )
{
FNT_Font font = face->font;
size->metrics.ascender = font->header.ascent * 64;
size->metrics.descender = ( font->header.pixel_height -
font->header.ascent ) * 64;
size->metrics.height = font->header.pixel_height * 64;
size->metrics.max_advance = font->header.max_width * 64;
return FNT_Err_Ok;
}
else
return FNT_Err_Invalid_Pixel_Size;
}
示例14: 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_TRACE5(( " 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;
//.........这里部分代码省略.........
示例15: 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 = 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 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;
//.........这里部分代码省略.........