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

Overview

The class defining the glyph object

Properties

baseString

The string the glyph is composed of.

@property (nonatomic, strong, nullable) NSString *baseString

bottomKerningGroupId

The id of the key glyph for bottom kerning.

@property (copy, nonatomic, nullable) NSString *bottomKerningGroupId

Discussion

this sould look like this: @MM_B_Name

category

The category of the glyph

@property (nonatomic, copy, nullable) NSString *category

Discussion

e.g: letter, number, punctuation … this is set from the internal database.

color

The NSColor object of the color label

@property (retain, nonatomic, nullable) NSColor *color

colorIndex

Returns the index of the color label

@property (assign, nonatomic) NSInteger colorIndex

Return Value

0–11, anything else means no label

export

If the glyph will end up in the final font

@property (nonatomic) BOOL export

glyphId

The current index of the glyph

@property (nonatomic) NSUInteger glyphId

id

The glyph key is used to access the glyph.

@property (strong, nonatomic) NSString *id

Discussion

This is used to keep track of the glyph even if is renamed. It is used for the kerning. It could look like this: FBCA074D-FCF3-427E-A700-7E318A949AE5

layers

An array of GSLayer objects.

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

Discussion

It should have at least the same count as font.fontMasters.

The keys are the id of the font masters and should be the same as the GSLayer.associatedMasterId if the layer that is associated by the key. For ‘master layers’, it should also be equal to the GSLayer.layerId.

leftKerningGroup

The name of the kerning group for left side kerning.

@property (copy, nonatomic, nullable) NSString *leftKerningGroup

leftKerningGroupId

The id of the keyglyph for left side kerning.

@property (copy, nonatomic, nullable) NSString *leftKerningGroupId

Discussion

this sould look like this: @MM_L_Name

leftMetricsKey

The glyphname of the keyglyph for LSB.

@property (copy, nonatomic, nullable) NSString *leftMetricsKey

name

The glyphs name

@property (nonatomic, copy, nullable) NSString *name

note

The glyphs note

@property (nonatomic, copy, nullable) NSString *note

parent

A pointer to the containing GSFont object

@property (weak, nonatomic, nullable) GSFont *parent

partsSettings

Defines the parameters for Smart Glyphs.

@property (strong, nonatomic, nullable) NSMutableArray<GSPartProperty*> *partsSettings

Discussion

It contains an array of GSPartProperty objects.

rightKerningGroup

The name of the kerning group for right side kerning.

@property (copy, nonatomic, nullable) NSString *rightKerningGroup

rightKerningGroupId

The id of the key glyph for right side kerning.

@property (copy, nonatomic, nullable) NSString *rightKerningGroupId

Discussion

this sould look like this: @MM_R_Name

rightMetricsKey

The glyphname of the keyglyph for RSB.

@property (copy, nonatomic, nullable) NSString *rightMetricsKey

script

The language/script of the glyph.

@property (nonatomic, copy, nullable) NSString *script

Discussion

e.g: latin, cyrillic, greek This is set from the internal database.

sortName

The names is used for sorting.

@property (strong, nonatomic, nullable) NSString *sortName

Discussion

If set it will be used for sorting inside of

storeDirection

the writing direction

@property (nonatomic) BOOL storeDirection

storeProduction

@property (nonatomic) BOOL storeProduction

subCategory

The sub category of the glyph

@property (nonatomic, copy, nullable) NSString *subCategory

Discussion

e.g: lower case, smallcaps … this is set from the internal database.

tags

The tags.

@property (nonatomic, copy) NSOrderedSet<NSString*> *tags

tagsArray

helper to make bindings simpler

@property (nonatomic, copy) NSArray<NSString*> *tagsArray

topKerningGroupId

The id of the key glyph for top kerning.

@property (copy, nonatomic, nullable) NSString *topKerningGroupId

Discussion

this sould look like this: @MM_T_Name

undoManager

The glyphs undoManager

@property (strong, nonatomic, nullable) NSUndoManager *undoManager

Return Value

a NSUndoManager object

Discussion

Each GSGlyph object has its own undoManager

See Also

  • [GSFont undoManager]

unicode

The unicode value of the glyph. This is normaly set automaticaly on setting the name

@property (nonatomic, copy, nullable) NSString *unicode

unicodeChar

A character code of the glyph of 0 if it has no unicode

@property (nonatomic, readonly) UTF32Char unicodeChar

Instance Methods

addTag:

Adds the tag

- (void)addTag:(NSString *)tag

Parameters

tag

the object to be added

countOfLayers

The number of layers in the glyph

- (NSUInteger)countOfLayers

Return Value

The number of layers

countOfTags

The number of tags

- (NSUInteger)countOfTags

hasCustomGlyphInfo

if it has manually set info (see: storeScript …)

- (BOOL)hasCustomGlyphInfo

hasSpecialLayers

If the glyph has brace or bracket layers

- (BOOL)hasSpecialLayers

indexOfObjectInTags:

Returns the index of tag in tags

- (NSUInteger)indexOfObjectInTags:(NSString *)tag

Parameters

tag

the object

Return Value

the index of the object

initWithDict:format:

initialises a glyph with a dictionary loaded from a pList.

- (instancetype)initWithDict:(NSDictionary *)glyphDict format:(GSFormatVersion)formatVersion

Parameters

glyphDict

A dictionary

interpolate:keepSmart:error:

Generates an interpolated layer

- (GSLayer *)interpolate:(GSInstance *)instance keepSmart:(BOOL)keepSmart error:(NSError **)error

Parameters

instance

The instance that defines the interpolation values

keepSmart

If smart components sould be decomposed before interpolation.

error

if there is a problem, it returns an NSError object (by reference) that contains details.

Return Value

The intepolated layer, or nil if something went wrong.

isAppleColorGlyph

If the glyph has Apple color glyph information

- (BOOL)isAppleColorGlyph

isColorGlyph

If the glyph has MS color glyph information

- (BOOL)isColorGlyph

isSmartGlyph

If it is a smart glyph

- (BOOL)isSmartGlyph

layerForId:

Returns the a layer loacated at a Index.

- (nullable GSLayer *)layerForId:(nonnull NSString *)key

Parameters

key

The Id of the layer

Return Value

A GSLayer object or nil if not found

mastersCompatible

Returns if the glyphs has compatibel outlines.

- (BOOL)mastersCompatible

Return Value

YES if the layers have compatible outlines.

mastersCompatibleForLayerIds:

Returns if the glyphs has compatibel outlines in the layers for all FontMasterIds

- (BOOL)mastersCompatibleForLayerIds:(NSArray *)fontMasterIds

Parameters

fontMasterIds

the Master IDs

Return Value

YES if the layers have compatible outlines.

objectInTagsAtIndex:

Returns object at index in tags

- (nullable NSString *)objectInTagsAtIndex:(NSUInteger)index

Parameters

index

The index

Return Value

the object at index

outlineHasChanges

Is called from other object after changing some of the glyphs properties.

- (void)outlineHasChanges

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.

removeLayerForId:

Removes the Layer for the key.

- (void)removeLayerForId:(id)key

Parameters

key

The layer key.

removeObjectFromTags:

Removes the tag

- (void)removeObjectFromTags:(NSString *)tag

Parameters

tag

the object to be removed

removeObjectFromTagsAtIndex:

Removes the tag at index

- (void)removeObjectFromTagsAtIndex:(NSUInteger)index

Parameters

index

The index

replaceLayersWithInterpolation:

Replaces the content of the layers with an interpolation from the remaining layers.

- (void)replaceLayersWithInterpolation:(NSArray<GSLayer*> *)layers

Parameters

layers

The layers that should be recalculated

Discussion

This is useful for ‘brace’ layers but also for a default state for middle masters.

saveToFile:format:doLastChange:error:

saves the object to file

- (BOOL)saveToFile:(FILE *)file format:(GSFormatVersion)formatVersion doLastChange:(BOOL)saveLastChange error:(NSError **)error

Parameters

file

a File

formatVersion

An integer indicating the file format version.

saveLastChange

Disable the ‘lastChange’ entry in the file

error

on return an error containig the reason for failiour

Return Value

YES if sucsessful

Discussion

saves the object to file

setLayer:forId:

Adds the Layer with the key.

- (void)setLayer:(GSLayer *)layer forId:(id)key

Parameters

layer

The GSLayer object.

key

The layer key. For master layers this is the id of the corresponding GSFontMaster.

Discussion

If the Key is a id of a GSFontMaster, it will be a masterlayer, otherwise the associated master ID of the layer should be set to a ID of a master.