### GSFontMaster Instance Methods (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFontMaster Provides instance methods for the GSFontMaster class, including adding guides and properties, counting custom parameters and guides, retrieving custom parameters by key, and disabling interface updates. Some methods are for initialization or managing collections. ```objc - (void)addGuide:(GSGuide *)_guide_ - (void)addProperty:(GSFontInfoProperty *)_property_ - (NSUInteger)countOfCustomParameters - (NSUInteger)countOfGuides - (NSUInteger)countOfProperties - (GSCustomParameter *)customParameterForKey:(NSString *)_key_ - (id)customValueForKey:(NSString *)_key_ - (void)disableUpdateInterface ``` -------------------------------- ### insertObject:inGuidesAtIndex: Source: https://docu.glyphsapp.com/Core/Classes/GSFontMaster Inserts a guide object at a specified index in the guides array. ```APIDOC ## insertObject:inGuidesAtIndex: ### Description Inserts a guide object at a specified index in the guides array. ### Method `void` ### Endpoint `insertObject:inGuidesAtIndex:` ### Parameters #### Path Parameters - **_guide** (GSGuide) - Required - The guide object to insert. - **_idx** (NSUInteger) - Required - The index at which to insert the guide. ``` -------------------------------- ### Objective-C: Load Plugin Method Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsFileFormat The `-loadPlugin` method is called to perform main initializations when the plugin is loaded. This is where any setup required for the plugin's functionality should occur. ```objective-c - (void)loadPlugin; /** do main initialisations */ ``` -------------------------------- ### indexOfObjectInGuides Source: https://docu.glyphsapp.com/Core/Classes/GSFontMaster Returns the index of a specified guide in the guides array. ```APIDOC ## indexOfObjectInGuides ### Description Returns the index of a specified guide in the guides array. ### Method `NSUInteger` ### Endpoint `indexOfObjectInGuides:` ### Parameters #### Path Parameters - **_guide** (GSGuide) - Required - The guide object to find the index of. ### Return Value the index of the object ``` -------------------------------- ### Get Guide Object by Index (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSLayer Returns a GSGuide object located at a specific index within the guides array. The index must be within the bounds of the array. ```objective-c - (nullable GSGuide *)objectInGuidesAtIndex:(NSUInteger)_index_ ``` -------------------------------- ### GET /api/annotation/properties Source: https://docu.glyphsapp.com/Core/Classes/GSAnnotation Retrieves the properties of the GSAnnotation object. This endpoint lists the available properties and their descriptions. ```APIDOC ## GET /api/annotation/properties ### Description Retrieves the properties of the GSAnnotation object. This endpoint lists the available properties and their descriptions. ### Method GET ### Endpoint /api/annotation/properties ### Parameters #### Path Parameters #### Query Parameters #### Request Body ### Request Example ### Response #### Success Response (200) - **angle** (CGFloat) - The angle of the element. #### Discussion Only available for GSAnnotationTypeArrow - **text** (NSString*) - The Text. #### Discussion Only available if type is GSAnnotationTypeText - **type** (GSAnnotationType) - The type of the annotaion #### Response Example { "angle": 45.0, "text": "Annotation Text", "type": "GSAnnotationTypeArrow" } ``` -------------------------------- ### Objective-C: Standardize Glyph Name Source: https://docu.glyphsapp.com/Core/Classes/GSGlyphsInfo Converts a given glyph name into a standardized format (nice name). For example, it can convert 'afii10017' to 'A-cy'. ```objective-c - (NSString *)niceGlyphNameForName:(NSString *)_name_ ``` -------------------------------- ### removeObjectFromGuidesAtIndex: Source: https://docu.glyphsapp.com/Core/Classes/GSFontMaster Removes a guide object at a specified index from the guides array. ```APIDOC ## removeObjectFromGuidesAtIndex: ### Description Removes a guide object at a specified index from the guides array. ### Method `void` ### Endpoint `removeObjectFromGuidesAtIndex:` ### Parameters #### Path Parameters - **_idx** (NSUInteger) - Required - The index of the guide to remove. ``` -------------------------------- ### makeNodeFirst Method in Objective-C Source: https://docu.glyphsapp.com/Core/Classes/GSNode Repositions the current node to be the first node in its parent path. This is useful for defining starting points in path traversal and drawing operations. ```objective-c - (void)makeNodeFirst; ``` -------------------------------- ### Get Feature Code Generator Title (Objective-C) Source: https://docu.glyphsapp.com/Core/Protocols/GSFeatureCodeGeneratorProtocol Returns the user-facing title for the code generator, which might be localized. This is a required class method. ```Objective-C + (NSString *)title ``` -------------------------------- ### Get Selected Objects Dictionary (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSLayer Returns a dictionary containing the element dictionaries of all currently selected elements. This method does not take any parameters. ```objective-c - (NSDictionary *)selectedObjects ``` -------------------------------- ### Objective-C: Get Index of Property Source: https://docu.glyphsapp.com/Core/Classes/GSFont Returns the index of a given GSFontInfoProperty object within the font's properties list. Returns the index if found. ```objc - (NSUInteger)indexOfObjectInProperties:(GSFontInfoProperty *)_property_ ``` -------------------------------- ### Objective-C: Get Glyph Names by Wildcard/Query Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a list of glyph names that match a given wildcard pattern or query. Returns nil and an NSError if an error occurs during the search. ```objc - (nullable NSArray *)glyphNamesForWildcard:(NSString *)_query_ error:(NSError *__autoreleasing *)_error_ ``` -------------------------------- ### Get Feature by Tag (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSFeature object using its tag (e.g., 'smcp'). Returns nil if no feature matches the provided tag. ```objectivec - (nullable GSFeature *)featureForTag:(NSString *)_tag_ ``` -------------------------------- ### scaleBy: Source: https://docu.glyphsapp.com/Core/Classes/GSFontMaster Scales the Font Master's vertical metrics, alignment zones, and guide lines by a specified factor. ```APIDOC ## scaleBy: ### Description Scales the Font Master's vertical metrics, alignment zones, and guide lines by a specified factor. ### Method `void` ### Endpoint `scaleBy:` ### Parameters #### Path Parameters - **_scale** (CGFloat) - Required - The scale factor (1 means no scaling). ``` -------------------------------- ### GET /websites/docu_glyphsapp/point Source: https://docu.glyphsapp.com/Core/Protocols/GSGlyphEditViewProtocol Retrieves the index of the layer whose bounding box contains a given point. This is useful for interactive elements where users click on specific areas. ```APIDOC ## GET /websites/docu_glyphsapp/point ### Description This endpoint returns the index of a layer based on a provided point's graphical position. It helps identify which layer is under a specific coordinate in the view. ### Method GET ### Endpoint /websites/docu_glyphsapp/point ### Parameters #### Query Parameters - **point** (string) - Required - The graphical position to check, in view coordinates (e.g., "x,y"). ### Request Example GET /websites/docu_glyphsapp/point?point=100,200 ### Response #### Success Response (200) - **index** (integer) - The index of the layer whose bounding box contains the point. #### Response Example { "index": 5 } ``` -------------------------------- ### Objective-C: Get List of Glyph Names Source: https://docu.glyphsapp.com/Core/Classes/GSFont Returns an array containing the names of all glyphs present in the font. This provides a simple way to access the available glyph identifiers. ```objc - (NSArray *)glyphNames ``` -------------------------------- ### Objective-C: Get Lowercase Glyph Name Source: https://docu.glyphsapp.com/Core/Classes/GSGlyphsInfo Provides the lowercase equivalent of a given glyph name. While often equivalent to `[name lowercaseString]`, it handles specific exceptions like 'A' to 'a'. ```objective-c - (NSString *)lowerCaseName:(NSString *)_name_ ``` -------------------------------- ### Path Manipulation Methods in GSPenProtocol.h Source: https://docu.glyphsapp.com/Core/Protocols/GSPenProtocol This section covers methods for managing vector paths. It includes starting new paths, drawing lines and curves, closing paths, and ending paths. These methods are fundamental for defining shapes in a graphics context. They operate on an implicit path object managed by the protocol. ```Objective-C - (void)beginPath ``` ```Objective-C - (void)closePath ``` ```Objective-C - (void)curveTo:(NSPoint)_pt_ off1:(NSPoint)_off1_ off2:(NSPoint)_off2_ ``` ```Objective-C - (void)endPath ``` ```Objective-C - (void)lineTo:(NSPoint)_pt_ ``` ```Objective-C - (void)moveTo:(NSPoint)_pt_ ``` ```Objective-C - (void)qCurveTo:(FTPointArray *)_points_ ``` -------------------------------- ### NSDictionary Serialization for GSPartProperty Properties in Objective-C Source: https://docu.glyphsapp.com/Core/Classes/GSPartProperty This snippet demonstrates the NSDictionary format for GSPartProperty's property list, used in initWithDict: and propertyList methods. It contains keys for bottomValue, name, and topValue with integer and string values. The example assumes a 'Width' property with range 40-100; note that bottomName and topName properties exist but are marked as unused. ```objective-c { bottomValue = 40; name = Width; topValue = 100; } ``` -------------------------------- ### Get node at index (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSPath Returns GSNode at specified index. Handles overflow/underflow (e.g., -1 returns last node). Takes NSInteger index parameter. ```Objective-C - (GSNode *_Nullable)nodeAtIndex:(NSInteger)_index_ ``` -------------------------------- ### GlyphsToolAuxiliaryDrawing: Property Definitions Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsToolEvent This section details the properties defined within the GlyphsToolAuxiliaryDrawing protocol. These properties provide information about the tool's state, behavior, and appearance, such as drag start position, dragging status, group ID, interface version, temporary trigger key, title, toolbar icon, and default trigger shortcut. ```objectivec @property (nonatomic) NSPoint draggStart; @property (nonatomic) BOOL dragging; @property (nonatomic, readonly) NSUInteger groupID; @property (nonatomic, readonly) NSUInteger interfaceVersion; @property (nonatomic, readonly) NSInteger tempTrigger; @property (nonatomic, readonly) NSString *title; @property (nonatomic, readonly) NSImage *toolBarIcon; @property (nonatomic, readonly) NSString *trigger; ``` -------------------------------- ### Get Custom Parameter by Key (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSCustomParameter object based on its key. Returns the custom parameter object if found, otherwise nil. ```objectivec - (GSCustomParameter *)customParameterForKey:(NSString *)_key_ ``` -------------------------------- ### Get component layer information Source: https://docu.glyphsapp.com/Core/Classes/GSComponent Method to retrieve the layer associated with a component. This may be a standard glyph layer or a computed smart component result. ```objective-c - (nullable GSLayer *)componentLayer ``` -------------------------------- ### Get Hint Object by Index (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSLayer Retrieves a GSHint object from the hints array at the specified index. The index must be valid within the bounds of the hints array. ```objective-c - (GSHint *_Nullable)objectInHintsAtIndex:(NSUInteger)_index_ ``` -------------------------------- ### GSFontMaster Properties (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFontMaster Defines properties for the GSFontMaster class, including name, ID, default metrics, custom parameters, guides, properties, and user data. Some properties are read-only, while others allow modification. ```objc @property (copy, nonatomic) NSString *custom @property (nonatomic, strong) NSMutableArray *customParameters @property (assign, nonatomic) CGFloat customValue @property (nonatomic, readonly) CGFloat defaultAscender @property (nonatomic, readonly) CGFloat defaultCapHeight @property (nonatomic) CGFloat defaultItalicAngle @property (nonatomic, readonly) CGFloat defaultXHeight @property (nonatomic, strong) NSMutableArray *guides @property (copy, nonatomic) NSString *id @property (nonatomic, strong) NSString *name @property (nonatomic, strong) NSMutableArray *properties @property (strong, nonatomic, nullable) NSDictionary *userData @property (copy, nonatomic) NSString *weight @property (assign, nonatomic) CGFloat weightValue @property (copy, nonatomic) NSString *width @property (assign, nonatomic) CGFloat widthValue ``` -------------------------------- ### Objective-C: Get Glyph Info by Glyph Object Source: https://docu.glyphsapp.com/Core/Classes/GSGlyphsInfo Fetches the GSGlyphInfo object for a given GSGlyph. Returns nil if no corresponding info is found. This method allows retrieving detailed information about a specific glyph. ```objective-c - (GSGlyphInfo *)glyphInfoForGlyph:(GSGlyph *)_glyph_ ``` -------------------------------- ### Objective-C: Get Glyph Info by Glyph Name Source: https://docu.glyphsapp.com/Core/Classes/GSGlyphsInfo Retrieves the GSGlyphInfo object for a glyph, identified by its name. This is a common way to look up glyph details when only the name is known. ```objective-c - (GSGlyphInfo *)glyphInfoForName:(NSString *)_name_ ``` -------------------------------- ### Get Feature Prefix by Tag (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSClass object representing a feature prefix based on its name or tag. Returns nil if the prefix is not found. ```objectivec - (nullable GSClass *)featurePrefixForTag:(NSString *)_tag_ ``` -------------------------------- ### GSGradient Properties Source: https://docu.glyphsapp.com/Core/Classes/GSGradient Defines the properties of the GSGradient class, including colors, start and end points, and gradient type. These properties are essential for defining and manipulating gradient objects. ```objective-c @property (nonatomic, strong) NSMutableArray *colors @property (nonatomic) NSPoint start @property (nonatomic) NSPoint end @property (nonatomic) GSGradientType type ``` -------------------------------- ### Draw Layer Foreground (Objective-C) Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsToolDraw Implement this method to draw custom foreground elements for a layer. Similar to the background drawing, this operates in font units. Use this for elements that should appear on top of the main glyph rendering, such as guides or annotations. ```objective-c - (void)drawForegroundForLayer:(GSLayer *)_layer_ { // Custom drawing code here } ``` ```objective-c - (void)drawLayer:(GSLayer *)_layer_ atPoint:(NSPoint)_layerOrigin_ asActive:(BOOL)_active_ attributes:(NSDictionary *)_attributes_ { // Custom drawing code here } ``` -------------------------------- ### Objective-C: Get Glyph Info by Unicode String Source: https://docu.glyphsapp.com/Core/Classes/GSGlyphsInfo Fetches the GSGlyphInfo object for a glyph using its Unicode string representation. This method is useful for finding glyphs based on their character codes. ```objective-c - (GSGlyphInfo *)glyphInfoForUnicode:(NSString *)_unicode_ ``` -------------------------------- ### Glyph and Color Initialization in GSPenProtocol.h Source: https://docu.glyphsapp.com/Core/Protocols/GSPenProtocol This snippet includes methods for initializing glyphs and setting the fill color for drawing operations. `startGlyph:` is used to begin the process of defining a glyph, while `setFillColor:` determines the color used for subsequent path fills. ```Objective-C - (void)setFillColor:(NSColor *)_color_ ``` ```Objective-C - (void)startGlyph:(GSLayer *)_layer_ ``` -------------------------------- ### Objective-C: Get Index of Feature Source: https://docu.glyphsapp.com/Core/Classes/GSFont Returns the index of a given GSFeature object within the font's features list. Returns the index if found, otherwise behavior is undefined (likely NSNotFound). ```objc - (NSUInteger)indexOfFeature:(GSFeature *)_feature_ ``` -------------------------------- ### GSGlyphViewControllerProtocol - Instance Methods Source: https://docu.glyphsapp.com/Core/Protocols/GSGlyphEditViewControllerProtocol This section details the instance methods available within the GSGlyphViewControllerProtocol. ```APIDOC ## Instance Methods ### forceRedraw **Description**: Updates the `graphicView` and preview. **Method**: `-(void)forceRedraw` ### redraw **Description**: Called to update the `graphicView`. **Method**: `-(void)redraw` ### updateFormatBar: **Description**: Is called when the status bar needs updating. **Method**: `- (void)updateFormatBar:(NSString *)_keyPath_` **Parameters**: * **_keyPath_** (NSString) - The key path for updating the format bar. ``` -------------------------------- ### GSGlyphViewControllerProtocol Instance Methods Source: https://docu.glyphsapp.com/Core/Protocols/GSGlyphViewControllerProtocol Details on the instance methods available within the GSGlyphViewControllerProtocol. ```APIDOC ## Instance Methods ### canShowInfoForSelection Is called to determine if the “Show Info for Selection” menu item should be activated `- (BOOL)canShowInfoForSelection` #### Return Value a bool ### showInfoForSelection: This is the action for the “Show Info for Selection” menu item. `- (IBAction)showInfoForSelection:(id)_sender_` #### Parameters _sender_ The caller, most likely the menu item ``` -------------------------------- ### Get Custom Value by Key (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves the value of a custom parameter associated with a given key. The return type is id, accommodating various value types. ```objectivec - (id)customValueForKey:(NSString *)_key_ ``` -------------------------------- ### Objective-C: Get Glyph by Character Unicode Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSGlyph object corresponding to a given UTF32 character code. Returns nil if no glyph is found for the specified character. ```objc - (nullable GSGlyph *)glyphForCharacter:(UTF32Char)_aChar_ ``` -------------------------------- ### initWithDict:format: Source: https://docu.glyphsapp.com/Core/Classes/GSFontMaster Initializes a fontmaster object with a dictionary and a specified format version. ```APIDOC ## initWithDict:format: ### Description Initializes a fontmaster object with a dictionary and a specified format version. ### Method `instancetype` ### Endpoint `initWithDict:format:` ### Parameters #### Path Parameters - **_dict** (NSDictionary) - Required - The property list representation. - **_formatVersion** (GSFormatVersion) - Required - The version of the property list. ### Return Value a fontmaster object ``` -------------------------------- ### Initialize GSElement with Dictionary (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSElement Initializes a GSElement object using a dictionary loaded from a property list. It takes the dictionary and the format version as input. Returns the initialized element object. ```Objective-C - (instancetype)initWithDict:(NSDictionary *)_dict_ format:(GSFormatVersion)_formatVersion_ ``` -------------------------------- ### Get Kerning Value for Previous Layer (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSLayer Returns the kerning value for the sequence of the previous layer followed by the current layer. It returns a float or MaxInt if no value is found, considering class kerning or exceptions. ```objective-c - (CGFloat)previousKerningForLayer:(GSLayer *)_previousLayer_ direction:(GSWritingDirection)_direction_ ``` -------------------------------- ### Define Plugin Load Method (Objective-C) Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsPlugin Declares the required loadPlugin method that Glyphs.app calls to initialize the plugin. This method enables plugins to set up their internal state and register functionality. It takes no parameters and returns void. ```Objective-C - (void)loadPlugin ``` -------------------------------- ### GSWindowController Instance Methods Source: https://docu.glyphsapp.com/Core/Classes/GSWindowController Provides the instance method - (void)setToolForClass:(Class)_aClass_ for GSWindowController. This method is used to activate a specific tool based on its class, allowing for dynamic tool switching within the application. ```Objective-C - (void)setToolForClass:(Class)_aClass_ ``` -------------------------------- ### Objective-C: Get Glyph by Name Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSGlyph object using its name. This method can be slow and returns nil if the glyph is not found. ```objc - (nullable GSGlyph *)glyphForName:(NSString *)_name_ ``` -------------------------------- ### Objective-C: Get Glyph by Multiple Unicode Strings Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSGlyph object using a set of Unicode values represented as hex strings. Returns nil if no matching glyph is found. Cache may need resetting if glyph properties are modified. ```objc - (nullable GSGlyph *)glyphForUnicodes:(NSOrderedSet *)_unicodes_ ``` -------------------------------- ### Get Character for Glyph (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFont Returns a UTF32Char for a given GSGlyph object. For unencoded glyphs, it returns a cached PUA value. ```objectivec - (UTF32Char)characterForGlyph:(GSGlyph *)_glyph_ ``` -------------------------------- ### GSShape Instance Methods Source: https://docu.glyphsapp.com/Core/Classes/GSShape Provides a collection of instance methods for interacting with GSShape objects. These methods cover initializing shapes from dictionaries, manipulating their position, managing attributes, and saving shapes to files. ```Objective-C - (instancetype)initWithDict:(NSDictionary *)_dict_ format:(GSFormatVersion)_formatVersion_ - (void)moveWithPoint:(NSPoint)_offset_ - (nullable NSDictionary *)propertyListValueFormat:(GSFormatVersion)_format_ - (BOOL)saveToFile:(FILE *)_file_ format:(GSFormatVersion)_formatVersion_ error:(NSError **)_error_ ``` -------------------------------- ### Objective-C: GlyphsFileFormatProtocol Required Methods Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsFileFormat Defines the essential methods that must be implemented by any class adopting the GlyphsFileFormatProtocol. These include methods for versioning, exporting, importing, and UI elements. ```objective-c - (NSUInteger)interfaceVersion; - (NSString *)title; - (NSView *)exportSettingsView; - (GSFont *)font; - (void)exportFont:(GSFont *)_font_; - (BOOL)writeFont:(GSFont *)_font_ toURL:(NSURL *)_URL_ error:(out NSError **)_error_; - (GSFont *)fontFromURL:(NSURL *)_URL_ ofType:(NSString *)_type_ error:(out NSError **)_error_; - (NSUInteger)groupID; - (NSString *)toolbarTitle; - (NSString *)toolbarIconName; - (void)loadPlugin; - (id)delegate; - (BOOL)importFile:(GSFont *)_font_ fromURL:(NSURL *)_URL_ error:(out NSError **)_error_; - (void)cancelExport; ``` -------------------------------- ### GSGlyphViewControllerProtocol Overview Source: https://docu.glyphsapp.com/Core/Protocols/GSGlyphViewControllerProtocol This protocol defines the API for the main view controllers, implemented by the font view controller and the edit view controller. ```APIDOC ## Overview This protocol defines the API for the main view controllers. This is implemented by the font view controller and the edit view controller. ## Tasks * masterIndex required method * selectedLayers required method * representedObject required method * activeLayer required method * shadowLayer required method * canShowInfoForSelection * showInfoForSelection: ``` -------------------------------- ### GSGlyphViewControllerProtocol - Properties Source: https://docu.glyphsapp.com/Core/Protocols/GSGlyphEditViewControllerProtocol This section details the properties available within the GSGlyphViewControllerProtocol. ```APIDOC ## Properties ### graphicView **Description**: The actual edit view. **Type**: `NSView` **Access**: Read-only ### selectedFeatures **Description**: The selected features. **Type**: `NSArray` **Access**: Read-only ### selectedInstance **Description**: The selected instance in the preview view. **Type**: `NSInteger` **Access**: Assignable ### writingDirection **Description**: The writing direction. **Type**: `GSWritingDirection` **Access**: Read-write ``` -------------------------------- ### Property List Formatting Source: https://docu.glyphsapp.com/Core/Classes/GSInstance Method for formatting object content for property list storage. ```APIDOC ## propertyListValueFormat: ### Description Returns the content of the object formatted for storage in a property list. ### Method `- (NSDictionary *)propertyListValueFormat:(GSFormatVersion)_format_` ### Parameters #### Path Parameters * **_format_** (GSFormatVersion) - The version of the dictionary format. ### Discussion This is used to store the data in the .glyphs file. ``` -------------------------------- ### Get Class by Tag (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSClass object based on its tag (name). Returns nil if no class is found with the specified tag. ```objectivec - (nullable GSClass *)classForTag:(NSString *)_tag_ ``` -------------------------------- ### Interpolation and Scaling Source: https://docu.glyphsapp.com/Core/Classes/GSInstance Methods related to interpolation calculations and scaling of objects. ```APIDOC ## instanceInterpolations:axes: ### Description Calculates the interpolation coefficients for given masters and axes. ### Method `- (NSDictionary *)instanceInterpolations:(NSArray *)_masters_ axes:(NSArray *)_axes_` ### Parameters #### Path Parameters * **_masters_** (NSArray) - A list of GSFontMaster objects. * **_axes_** (NSArray) - The font axes. ### Return Value * **NSDictionary** - A dictionary with FontMaster IDs as keys and coefficients as values. ### Discussion This is used to automatically calculate the instanceInterpolations. ## scaleBy: ### Description Scales the instance object by a given factor. ### Method `- (void)scaleBy:(CGFloat)_scale_` ### Parameters #### Path Parameters * **_scale_** (CGFloat) - The scale value. ## updateInterpolationValues ### Description Forces an update of the instance interpolations after changes have been made to the instance. ### Method `- (void)updateInterpolationValues` ``` -------------------------------- ### Objective-C: Draw Foreground for Layer with Options Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsReporter This method allows a plugin to draw content in front of the normal outlines in a layer, with scaling and positioning handled. It takes a GSLayer and an options dictionary. This method is available from version 2.5. ```objectivec - (void)drawForegroundForInactiveLayer:(GSLayer *)_layer_ options:(NSDictionary *)_options_ ``` -------------------------------- ### Objective-C: Get Index of Axis Source: https://docu.glyphsapp.com/Core/Classes/GSFont Returns the index of a given GSAxis object within the font's axes list. Returns the index if found. ```objc - (NSUInteger)indexOfObjectInAxes:(GSAxis *)_axis_ ``` -------------------------------- ### GSClass Instance Methods (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSClass Documents instance methods for GSClass, including 'propertyListValueFormat:' for pList serialization, 'setTempData:forKey:' and 'tempDataForKey:' for managing temporary data, and 'update' to trigger regeneration. ```objectivec - (NSDictionary *)propertyListValueFormat:(GSFormatVersion)_format_ - (void)setTempData:(nullable id)_value_ forKey:(nonnull NSString *)_key_ - (nullable id)tempDataForKey:(nonnull NSString *)_key_ - (void)update ``` -------------------------------- ### Save path to file (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSPath Saves path to file with format options. Takes FILE pointer, format version, compact flag, and error reference. Returns BOOL success status. ```Objective-C - (BOOL)saveToFile:(FILE *)_file_ format:(GSFormatVersion)_formatVersion_ compact:(BOOL)_compact_ error:(NSError **_)_error_ ``` -------------------------------- ### Objective-C: Get Glyph by ID Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSGlyph object using its unique identifier. Note that this operation can be slow. Returns the GSGlyph object if found. ```objc - (GSGlyph *)glyphForId:(NSString *)_ID_ ``` -------------------------------- ### Objective-C: Draw Background for Layer with Options Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsReporter This method is called to allow a plugin to draw content behind the normal outlines in a layer, with scaling and positioning handled automatically. It accepts a GSLayer object and a dictionary of options, including 'Scale'. This is the preferred method over the deprecated version without options. ```objectivec - (void)drawBackgroundForLayer:(GSLayer *)_layer_ options:(NSDictionary *)_options_ ``` -------------------------------- ### Objective-C: Draw Background with Options Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsReporter This method allows drawing behind outlines when automatic scaling is inconvenient. It requires manual checking of layer and position. It takes an options dictionary that includes 'Scale'. ```objectivec - (void)drawBackgroundWithOptions:(NSDictionary *)_options_ ``` -------------------------------- ### Objective-C: Import File Method Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsFileFormat The `-importFile:fromURL:error:` method imports data from a file at a given URL into an existing `GSFont` object. It returns `YES` on success and `NO` on failure, with error details in the `_error_` parameter. ```objective-c - (BOOL)importFile:(GSFont *)_font_ fromURL:(NSURL *)_URL_ error:(out NSError **)_error_; ``` -------------------------------- ### GlyphsToolAuxiliaryDrawing Protocol: Required Methods Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsToolEvent This section lists the essential methods that any plugin conforming to the GlyphsToolAuxiliaryDrawing protocol must implement. These methods cover core functionalities like versioning, identification, toolbar representation, and user interaction triggers. ```objectivec @required - (NSUInteger)interfaceVersion; - (NSUInteger)groupID; - (NSString *)title; - (NSImage *)toolBarIcon; - (NSInteger)trigger; - (NSInteger)tempTrigger; - (BOOL)dragging; - (NSPoint)draggStart; ``` -------------------------------- ### GSGlyphViewControllerProtocol Properties Source: https://docu.glyphsapp.com/Core/Protocols/GSGlyphViewControllerProtocol Details on the properties available within the GSGlyphViewControllerProtocol. ```APIDOC ## Properties ### activeLayer The active layer `@property (readonly, nonatomic) GSLayer *activeLayer` #### Discussion If only one layer is selected it retunes it, otherwise it retunes nil. In the editview, this is the layer that has a gray info box. ### masterIndex The index of the active master `@property (nonatomic) NSUInteger masterIndex` ### representedObject The GSFont object `@property (readonly, nonatomic) id representedObject` ### selectedLayers The selected layers `@property (readonly, nonatomic) NSArray *selectedLayers` ### shadowLayer This is a copy of the layer while and drag operation or a filter dialog is active. `@property (strong, nonatomic) GSLayer *shadowLayer` #### Discussion It stores the original content objects of the layer, so please don’t change anything ``` -------------------------------- ### GSGlyphViewControllerProtocol Instance Methods Source: https://docu.glyphsapp.com/Core/Protocols/GSGlyphEditViewControllerProtocol Defines the instance methods for the edit view controller, including methods for forcing a redraw, redrawing the graphic view, and updating the format bar. These methods control the visual updates and user interface elements of the editor. ```objectivec - (void)forceRedraw; - (void)redraw; - (void)updateFormatBar:(NSString *)_keyPath_; ``` -------------------------------- ### Get Font Master by Index (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSFontMaster object at a specific index within the font's masters. Returns nil if the index is out of bounds. ```objectivec - (nullable GSFontMaster *)fontMasterAtIndex:(NSInteger)_index_ ``` -------------------------------- ### GSGradient Instance Methods for Color Management Source: https://docu.glyphsapp.com/Core/Classes/GSGradient Provides methods for managing the array of colors within a GSGradient object. These include adding, counting, finding the index of, inserting, and removing colors. ```objective-c - (void)addColor:(NSArray *)_color_ - (NSUInteger)countOfColors - (NSUInteger)indexOfObjectInColors:(NSArray *)_color_ - (void)insertObject:(NSArray *)_color_ 1insertObject:inColorsAtIndex:(NSUInteger)_idx_ - (NSArray *)objectInColorsAtIndex:(NSUInteger)_idx_ - (void)removeObjectFromColors:(NSArray *)_color_ - (void)removeObjectFromColorsAtIndex:(NSUInteger)_idx_ ``` -------------------------------- ### Get Shape Object by Index (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSLayer Returns a GSShape object from the shapes array at the given index. The index must be within the valid range of the shapes array. ```objective-c - (nullable GSShape *)objectInShapesAtIndex:(NSUInteger)_index_ ``` -------------------------------- ### initWithPosition:type:connection: Method in Objective-C Source: https://docu.glyphsapp.com/Core/Classes/GSNode Convenient initializer that creates a GSNode with specified position, node type, and connection type. Accepts NSPoint for position and GSNodeType enums for type and connection parameters. ```objective-c - (instancetype)initWithPosition:(NSPoint)_position_ type:(GSNodeType)_type_ connection:(GSNodeType)_connection_; ``` -------------------------------- ### GSWindowController Properties Source: https://docu.glyphsapp.com/Core/Classes/GSWindowController Defines properties for GSWindowController, including key press states, active view controllers and layers, document access, master index, and the current drawing tool delegate. These properties manage the state and interaction within the Glyphs application window. ```Objective-C @property (nonatomic) BOOL ShiftKey , AltKey , CtrlKey , CommandKey , SpaceKey @property (unsafe_unretained, readonly, nonatomic) NSViewController *activeEditViewController @property (unsafe_unretained, readonly) GSLayer *activeLayer @property (nonatomic, readonly) GSDocument *glyphsDocument @property (nonatomic) NSUInteger masterIndex @property (unsafe_unretained, nonatomic) NSResponder *toolDrawDelegate ``` -------------------------------- ### Font Info Property Management Source: https://docu.glyphsapp.com/Core/Classes/GSInstance Methods for managing properties within font information. ```APIDOC ## indexOfObjectInProperties ### Description Returns the index of a property in the properties list. ### Method `- (NSUInteger)indexOfObjectInProperties:(GSFontInfoProperty *)_property_` ### Parameters #### Path Parameters * **_property_** (GSFontInfoProperty) - The property object to find the index of. ### Return Value * **NSUInteger** - The index of the property in the properties list. ## insertObject:inPropertiesAtIndex: ### Description Inserts a property at a specific index into the properties list. ### Method `- (void)insertObject:(GSFontInfoProperty *)_property_ inPropertiesAtIndex:(NSUInteger)_idx_` ### Parameters #### Path Parameters * **_property_** (GSFontInfoProperty) - The property object to insert. * **_idx_** (NSUInteger) - The index at which to insert the property. ## objectInPropertiesAtIndex: ### Description Returns the property object at a specific index from the properties list. ### Method `- (GSFontInfoProperty *)objectInPropertiesAtIndex:(NSUInteger)_idx_` ### Parameters #### Path Parameters * **_idx_** (NSUInteger) - The index of the property to retrieve. ### Return Value * **GSFontInfoProperty** - The property object at the specified index. ## removeObjectFromProperties: ### Description Removes a specific property object from the properties list. ### Method `- (void)removeObjectFromProperties:(GSFontInfoProperty *)_property_` ### Parameters #### Path Parameters * **_property_** (GSFontInfoProperty) - The property object to remove. ## removeObjectFromPropertiesAtIndex: ### Description Removes the property object at a specific index from the properties list. ### Method `- (void)removeObjectFromPropertiesAtIndex:(NSUInteger)_idx_` ### Parameters #### Path Parameters * **_idx_** (NSUInteger) - The index of the property to remove. ``` -------------------------------- ### Objective-C: Get Index of Glyph Source: https://docu.glyphsapp.com/Core/Classes/GSFont Returns the index of a specified GSGlyph object within the font's glyph array. Returns NSNotFound if the glyph is not found in the array. ```objc - (NSInteger)indexOfGlyph:(GSGlyph *)_glyph_ ``` -------------------------------- ### Objective-C: Get Grid Length Source: https://docu.glyphsapp.com/Core/Classes/GSFont Returns the effective width of the grid, calculated by dividing the Grid value by the Subdivision value. This is a CGFloat representing the grid's granularity. ```objc - (CGFloat)gridLength ``` -------------------------------- ### GlyphsToolAuxiliaryDrawing Protocol: Optional Methods Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsToolEvent This section outlines optional methods that plugins can implement to extend the functionality of the GlyphsToolAuxiliaryDrawing protocol. These methods handle advanced interactions such as drag-and-drop, modifier key changes, activation/deactivation callbacks, and context menu customization. ```objectivec @optional - (void)modifierChanged:(NSEvent *)_anEvent_; - (void)willActivate; - (void)willDeactivate; - (BOOL)willSelectTempTool:(id)_tempTool_; - (void)drawSelection; - (void)copy:(id)_sender_; - (void)paste:(id)_sender_; - (NSMenu *)toolbarMenu; - (void)addMenuItemsForEvent:(NSEvent *)_theEvent_ toMenu:(NSMenu *)_theMenu_; - (void)selectNextSubTool:(id)_sender_; - (NSArray *)activeLayers; - (NSArray *)inspectorViewControllers; - (NSArray *)extraInspectorViewControllers; - (BOOL)canShowInfoForSelection; - (void)showInfoForSelection; ``` -------------------------------- ### Objective-C: GlyphsFileFormatProtocol Properties Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsFileFormat Details the properties available within the GlyphsFileFormatProtocol. These properties provide access to the delegate, export settings view, the current font object, and identifiers for toolbar and group positioning. ```objective-c @property (nonatomic, unsafe_unretained) NSObject *delegate; @property (readonly, nonatomic) NSView *exportSettingsView; @property (strong, nonatomic) GSFont *font; @property (readonly) NSUInteger groupID; @property (readonly) NSUInteger interfaceVersion; @property (readonly) NSString *title; @property (readonly) NSString *toolbarIconName; @property (readonly) NSString *toolbarTitle; ``` -------------------------------- ### Tool Activation/Deactivation Callbacks (Objective-C) Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsToolDraw These methods are called when a tool becomes active (`willActivate`) or inactive (`willDeactivate`). They are useful for setting up or cleaning up resources, updating tool states, or performing actions when the tool's visibility or interaction context changes. ```objective-c - (void)willActivate { // Code to run when the tool becomes active } ``` ```objective-c - (void)willDeactivate { // Code to run when the tool becomes inactive } ``` -------------------------------- ### Initialize GSMetric from Dictionary - Objective-C Source: https://docu.glyphsapp.com/Core/Classes/GSMetric Initializes a GSMetric instance from a dictionary and format version. This is typically used when loading metrics from a property list or other serialized format. ```Objective-C - (instancetype)initWithDict:(NSDictionary *)_dict_ format:(GSFormatVersion)_formatVersion_ ``` -------------------------------- ### Custom Parameter Management Source: https://docu.glyphsapp.com/Core/Classes/GSInstance Methods for managing custom parameters associated with an object. ```APIDOC ## removeObjectFromCustomParametersForKey: ### Description Removes the first custom parameter found with the specified key. ### Method `- (void)removeObjectFromCustomParametersForKey:(NSString *)_key_` ### Parameters #### Path Parameters * **_key_** (NSString) - The key of the custom parameter to remove. ## setCustomValue:forKey: ### Description Sets a custom value for a given key. If a parameter with the key already exists, its value is updated; otherwise, a new parameter is added. ### Method `- (void)setCustomValue:(id)_value_ forKey:(NSString *)_key_` ### Parameters #### Path Parameters * **_value_** (id) - The value to set for the custom parameter. * **_key_** (NSString) - The name of the custom parameter. ### Discussion It will look for an existing parameter with the name and overwrite its value, or adds a new parameter. ## setTempData:forKey: ### Description Adds or removes key-value data from temporary storage. ### Method `- (void)setTempData:(nullable id)_value_ forKey:(nonnull NSString *)_key_` ### Parameters #### Path Parameters * **_value_** (nullable id) - The object to store, or nil to remove previous data. * **_key_** (nonnull NSString) - The key for the temporary data. ## tempDataForKey: ### Description Retrieves the value associated with a given key from temporary storage. ### Method `- (nullable id)tempDataForKey:(nonnull NSString *)_key_` ### Parameters #### Path Parameters * **_key_** (nonnull NSString) - The key to retrieve the value for. ### Return Value * **nullable id** - The value associated with the key, or nil if the key is not found. ``` -------------------------------- ### Objective-C: Get Glyph Index by Glyph Object Source: https://docu.glyphsapp.com/Core/Classes/GSGlyphsInfo Retrieves the index of a glyph within the GSGlyphsInfo database, given a GSGlyph object. This is useful for direct lookups based on glyph data. ```objective-c - (NSUInteger)glyphIndex:(GSGlyph *)_glyph_ ``` -------------------------------- ### Font Info Value Setting Source: https://docu.glyphsapp.com/Core/Classes/GSInstance Method for setting or updating font info values with language tagging. ```APIDOC ## setProperty:value:languageTag: ### Description Adds a new font info value or updates an existing one for a given name and language tag. ### Method `- (void)setProperty:(NSString *)_name_ value:(NSString *)_value_ languageTag:(nullable NSString *)_languageTag_` ### Parameters #### Path Parameters * **_name_** (NSString) - The key whose plural form specifies an array property of GSFontInfoValue objects on the receiver. * **_value_** (NSString) - The actual value to be added. * **_languageTag_** (nullable NSString) - The language under which the value should be stored. Defaults to `English` if nil is passed. ``` -------------------------------- ### Objective-C: Get Glyph by Index Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSGlyph object from the font's glyph array at a specified index. It returns nil if the index is out of bounds, ensuring safe access to glyphs. ```objc - (nullable GSGlyph *)glyphAtIndex:(NSInteger)_index_ ``` -------------------------------- ### Manage Temporary Data Storage Source: https://docu.glyphsapp.com/Core/Classes/GSTransformableElement Methods for setting and retrieving temporary data associated with keys. This data is not persisted to disk and is intended for runtime use only. ```Objective-C - (void)setTempData:(nullable id)_value_ forKey:(nonnull NSString *)_key_ - (nullable id)tempDataForKey:(nonnull NSString *)_key_ ``` -------------------------------- ### Generate Feature Code for Prefix (Objective-C) Source: https://docu.glyphsapp.com/Core/Protocols/GSFeatureCodeGeneratorProtocol Callback method for generating feature code for a prefix. It takes the GSFeature (representing the prefix), GSFont, and an error pointer as input. Returns YES on success, NO on failure. ```Objective-C + (BOOL)featureCodeForPrefix:(GSFeature *)_prefix_ font:(GSFont *)_font_ error:(NSError **)_error_ ``` -------------------------------- ### Objective-C: Get Font Master by ID Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSFontMaster instance using its unique identifier. Returns nil if the ID is not found. This method is crucial for accessing specific font masters within a collection. ```objc - (nullable GSFontMaster *)fontMasterForId:(nullable NSString *)_id_ ``` -------------------------------- ### Objective-C: Retrieve Shared GSGlyphsInfo Instance Source: https://docu.glyphsapp.com/Core/Classes/GSGlyphsInfo This class method returns the singleton instance of GSGlyphsInfo, which manages all glyph information. It's the primary way to access glyph data and related functionalities. ```objective-c + (GSGlyphsInfo *)sharedManager ``` -------------------------------- ### Access GSComponent paths and bounds Source: https://docu.glyphsapp.com/Core/Classes/GSComponent Methods for retrieving the visual representation and spatial boundaries of a component. These methods return transformed paths and bounding rectangles. ```objective-c - (NSBezierPath *_Nullable)bezierPath - (NSRect)bounds - (NSBezierPath *_Nullable)openBezierPath ``` -------------------------------- ### Get Kerning Value for Next Layer (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSLayer Retrieves the kerning value for the sequence of the current layer followed by the next layer. It returns a float value or MaxInt if no value is defined, considering class kerning or exceptions. ```objective-c - (CGFloat)nextKerningForLayer:(GSLayer *)_nextLayer_ direction:(GSWritingDirection)_direction_ ``` -------------------------------- ### Objective-C: Initialize Font from Dictionary Source: https://docu.glyphsapp.com/Core/Classes/GSFont Initializes a font object from a dictionary, typically loaded from a property list. It can return an NSError if the initialization process fails. ```objc - (instancetype)initWithDict:(NSDictionary *)_fontDict_ error:(out NSError **)_error_ ``` -------------------------------- ### Objective-C: Get Glyph by Unicode String Source: https://docu.glyphsapp.com/Core/Classes/GSFont Retrieves a GSGlyph object using its Unicode value represented as a hex string. Returns nil if the glyph is not found. Consider calling resetCache if results are inconsistent after property changes. ```objc - (nullable GSGlyph *)glyphForUnicode:(NSString *)_unicode_ ``` -------------------------------- ### Objective-C: Convert Glyph Name to Production Format Source: https://docu.glyphsapp.com/Core/Classes/GSGlyphsInfo Converts a given glyph name into its production format. This is often used for internal or specific application requirements. ```objective-c - (NSString *)productionGlyphNameForName:(NSString *)_name_ ``` -------------------------------- ### Objective-C: Add Menu Items to Context Menu Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsReporter This method is called for active reporter plugins to add custom menu items to the context menu. It receives the event that initiated the menu and the NSMenu object to which items can be added. This allows for plugin-specific settings or actions. ```objectivec - (void)addMenuItemsForEvent:(NSEvent *)_theEvent_ toMenu:(NSMenu *)_theMenu_ ``` -------------------------------- ### Process Layer Before Output (Objective-C) Source: https://docu.glyphsapp.com/Core/Protocols/GlyphsCallback This Objective-C method is designed to process a GSLayer before it is outputted. It takes the layer, extra handles, and an error pointer as input. It returns a BOOL indicating if changes were made, and if so, returns a copy of the modified layer for further processing. ```Objective-C - (BOOL)processLayer:(GSLayer *)_layer_ extraHandles:(NSMutableArray *)_extraHandles_ error:(out ``` -------------------------------- ### Mark Metrics for Update (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSLayer Marks the right-side bearing (RSB) and left-side bearing (LSB) to require an update. This method does not take any parameters. ```objective-c - (void)setNeedUpdateMetrics ``` -------------------------------- ### Make node first in path (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSPath Sets specified node as first node in path. Takes GSNode parameter. Does nothing if node not found in path. ```Objective-C - (void)makeNodeFirst:(GSNode *)_node_ ``` -------------------------------- ### Count Font Properties (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSFont Provides counts for various font elements including axes, classes, custom parameters, feature prefixes, features, font masters, glyphs, instances, and properties. ```objectivec - (NSUInteger)countOfAxes - (NSUInteger)countOfClasses - (NSUInteger)countOfCustomParameters - (NSUInteger)countOfFeaturePrefixes - (NSUInteger)countOfFeatures - (NSInteger)countOfFontMasters - (NSUInteger)countOfGlyphs - (NSUInteger)countOfInstances - (NSUInteger)countOfProperties ``` -------------------------------- ### GSClass Properties (Objective-C) Source: https://docu.glyphsapp.com/Core/Classes/GSClass Defines the properties of the GSClass, including boolean flags for automatic generation, automation capability, and disabled status, along with string properties for name, code, notes, and a dictionary for temporary data. ```objectivec @property (nonatomic) BOOL automatic @property (nonatomic, readonly) BOOL canBeAutomated @property (nonatomic) BOOL disabled @property (nonatomic, copy) NSString *name @property (nonatomic, strong) NSString *notes @property (nonatomic, strong, nullable) NSDictionary *tempData ```