|
Navigation
- Home
- Community
- Development
- myReactOS
- Fundraiser 2012
Doxygen
- Main Page
- Alphabetical List
- Data Structures
- Directories
- File List
- Data Fields
- Globals
- Related Pages
Search
|
|
|
Definition at line 519 of file sfobjs.c.
{
FT_Error error;
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
FT_Error psnames_error;
#endif
FT_Bool has_outline;
FT_Bool is_apple_sbit;
FT_Bool ignore_preferred_family = FALSE;
FT_Bool ignore_preferred_subfamily = FALSE;
SFNT_Service sfnt = (SFNT_Service)face->sfnt;
FT_UNUSED( face_index );
{
FT_Int i;
for ( i = 0; i < num_params; i++ )
{
if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_FAMILY )
ignore_preferred_family = TRUE;
else if ( params[i].tag == FT_PARAM_TAG_IGNORE_PREFERRED_SUBFAMILY )
ignore_preferred_subfamily = TRUE;
}
}
FT_TRACE2(( "sfnt_load_face: %08p\n\n", face ));
#ifdef FT_CONFIG_OPTION_INCREMENTAL
has_outline = FT_BOOL( face->root.internal->incremental_interface != 0 ||
tt_face_lookup_table( face, TTAG_glyf ) != 0 ||
tt_face_lookup_table( face, TTAG_CFF ) != 0 );
#else
has_outline = FT_BOOL( tt_face_lookup_table( face, TTAG_glyf ) != 0 ||
tt_face_lookup_table( face, TTAG_CFF ) != 0 );
#endif
is_apple_sbit = 0;
if ( !has_outline && sfnt->load_bhed )
{
LOAD_( bhed );
is_apple_sbit = FT_BOOL( !error );
}
if ( !is_apple_sbit )
{
LOAD_( head );
if ( error )
goto Exit;
}
if ( face->header.Units_Per_EM == 0 )
{
error = SFNT_Err_Invalid_Table;
goto Exit;
}
LOAD_( maxp );
LOAD_( cmap );
LOAD_( name );
LOAD_( post );
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
psnames_error = error;
#endif
if ( !is_apple_sbit )
{
LOADM_( hhea, 0 );
if ( !error )
{
LOADM_( hmtx, 0 );
if ( error == SFNT_Err_Table_Missing )
{
error = SFNT_Err_Hmtx_Table_Missing;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->
get_glyph_metrics )
{
face->horizontal.number_Of_HMetrics = 0;
error = SFNT_Err_Ok;
}
#endif
}
}
else if ( error == SFNT_Err_Table_Missing )
{
if ( face->format_tag == TTAG_true )
{
FT_TRACE2(( "This is an SFNT Mac font.\n" ));
has_outline = 0;
error = SFNT_Err_Ok;
}
else
{
error = SFNT_Err_Horiz_Header_Missing;
#ifdef FT_CONFIG_OPTION_INCREMENTAL
if ( face->root.internal->incremental_interface &&
face->root.internal->incremental_interface->funcs->
get_glyph_metrics )
{
face->horizontal.number_Of_HMetrics = 0;
error = SFNT_Err_Ok;
}
#endif
}
}
if ( error )
goto Exit;
LOADM_( hhea, 1 );
if ( !error )
{
LOADM_( hmtx, 1 );
if ( !error )
face->vertical_info = 1;
}
if ( error && error != SFNT_Err_Table_Missing )
goto Exit;
LOAD_( os2 );
if ( error )
{
face->os2.version = 0xFFFFU;
}
}
if ( sfnt->load_eblc )
{
LOAD_( eblc );
if ( error )
{
if ( error == SFNT_Err_Table_Missing )
error = SFNT_Err_Ok;
else
goto Exit;
}
}
LOAD_( pclt );
if ( error )
{
if ( error != SFNT_Err_Table_Missing )
goto Exit;
face->pclt.Version = 0;
}
LOAD_( gasp );
LOAD_( kern );
face->root.num_glyphs = face->max_profile.numGlyphs;
face->root.family_name = NULL;
face->root.style_name = NULL;
if ( face->os2.version != 0xFFFFU && face->os2.fsSelection & 256 )
{
if ( !ignore_preferred_family )
GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
GET_NAME( FONT_FAMILY, &face->root.family_name );
if ( !ignore_preferred_subfamily )
GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
}
else
{
GET_NAME( WWS_FAMILY, &face->root.family_name );
if ( !face->root.family_name && !ignore_preferred_family )
GET_NAME( PREFERRED_FAMILY, &face->root.family_name );
if ( !face->root.family_name )
GET_NAME( FONT_FAMILY, &face->root.family_name );
GET_NAME( WWS_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name && !ignore_preferred_subfamily )
GET_NAME( PREFERRED_SUBFAMILY, &face->root.style_name );
if ( !face->root.style_name )
GET_NAME( FONT_SUBFAMILY, &face->root.style_name );
}
{
FT_Face root = &face->root;
FT_Long flags = root->face_flags;
if ( has_outline == TRUE )
flags |= FT_FACE_FLAG_SCALABLE;
flags |= FT_FACE_FLAG_SFNT |
FT_FACE_FLAG_HORIZONTAL;
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
if ( psnames_error == SFNT_Err_Ok &&
face->postscript.FormatType != 0x00030000L )
flags |= FT_FACE_FLAG_GLYPH_NAMES;
#endif
if ( face->postscript.isFixedPitch )
flags |= FT_FACE_FLAG_FIXED_WIDTH;
if ( face->vertical_info )
flags |= FT_FACE_FLAG_VERTICAL;
if ( TT_FACE_HAS_KERNING( face ) )
flags |= FT_FACE_FLAG_KERNING;
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
if ( tt_face_lookup_table( face, TTAG_glyf ) != 0 &&
tt_face_lookup_table( face, TTAG_fvar ) != 0 &&
tt_face_lookup_table( face, TTAG_gvar ) != 0 )
flags |= FT_FACE_FLAG_MULTIPLE_MASTERS;
#endif
root->face_flags = flags;
flags = 0;
if ( has_outline == TRUE && face->os2.version != 0xFFFFU )
{
if ( face->os2.fsSelection & 512 )
flags |= FT_STYLE_FLAG_ITALIC;
else if ( face->os2.fsSelection & 1 )
flags |= FT_STYLE_FLAG_ITALIC;
if ( face->os2.fsSelection & 32 )
flags |= FT_STYLE_FLAG_BOLD;
}
else
{
if ( face->header.Mac_Style & 1 )
flags |= FT_STYLE_FLAG_BOLD;
if ( face->header.Mac_Style & 2 )
flags |= FT_STYLE_FLAG_ITALIC;
}
root->style_flags = flags;
tt_face_build_cmaps( face );
{
FT_Int m;
for ( m = 0; m < root->num_charmaps; m++ )
{
FT_CharMap charmap = root->charmaps[m];
charmap->encoding = sfnt_find_encoding( charmap->platform_id,
charmap->encoding_id );
#if 0
if ( root->charmap == NULL &&
charmap->encoding == FT_ENCODING_UNICODE )
{
root->charmap = charmap;
}
#endif
}
}
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
{
FT_UInt i, count;
#ifndef FT_CONFIG_OPTION_OLD_INTERNALS
count = face->sbit_num_strikes;
#else
count = (FT_UInt)face->num_sbit_strikes;
#endif
if ( count > 0 )
{
FT_Memory memory = face->root.stream->memory;
FT_UShort em_size = face->header.Units_Per_EM;
FT_Short avgwidth = face->os2.xAvgCharWidth;
FT_Size_Metrics metrics;
if ( em_size == 0 || face->os2.version == 0xFFFFU )
{
avgwidth = 0;
em_size = 1;
}
if ( FT_NEW_ARRAY( root->available_sizes, count ) )
goto Exit;
for ( i = 0; i < count; i++ )
{
FT_Bitmap_Size* bsize = root->available_sizes + i;
error = sfnt->load_strike_metrics( face, i, &metrics );
if ( error )
goto Exit;
bsize->height = (FT_Short)( metrics.height >> 6 );
bsize->width = (FT_Short)(
( avgwidth * metrics.x_ppem + em_size / 2 ) / em_size );
bsize->x_ppem = metrics.x_ppem << 6;
bsize->y_ppem = metrics.y_ppem << 6;
bsize->size = metrics.y_ppem << 6;
}
root->face_flags |= FT_FACE_FLAG_FIXED_SIZES;
root->num_fixed_sizes = (FT_Int)count;
}
}
#endif
if ( !FT_HAS_FIXED_SIZES( root ) && !FT_IS_SCALABLE( root ) )
root->face_flags |= FT_FACE_FLAG_SCALABLE;
if ( FT_IS_SCALABLE( root ) )
{
root->bbox.xMin = face->header.xMin;
root->bbox.yMin = face->header.yMin;
root->bbox.xMax = face->header.xMax;
root->bbox.yMax = face->header.yMax;
root->units_per_EM = face->header.Units_Per_EM;
root->ascender = face->horizontal.Ascender;
root->descender = face->horizontal.Descender;
root->height = (FT_Short)( root->ascender - root->descender +
face->horizontal.Line_Gap );
#if 0
if ( face->horizontal.Line_Gap == 0 )
root->height = (FT_Short)( ( root->height * 115 + 50 ) / 100 );
#endif
#if 0
if ( face->os2.version != 0xFFFFU && root->ascender )
{
FT_Int height;
root->ascender = face->os2.sTypoAscender;
root->descender = -face->os2.sTypoDescender;
height = root->ascender + root->descender + face->os2.sTypoLineGap;
if ( height > root->height )
root->height = height;
}
#endif
root->max_advance_width = face->horizontal.advance_Width_Max;
root->max_advance_height = (FT_Short)( face->vertical_info
? face->vertical.advance_Height_Max
: root->height );
root->underline_position = face->postscript.underlinePosition -
face->postscript.underlineThickness / 2;
root->underline_thickness = face->postscript.underlineThickness;
}
}
Exit:
FT_TRACE2(( "sfnt_load_face: done\n" ));
return error;
}
|
Generated on Tue May 22 2012 06:03:57 for ReactOS by
1.7.6.1
|