本文整理汇总了C++中FT_FACE函数的典型用法代码示例。如果您正苦于以下问题:C++ FT_FACE函数的具体用法?C++ FT_FACE怎么用?C++ FT_FACE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FT_FACE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:27,代码来源:cffdrivr.c
示例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;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:15,代码来源:winfnt.c
示例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;
}
开发者ID:1tgr,项目名称:mobius,代码行数:17,代码来源:winfnt.c
示例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 ) );
}
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:8,代码来源:cffdrivr.c
示例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 );
}
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:9,代码来源:cffdrivr.c
示例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 );
}
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:9,代码来源:cffdrivr.c
示例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 );
}
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:10,代码来源:cffdrivr.c
示例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 );
}
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:10,代码来源:cffdrivr.c
示例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 );
}
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:10,代码来源:cffdrivr.c
示例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 );
}
开发者ID:GWRon,项目名称:pub.mod-NG,代码行数:10,代码来源:cffdrivr.c
示例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;
}
开发者ID:ImageMagick,项目名称:ttf,代码行数:54,代码来源:ttcolr.c
示例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;
}
}
开发者ID:erdincay,项目名称:vcxsrv-linux2windows,代码行数:18,代码来源:ttbdf.c
示例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;
}
开发者ID:1tgr,项目名称:mobius,代码行数:23,代码来源:winfnt.c
示例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;
//.........这里部分代码省略.........
开发者ID:4nakin,项目名称:Aquaria_clean,代码行数:101,代码来源:pcfread.c
示例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;
//.........这里部分代码省略.........
开发者ID:OpenTechEngine,项目名称:OpenTechBFG,代码行数:101,代码来源:pcfread.c
示例16: 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 );
/* sanity checks */
if ( firstCol < 0 ||
firstCol > lastCol ||
lastCol > 0xFF ||
firstRow < 0 ||
firstRow > lastRow ||
lastRow > 0xFF )
return FT_THROW( Invalid_Table );
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;
//.........这里部分代码省略.........
开发者ID:OpenTechEngine,项目名称:OpenTechBFG,代码行数:101,代码来源:pcfread.c
示例17: 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;
FT_ULong size;
if ( FT_STREAM_SEEK( 0 ) ||
FT_STREAM_READ_FIELDS( pcf_toc_header, toc ) )
return FT_THROW( Cannot_Open_Resource );
if ( toc->version != PCF_FILE_VERSION ||
toc->count > FT_ARRAY_MAX( face->toc.tables ) ||
toc->count == 0 )
return FT_THROW( Invalid_File_Format );
if ( FT_NEW_ARRAY( face->toc.tables, toc->count ) )
return FT_THROW( 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 ) )
{
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 ) ||
//.........这里部分代码省略.........
开发者ID:OpenTechEngine,项目名称:OpenTechBFG,代码行数:101,代码来源:pcfread.c
示例18: fnt_face_get_dll_fonts
static FT_Error
fnt_face_get_dll_fonts( FNT_Face face )
{
FT_Error error;
FT_Stream stream = FT_FACE(face)->stream;
FT_Memory memory = FT_FACE(face)->memory;
WinMZ_Header mz_header;
face->fonts = 0;
face->num_fonts = 0;
/* does it begin with a MZ header? */
if ( FILE_Seek( 0 ) ||
READ_Fields( winmz_header_fields, &mz_header ) )
goto Exit;
error = FNT_Err_Unknown_File_Format;
if ( mz_header.magic == WINFNT_MZ_MAGIC )
{
/* yes, now look for a NE header in the file */
WinNE_Header ne_header;
if ( FILE_Seek( mz_header.lfanew ) ||
READ_Fields( winne_header_fields, &ne_header ) )
goto Exit;
error = FNT_Err_Unknown_File_Format;
if ( ne_header.magic == WINFNT_NE_MAGIC )
{
/* good, now look in the resource table for each FNT resource */
FT_ULong res_offset = mz_header.lfanew +
ne_header.resource_tab_offset;
FT_UShort size_shift;
FT_UShort font_count = 0;
FT_ULong font_offset = 0;
if ( FILE_Seek( res_offset ) ||
ACCESS_Frame( ne_header.rname_tab_offset -
ne_header.resource_tab_offset ) )
goto Exit;
size_shift = GET_UShortLE();
for (;;)
{
FT_UShort type_id, count;
type_id = GET_UShortLE();
if ( !type_id )
break;
count = GET_UShortLE();
if ( type_id == 0x8008 )
{
font_count = count;
font_offset = (FT_ULong)( FILE_Pos() + 4 +
( stream->cursor - stream->limit ) );
break;
}
stream->cursor += 4 + count * 12;
}
FORGET_Frame();
if ( !font_count || !font_offset )
{
FT_TRACE2(( "this file doesn't contain any FNT resources!\n" ));
error = FNT_Err_Unknown_File_Format;
goto Exit;
}
if ( FILE_Seek( font_offset ) ||
ALLOC_ARRAY( face->fonts, font_count, FNT_Font ) )
goto Exit;
face->num_fonts = font_count;
if ( ACCESS_Frame( (FT_Long)font_count * 12 ) )
goto Exit;
/* now read the offset and position of each FNT font */
{
FNT_Font* cur = face->fonts;
FNT_Font* limit = cur + font_count;
for ( ; cur < limit; cur++ )
{
cur->offset = (FT_ULong)GET_UShortLE() << size_shift;
cur->fnt_size = (FT_ULong)GET_UShortLE() << size_shift;
cur->size_shift = size_shift;
stream->cursor += 8;
}
}
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:101,代码来源:winfnt.c
示例19: FNT_Face_Init
static FT_Error
FNT_Face_Init( FT_Stream stream,
FNT_Face face,
FT_Int face_index,
FT_Int num_params,
FT_Parameter* params )
{
FT_Error error;
FT_Memory memory = FT_FACE_MEMORY( face );
FT_UNUSED( num_params );
FT_UNUSED( params );
FT_UNUSED( face_index );
/* try to load several fonts from a DLL */
error = fnt_face_get_dll_fonts( face );
if ( error )
{
/* this didn't work, now try to load a single FNT font */
FNT_Font* font;
if ( ALLOC( face->fonts, sizeof ( *face->fonts ) ) )
goto Exit;
face->num_fonts = 1;
font = face->fonts;
font->offset = 0;
font->fnt_size = stream->size;
error = fnt_font_load( font, stream );
if ( error )
goto Fail;
}
/* all right, one or more fonts were loaded; we now need to */
/* fill the root FT_Face fields with relevant information */
{
FT_Face root = FT_FACE( face );
FNT_Font* fonts = face->fonts;
FNT_Font* limit = fonts + face->num_fonts;
FNT_Font* cur;
root->num_faces = 1;
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
FT_FACE_FLAG_HORIZONTAL;
if ( fonts->header.avg_width == fonts->header.max_width )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
if ( fonts->header.italic )
root->style_flags |= FT_STYLE_FLAG_ITALIC;
if ( fonts->header.weight >= 800 )
root->style_flags |= FT_STYLE_FLAG_BOLD;
/* Setup the `fixed_sizes' array */
if ( ALLOC_ARRAY( root->available_sizes, face->num_fonts,
FT_Bitmap_Size ) )
goto Fail;
root->num_fixed_sizes = face->num_fonts;
{
FT_Bitmap_Size* size = root->available_sizes;
for ( cur = fonts; cur < limit; cur++, size++ )
{
size->width = cur->header.pixel_width;
size->height = cur->header.pixel_height;
}
}
/* Setup the `charmaps' array */
root->charmaps = &face->charmap_handle;
root->num_charmaps = 1;
face->charmap.encoding = ft_encoding_unicode;
face->charmap.platform_id = 3;
face->charmap.encoding_id = 1;
face->charmap.face = root;
face->charmap_handle = &face->charmap;
root->charmap = face->charmap_handle;
/* setup remaining flags */
root->num_glyphs = fonts->header.last_char -
fonts->header.first_char + 1;
root->family_name = (FT_String*)fonts->fnt_frame +
fonts->header.face_name_offset;
root->style_name = (char *)"Regular";
if ( root->style_flags & FT_STYLE_FLAG_BOLD )
{
if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:101,代码来源:winfnt.c
示例20: pcf_load_font
pcf_load_font( FT_Stream stream,
PCF_Face face )
{
FT_Error error = PCF_Err_Ok;
FT_Memory memory = FT_FACE(face)->memory;
FT_Bool hasBDFAccelerators;
error = pcf_read_TOC( stream, face );
if ( error )
goto Exit;
error = pcf_get_properties( stream, face );
if ( error )
goto Exit;
/* Use the old accelerators if no BDF accelerators are in the file. */
hasBDFAccelerators = pcf_has_table_type( face->toc.tables,
face->toc.count,
PCF_BDF_ACCELERATORS );
if ( !hasBDFAccelerators )
{
error = pcf_get_accel( stream, face, PCF_ACCELERATORS );
if ( error )
goto Exit;
}
/* metrics */
error = pcf_get_metrics( stream, face );
if ( error )
goto Exit;
/* bitmaps */
error = pcf_get_bitmaps( stream, face );
if ( error )
goto Exit;
/* encodings */
error = pcf_get_encodings( stream, face );
if ( error )
goto Exit;
/* BDF style accelerators (i.e. bounds based on encoded glyphs) */
if ( hasBDFAccelerators )
{
error = pcf_get_accel( stream, face, PCF_BDF_ACCELERATORS );
if ( error )
goto Exit;
}
/* XXX: TO DO: inkmetrics and glyph_names are missing */
/* now construct the face object */
{
FT_Face root = FT_FACE( face );
PCF_Property prop;
root->num_faces = 1;
root->face_index = 0;
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
FT_FACE_FLAG_HORIZONTAL |
FT_FACE_FLAG_FAST_GLYPHS;
if ( face->accel.constantWidth )
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
if ( ( error = pcf_interpret_style( face ) ) != 0 )
goto Exit;
prop = pcf_find_property( face, "FAMILY_NAME" );
if ( prop && prop->isString )
{
if ( FT_STRDUP( root->family_name, prop->value.atom ) )
goto Exit;
}
else
root->family_name = NULL;
/*
* Note: We shift all glyph indices by +1 since we must
* respect the convention that glyph 0 always corresponds
* to the `missing glyph'.
*
* This implies bumping the number of `available' glyphs by 1.
*/
root->num_glyphs = face->nmetrics + 1;
root->num_fixed_sizes = 1;
if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
goto Exit;
{
FT_Bitmap_Size* bsize = root->available_sizes;
FT_Short resolution_x = 0, resolution_y = 0;
FT_MEM_ZERO( bsize, sizeof ( FT_Bitmap_Size ) );
#if 0
//.........这里部分代码省略.........
开发者ID:4nakin,项目名称:Aquaria_clean,代码行数:101,代码来源:pcfread.c
注:本文中的FT_FACE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论