FT_Get_Advance( FT_Face face, FT_UInt gindex, FT_Int32 flags, FT_Fixed *padvance ) { FT_Face_GetAdvancesFunc func; if ( !face ) return FT_Err_Invalid_Face_Handle; if ( gindex >= (FT_UInt)face->num_glyphs ) return FT_Err_Invalid_Glyph_Index; func = face->driver->clazz->get_advances; if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) ) { FT_Error error; error = func( face, gindex, 1, flags, padvance ); if ( !error ) return _ft_face_scale_advances( face, padvance, 1, flags ); if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) return error; } return FT_Get_Advances( face, gindex, 1, flags, padvance ); }
FT_Get_Advances( FT_Face face, FT_UInt start, FT_UInt count, FT_Int32 flags, FT_Fixed *padvances ) { FT_Face_GetAdvancesFunc func; FT_UInt num, end, nn; FT_Error error = FT_Err_Ok; if ( !face ) return FT_Err_Invalid_Face_Handle; num = (FT_UInt)face->num_glyphs; end = start + count; if ( start >= num || end < start || end > num ) return FT_Err_Invalid_Glyph_Index; if ( count == 0 ) return FT_Err_Ok; func = face->driver->clazz->get_advances; if ( func && LOAD_ADVANCE_FAST_CHECK( flags ) ) { error = func( face, start, count, flags, padvances ); if ( !error ) goto Exit; if ( error != FT_ERROR_BASE( FT_Err_Unimplemented_Feature ) ) return error; } error = FT_Err_Ok; if ( flags & FT_ADVANCE_FLAG_FAST_ONLY ) return FT_Err_Unimplemented_Feature; flags |= FT_LOAD_ADVANCE_ONLY; for ( nn = 0; nn < count; nn++ ) { error = FT_Load_Glyph( face, start + nn, flags ); if ( error ) break; padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) ? face->glyph->advance.x : face->glyph->advance.y; } if ( error ) return error; Exit: return _ft_face_scale_advances( face, padvances, count, flags ); }
FT_Outline_Render( FT_Library library, FT_Outline* outline, FT_Raster_Params* params ) { FT_Error error; FT_Bool update = 0; FT_Renderer renderer; FT_ListNode node; if ( !library ) return FT_Err_Invalid_Library_Handle; if ( !outline || !params ) return FT_Err_Invalid_Argument; renderer = library->cur_renderer; node = library->renderers.head; params->source = (void*)outline; error = FT_Err_Cannot_Render_Glyph; while ( renderer ) { error = renderer->raster_render( renderer->raster, params ); if ( !error || FT_ERROR_BASE( error ) != FT_Err_Cannot_Render_Glyph ) break; /* FT_Err_Cannot_Render_Glyph is returned if the render mode */ /* is unsupported by the current renderer for this glyph image */ /* format */ /* now, look for another renderer that supports the same */ /* format */ renderer = FT_Lookup_Renderer( library, FT_GLYPH_FORMAT_OUTLINE, &node ); update = 1; } /* if we changed the current renderer for the glyph image format */ /* we need to select it as the next current one */ if ( !error && update && renderer ) FT_Set_Renderer( library, renderer, 0, 0 ); return error; }
PCF_Face_Init( FT_Stream stream, FT_Face pcfface, /* PCF_Face */ FT_Int face_index, FT_Int num_params, FT_Parameter* params ) { PCF_Face face = (PCF_Face)pcfface; FT_Error error = PCF_Err_Ok; FT_UNUSED( num_params ); FT_UNUSED( params ); FT_UNUSED( face_index ); error = pcf_load_font( stream, face ); if ( error ) { FT_Error error2; PCF_Face_Done( pcfface ); /* this didn't work, try gzip support! */ error2 = FT_Stream_OpenGzip( &face->gzip_stream, stream ); if ( FT_ERROR_BASE( error2 ) == FT_Err_Unimplemented_Feature ) goto Fail; error = error2; if ( error ) #ifdef FT_CONFIG_OPTION_USE_LZW { FT_Error error3; /* this didn't work, try LZW support! */ error3 = FT_Stream_OpenLZW( &face->gzip_stream, stream ); if ( FT_ERROR_BASE( error3 ) == FT_Err_Unimplemented_Feature ) goto Fail; error = error3; if ( error ) goto Fail; face->gzip_source = stream; pcfface->stream = &face->gzip_stream; stream = pcfface->stream; error = pcf_load_font( stream, face ); if ( error ) goto Fail; } #else goto Fail; #endif else { face->gzip_source = stream; pcfface->stream = &face->gzip_stream; stream = pcfface->stream; error = pcf_load_font( stream, face ); if ( error ) goto Fail; } }