FT_Get_Advance( FT_Face face, FT_UInt gindex, FT_Int32 flags, FT_Fixed *padvance ) { FT_Face_GetAdvancesFunc func; if ( !face ) return FT_THROW( Invalid_Face_Handle ); if ( !padvance ) return FT_THROW( Invalid_Argument ); if ( gindex >= (FT_UInt)face->num_glyphs ) return FT_THROW( 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 ( FT_ERR_NEQ( error, 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_THROW( Invalid_Face_Handle ); if ( !padvances ) return FT_THROW( Invalid_Argument ); num = (FT_UInt)face->num_glyphs; end = start + count; if ( start >= num || end < start || end > num ) return FT_THROW( 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 ) return _ft_face_scale_advances( face, padvances, count, flags ); if ( FT_ERR_NEQ( error, Unimplemented_Feature ) ) return error; } error = FT_Err_Ok; if ( flags & FT_ADVANCE_FLAG_FAST_ONLY ) return FT_THROW( Unimplemented_Feature ); flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY; for ( nn = 0; nn < count; nn++ ) { error = FT_Load_Glyph( face, start + nn, flags ); if ( error ) break; /* scale from 26.6 to 16.16 */ padvances[nn] = ( flags & FT_LOAD_VERTICAL_LAYOUT ) ? face->glyph->advance.y << 10 : face->glyph->advance.x << 10; } return error; }
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 ); }