Skip to content

Commit

Permalink
Add getFontInfo method to typing
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncozens committed Dec 18, 2024
1 parent 78d433c commit 72e72ad
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions types/remotefont.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,58 @@ interface BackendInfo {
projectManagerFeatures: BackendProjectManagerFeatures;
}

interface FontInfo {
familyName?: string;
versionMajor?: number;
versionMinor?: number;
copyright?: string;
trademark?: string;
description?: string;
sampleText?: string;
designer?: string;
designerURL?: string;
manufacturer?: string;
manufacturerURL?: string;
licenseDescription?: string;
licenseInfoURL?: string;
vendorID?: string;
customData: object;
}

interface RemoteFont {
/**
* Register an event handler to deal with events from the backend.
*
* Available events are: `close`, `error`, `messageFromServer`, `externalChange`, `reloadData`.
*/
on(event, callback);

/**
* Get the mapping between glyph names and Unicode codepoints.
*/
getGlyphMap(): Promise<Record<string, number[]>>;

/**
* Get the axes of the font
*/
getAxes(): Promise<Axes>;

/**
* Get the background image for a glyph.
*/
getBackgroundImage(identifier: string): Promise<FontImageData>;

/**
* Tell the backend to store an image as the background for a glyph.
*/
putBackgroundImage(identifier: string, image: FontImageData): Promise<void>;

getGlyph(identifier: string): Promise<IntoVariableGlyph>;

getSources(): Promise<Record<string, FontSource>>;

getUnitsPerEm(): Promise<number>;

/**
* Return any custom data that the backend has stored about this font.
*/
Expand All @@ -62,22 +88,26 @@ interface RemoteFont {
* Return information about the backend's capabilities.
*/
getBackEndInfo(): Promise<BackendInfo>;

/**
* Is the font read-only?
*/
isReadOnly(): Promise<boolean>;

/**
* Tell the backend that we are interested in receiving `externalChange` events for this font.
* @param pathOrPattern
* @param wantLiveChanges
*/
subscribeChanges(pathOrPattern: string[], wantLiveChanges: boolean): void;

/**
* Tell the backend to stop sending us `externalChange` events for this font.
* @param pathOrPattern
* @param wantLiveChanges
*/
unsubscribeChanges(pathOrPattern: string[], wantLiveChanges: boolean): void;

/**
* Notify the backend of a change that is final.
* @param finalChange
Expand All @@ -91,20 +121,28 @@ interface RemoteFont {
editLabel: string,
broadcast: boolean
);

/**
* Notify the backend of a change that is not yet final.
* @param change
*/
editIncremental(change: Change);

/**
* Asks the backend to export the font as a file.
* Options are dependent on the backend's project manager implementation.
*/
exportAs(options: any);

/**
*
* Which glyphs use glyph `glyphName` as a component. Non-recursive.
* @param glyphname
*/
findGlyphsThatUseGlyph(glyphname: string): Promise<string[]>;

/**
* Return information about this font.
*/
getFontInfo(): Promise<FontInfo>;
}

0 comments on commit 72e72ad

Please sign in to comment.