Inherits from NSObject
Conforms to GSContainerProtocol
GSUserDataProtocol
NSCoding
NSCopying
Declared in GSInstance.h

Overview

The class defining the instance object

Properties

customParameters

The customParameters. A list of customParameters objects

@property (nonatomic, strong) NSMutableArray<GSCustomParameter*> *customParameters

exports

If it should be exported.

@property (nonatomic) BOOL exports

font

reference to the containing font

@property (unsafe_unretained, nonatomic) GSFont *font

instanceInterpolations

A dict that contains the interpolation coefficents for each master.

@property (strong, nonatomic) NSDictionary *instanceInterpolations

Discussion

This is automatically updated if you change interpolationWeight, interpolationWidth, interpolationCustom. It contains FontMaster IDs as keys and coeffients for that master as values.

Or, you can set it manually if you set manualInterpolation to true. There is no UI for this, so you need to do that with a script.

interpolationCustom

The interpolation Cutom position

@property (nonatomic) float interpolationCustom

interpolationCustom1

The interpolation Cutom position

@property (nonatomic) float interpolationCustom1

interpolationCustom2

The interpolation Cutom position

@property (nonatomic) float interpolationCustom2

interpolationWeight

The interpolation Weight position.

@property (nonatomic) float interpolationWeight

interpolationWidth

The interpolation Width position

@property (nonatomic) float interpolationWidth

isBold

the Style linking Bold bit

@property (nonatomic) BOOL isBold

isItalic

the Style linking Italic bit

@property (nonatomic) BOOL isItalic

linkStyle

The style to use as a the regular for this style.

@property (copy, nonatomic) NSString *linkStyle

Discussion

if styleName is Medium, you could link to Light. So this instance becomes the Bold stil for the Light.

manualInterpolation

Disables automatic calculation of instanceInterpolations

@property (nonatomic) BOOL manualInterpolation

Discussion

This allowes to manually setting instanceInterpolations.

name

The Instances name

@property (nonatomic, strong) NSString *name

Discussion

This is used as the style name.

properties

The properties.

@property (nonatomic, strong) NSMutableArray<GSFontInfoProperty*> *properties

tempData

a dictionary that stores data. It will not be written to disk.

@property (nonatomic, strong, nullable) NSDictionary *tempData

visible

If it instance is visible in Preview > Show All instances

@property (nonatomic) BOOL visible

weightClassUI

Weight Class

@property (readonly, nonatomic) NSString *weightClassUI

Discussion

e.g. Regular or Bold

weightClassValue

returns the actual value as set by the weightClass or custom parameter “weightClass”

@property (nonatomic) uint16_t weightClassValue

widthClassUI

Width Class

@property (strong, nonatomic) NSString *widthClassUI

Discussion

e.g. Medium (normal)

widthClassValue

returns the actual value as set by the widthClass

@property (nonatomic) uint16_t widthClassValue

Instance Methods

addProperty:

Adds the property

- (void)addProperty:(GSFontInfoProperty *)property

Parameters

property

the object to be added

countOfCustomParameters

The count of customParameters

- (NSUInteger)countOfCustomParameters

countOfProperties

The number of properties

- (NSUInteger)countOfProperties

customParameterForKey:

The customParameters where name == Key

- (GSCustomParameter *)customParameterForKey:(NSString *)key

customValueForKey:

The value of the customParameters where name == Key

- (id)customValueForKey:(NSString *)key

indexOfObjectInProperties:

Returns the index of property in properties

- (NSUInteger)indexOfObjectInProperties:(GSFontInfoProperty *)property

Parameters

property

the object

Return Value

the index of the object

insertObject:inPropertiesAtIndex:

Inserts the property at index into properties

- (void)insertObject:(GSFontInfoProperty *)property inPropertiesAtIndex:(NSUInteger)idx

Parameters

property

The object to insert

idx

The index

instanceInterpolations:axes:

Calculates the coefficients for the given masters

- (NSDictionary *)instanceInterpolations:(NSArray *)masters axes:(NSArray<GSAxis*> *)axes

Parameters

masters

A list of GSFontMaster objects

axes

the font axes

Return Value

a dict of FontMaster IDs as keys and coeffients as values.

Discussion

This is used to automatically calculate the instanceInterpolations

objectInPropertiesAtIndex:

Returns object at idx in properties

- (GSFontInfoProperty *)objectInPropertiesAtIndex:(NSUInteger)idx

Parameters

idx

The index

Return Value

the object at index

propertyListValueFormat:

Returns the content of the object to store it in pList.

- (NSDictionary *)propertyListValueFormat:(GSFormatVersion)format

Parameters

format

the version of the dict

Discussion

This is used to store the data in the .glyphs file.

removeObjectFromCustomParametersForKey:

Removes the first paramter with then Name

- (void)removeObjectFromCustomParametersForKey:(NSString *)key

Parameters

key

The name

removeObjectFromProperties:

Removes the property

- (void)removeObjectFromProperties:(GSFontInfoProperty *)property

Parameters

property

the object to be removed

removeObjectFromPropertiesAtIndex:

Removes the property at idx

- (void)removeObjectFromPropertiesAtIndex:(NSUInteger)idx

Parameters

idx

The index

scaleBy:

Scales the instance object.

- (void)scaleBy:(CGFloat)scale

Parameters

scale

Scale value

setCustomValue:forKey:

Set the value for key

- (void)setCustomValue:(id)value forKey:(NSString *)key

Parameters

value

The value to add

key

The name of the paramter

Discussion

It will look for an existing paramter with the name an overwrite its value, or adds a new parameter

setProperty:value:languageTag:

Adds a new font info value to the array specified by key or updates an existing one.

- (void)setProperty:(NSString *)name value:(NSString *)value languageTag:(nullable NSString *)languageTag

Parameters

name

The key whose plural form specifies an array property of GSFontInfoValue objects on the receiver.

value

The actual value to be added.

languageTag

The language under which the the value should be stored. Defaults to English if nil is passed.

setTempData:forKey:

Adds key/value to tempData. Pass nil as value to remove previous set data

- (void)setTempData:(nullable id)value forKey:(nonnull NSString *)key

Parameters

value

and object or nil

key

the key

tempDataForKey:

return value for key in tempData

- (nullable id)tempDataForKey:(nonnull NSString *)key

Parameters

key

the key

Return Value

a value or nil

updateInterpolationValues

Call it if you have made changes to the instance to force an update of instanceInterpolations.

- (void)updateInterpolationValues