//
//  GSFeature.h
//  Glyphs
//
//  Created by Georg Seifert on 9.9.07.
//  Copyright 2007 schriftgestaltung.de. All rights reserved.
//

#import <GlyphsCore/GSBase.h>
#import <GlyphsCore/GSFeaBlock.h>

@class GSSubstitution;
@class GSFont;
@class GSFontMaster;
@class GSInstance;
@class GSInfoValue;
@class GSInfoValueLocalized;

NS_ASSUME_NONNULL_BEGIN

NSString *GSRemoveComments(NSString *code);

FOUNDATION_EXPORT NSErrorUserInfoKey FEAErrorSourceErrors;

/** The class defining the feature object

 This class defines the feature object. It is used to store OpenType features in Adobe FDK syntax
 */
@interface GSFeature : GSFeaBlock <NSCoding, NSCopying> {
	NSInteger _index;
	NSString *_tag;

#pragma GSAutoCodeStart ivars

#pragma GSAutoCodeEnd ivars
}

- (BOOL)isEqualToFeature:(GSFeature *)other;

/** The feature tag.

 e.g: "liga", "smcp", ..
*/
@property (copy, nonatomic) NSString *tag;

#ifndef GLYPHS_LITE
+ (nullable NSString *)applyTokensToString:(NSString *)code key:(nullable NSString *)key name:(nullable NSString *)name forObjects:(NSArray *)objects langTag:(nullable NSString *)langTag error:(NSError **)error;

+ (nullable NSString *)evaluateToken:(NSString *)token forObjects:(NSArray *)objects error:(NSError **)error;

+ (nullable NSString *)evaluatePredicateToken:(NSString *)token font:(GSFont *)font contextLabel:(NSString *)contextLabel error:(NSError **)error;

+ (nullable NSArray<NSString *> *)filterGlyphNamesByPredicateToken:(nonnull NSString *)token font:(nullable GSFont *)font contextLabel:(NSString *)contextLabel error:(NSError **)error;
#endif

+ (NSString *)applyVersionNumber:(NSString *)stringValue objects:(NSArray *)objects;

- (BOOL)isStylisticSet;

+ (BOOL)isStylisticSetTag:(NSString *)tag;

- (nullable NSString *)featureNamesString;

- (BOOL)isCharacterVariant;

/** The full, localized name.

 @return The name
 */
- (NSString *)fullName;

- (void)setSubstitutions:(NSArray<GSSubstitution *> *)substitution;

@property (nonatomic, strong) GSInfoValueLocalized *label;

+ (nullable NSMutableArray<GSInfoValue *> *)importFeatureNames:(NSMutableString *)code error:(NSError **)error;

#pragma GSAutoCodeStart methods

#pragma GSAutoCodeEnd methods

@end

NS_ASSUME_NONNULL_END
