//
//  CFFGlobalSubrsIndex.h
//  GSFontTools
//
//  Created by Georg Seifert on 01.08.11.
//  Copyright 2011 schriftgestaltung.de. All rights reserved.
//

#import <GSFontTools/CFFIndex.h>

@class CFFPrivateDict;
@class CFFFDArrayIndex;
@class CFFFDSelect;

NS_ASSUME_NONNULL_BEGIN

/// This index contains all the global subroutines in the font. A global
/// subroutine is a set of `CharString` data which is accessible to any
/// glyph in the font, and are used to store repeated instructions - for
/// example, components may be encoded as global subroutines, but so could
/// hinting instructions.
@interface CFFGlobalSubrsIndex : CFFIndex

@property (nonatomic, retain) CFFGlobalSubrsIndex *globalSubrs;

/// Calculates the “subr number bias” according to the CFF2 specification, section 9, “Local and Global Subr INDEXes”.
@property (nonatomic, readonly) int bias;

- (instancetype)initWithFile:(nullable GSFileData *)file
	   globalSubrs:(nullable CFFGlobalSubrsIndex *)globalSubrs
	   privateDict:(nullable CFFPrivateDict *)privateDict
		  fdSelect:(nullable CFFFDSelect *)fdSelect
		   fdArray:(nullable CFFFDArrayIndex *)fdArray
		   version:(CFFVersion)version;

- (int)selectorAtIndex:(NSUInteger)aIndex;

@end

NS_ASSUME_NONNULL_END
