|
|
Definition at line 278 of file cidobjs.c.
{
CID_Face face = (CID_Face)cidface;
FT_Error error;
PSAux_Service psaux;
PSHinter_Service pshinter;
FT_UNUSED( num_params );
FT_UNUSED( params );
FT_UNUSED( stream );
cidface->num_faces = 1;
psaux = (PSAux_Service)face->psaux;
if ( !psaux )
{
psaux = (PSAux_Service)FT_Get_Module_Interface(
FT_FACE_LIBRARY( face ), "psaux" );
face->psaux = psaux;
}
pshinter = (PSHinter_Service)face->pshinter;
if ( !pshinter )
{
pshinter = (PSHinter_Service)FT_Get_Module_Interface(
FT_FACE_LIBRARY( face ), "pshinter" );
face->pshinter = pshinter;
}
if ( FT_STREAM_SEEK( 0 ) )
goto Exit;
error = cid_face_open( face, face_index );
if ( error )
goto Exit;
if ( face_index < 0 )
goto Exit;
if ( face_index != 0 )
{
FT_ERROR(( "cid_face_init: invalid face index\n" ));
error = CID_Err_Invalid_Argument;
goto Exit;
}
{
CID_FaceInfo cid = &face->cid;
PS_FontInfo info = &cid->font_info;
cidface->num_glyphs = cid->cid_count;
cidface->num_charmaps = 0;
cidface->face_index = face_index;
cidface->face_flags = FT_FACE_FLAG_SCALABLE |
FT_FACE_FLAG_HORIZONTAL |
FT_FACE_FLAG_HINTER;
if ( info->is_fixed_pitch )
cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
cidface->family_name = info->family_name;
cidface->style_name = (char *)"Regular";
if ( cidface->family_name )
{
char* full = info->full_name;
char* family = cidface->family_name;
if ( full )
{
while ( *full )
{
if ( *full == *family )
{
family++;
full++;
}
else
{
if ( *full == ' ' || *full == '-' )
full++;
else if ( *family == ' ' || *family == '-' )
family++;
else
{
if ( !*family )
cidface->style_name = full;
break;
}
}
}
}
}
else
{
if ( cid->cid_font_name )
cidface->family_name = cid->cid_font_name;
}
cidface->style_flags = 0;
if ( info->italic_angle )
cidface->style_flags |= FT_STYLE_FLAG_ITALIC;
if ( info->weight )
{
if ( !ft_strcmp( info->weight, "Bold" ) ||
!ft_strcmp( info->weight, "Black" ) )
cidface->style_flags |= FT_STYLE_FLAG_BOLD;
}
cidface->num_fixed_sizes = 0;
cidface->available_sizes = 0;
cidface->bbox.xMin = cid->font_bbox.xMin >> 16;
cidface->bbox.yMin = cid->font_bbox.yMin >> 16;
cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16;
cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16;
if ( !cidface->units_per_EM )
cidface->units_per_EM = 1000;
cidface->ascender = (FT_Short)( cidface->bbox.yMax );
cidface->descender = (FT_Short)( cidface->bbox.yMin );
cidface->height = (FT_Short)( ( cidface->units_per_EM * 12 ) / 10 );
if ( cidface->height < cidface->ascender - cidface->descender )
cidface->height = (FT_Short)( cidface->ascender - cidface->descender );
cidface->underline_position = (FT_Short)info->underline_position;
cidface->underline_thickness = (FT_Short)info->underline_thickness;
}
Exit:
return error;
}
|