GSGlyph Class Reference
Inherits from | NSObject |
Conforms to | NSCoding NSCopying |
Tasks
Properties
-
parent
property -
name
property -
unicode
property -
unicodeChar
property -
note
property -
script
property -
category
property -
subCategory
property -
storeProduction
property -
baseGlyphs
property -
glyphDict
property -
leftMetricsKey
property -
rightMetricsKey
property -
leftKerningGroup
property -
rightKerningGroup
property -
leftKerningGroupId
property -
rightKerningGroupId
property -
topKerningGroupId
property -
bottomKerningGroupId
property -
export
property -
color
property -
colorIndex
property -
userData
property -
undoManager
property -
id
property -
sortName
property -
partsSettings
property -
– initWithGlyphDict:
-
– saveToFile:compact:doLastChange:error:
Layers
Properties
baseGlyphs
The glyphs the glyph is composed of.
@property (nonatomic, strong, nullable) NSArray<GSGlyphInfo*> *baseGlyphs
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.
colorIndex
Returns the index of the color label
@property (assign, nonatomic) NSInteger colorIndex
Return Value
0–11, anything else means no label
glyphDict
The content of the glyph as dictionary to store it in a pList.
@property (unsafe_unretained, readonly) NSDictionary *glyphDict
Discussion
This is used to store the data in the .glyphs file.
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) NSDictionary *layers
Discussion
It should have at least the same count than 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
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 *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
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.
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
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
userData
Place to store custom data. Here it is possible to store something. Please use a unique key. The objects should be able to serialize to a plist. If they are not, they should return all infos to store in description (as String).
@property (nonatomic, strong, nullable) NSMutableDictionary *userData
Instance Methods
countOfLayers
The number of layers in the glyph
- (NSUInteger)countOfLayers
Return Value
The number of layers
initWithGlyphDict:
initialises a glyph with a dictionary loaded from a pList.
- (instancetype)initWithGlyphDict:(NSDictionary *)glyphDict
Parameters
- glyphDict
A dictionary
interpolate:keepSmart:error:
Generates an interpolated layer
- (GSLayer *)interpolate:(GSInstance *)instance keepSmart:(BOOL)keepSmart error:(NSError *__autoreleasing *)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 returnes an NSError object (by reference) that contains details.
Return Value
The intepolated layer, or nil if something went wrong.
layerForKey:
Returns the a layer loacated at a Index.
- (GSLayer *_Nullable)layerForKey:(NSString *_Nonnull)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.
outlineHasChanges
Is called from other object after changing some of the glyphs properties.
- (void)outlineHasChanges
removeLayerForKey:
Removes the Layer for the key.
- (void)removeLayerForKey:(id)Key
Parameters
- Key
The layer key.
replaceLayerWithInterpolation:
Replaces the content of the Layer with an interpolation from the remaining layers.
- (void)replaceLayerWithInterpolation:(GSLayer *)Layer
Parameters
- Layer
The Layer that should be recalculated
Discussion
This is useful for ‘brace’ layers but also for a default state for middle masters.
saveToFile:compact:doLastChange:error:
@discussionsaves the object to file
- (BOOL)saveToFile:(FILE *)File compact:(BOOL)Compact doLastChange:(BOOL)saveLastChange error:(NSError *__autoreleasing *)error
Parameters
- File
a File
- Compact
a bool indecating if it should use a more compact file format
- saveLastChange
Disable the ‘lastChange’ entry in the file
- error
on return an error containig the reason for failiour
Return Value
YES if sucsessful
setLayer:forKey:
Adds the Layer with the key.
- (void)setLayer:(GSLayer *)Layer forKey:(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.