GlyphsFileFormat Protocol Reference
Declared in | GlyphsFileFormatProtocol.h |
Tasks
interfaceVersion
required methodtitle
required methodexportSettingsView
required methodfont
required method– exportFont:
required method– writeFont:toURL:error:
required method– fontFromURL:ofType:error:
required methodgroupID
required methodtoolbarTitle
required methodtoolbarIconName
required method– loadPlugin
delegate
– importFile:fromURL:error:
– cancelExport
Properties
delegate
the delegate to show/hide progresswindow
@property (nonatomic, unsafe_unretained)
NSObject<GlyphsFileFormatDelegate> *delegate
exportSettingsView
The view to be displayed in the export dialog.
@property (readonly, nonatomic) NSView
*exportSettingsView
font
The GSFont object is assigned the the plugin prior to the export.
@property (strong, nonatomic) GSFont *font
Discussion
This is used to publish the export dialog.
groupID
The group ID defines the position of the exporter in the toolbar of the export window.
@property (readonly) NSUInteger groupID
Instance Methods
exportFont:
Exprts a Font object. This function should ask the user for the place to save the store the font.
- (void)exportFont:(GSFont *)font
Parameters
- font
-
The font to export.
Discussion
Eventually errors have to be presented by the plugin. Use
[font.parent presentError:error];
fontFromURL:ofType:error:
Reads a Font object from the specified URL.
- (GSFont *)fontFromURL:(NSURL *)URL
ofType:(NSString *)type error:(out NSError
**)error
Parameters
- URL
-
The URL to read the font from.
- type
-
The UTI of the document
- error
-
On return, If the document contents could not be read, a pointer to an error object that encapsulates the reason they could not be read.
Return Value
The font object, or nil if an error occurred.
importFile:fromURL:error:
Import some Data into the existing Font object
- (BOOL)importFile:(GSFont *)font fromURL:(NSURL
*)URL error:(out NSError **)error
Parameters
- font
-
an existing, already open Font
- URL
-
the file to import from
- error
-
on return
Return Value
True if success, False if failure
writeFont:toURL:error:
Saves a Font object to the specified URL.
- (BOOL)writeFont:(GSFont *)font toURL:(NSURL
*)URL error:(out NSError **)error
Parameters
- font
-
The font to export.
- URL
-
The URL to save the font to.
- error
-
On return, If the document contents could not be read, a pointer to an error object that encapsulates the reason they could not be read.
Return Value
YES if the operation was successful; otherwise, NO.
Discussion
This is a save operation so it should be able to read the font back in. Otherwise use exportFont: