Skip to content

Commit

Permalink
add duplicate font for non scriptable
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeLenaleee committed May 19, 2022
1 parent 34ace8e commit be37930
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions types/helpers/helpers.options.d.ts
@@ -1,15 +1,24 @@
import { TRBL, TRBLCorners } from '../geometric';
import { FontSpec } from '../index.esm';

export interface CanvasFontSpec extends FontSpec {
// Should be the same as FontSpec from the index.esm.ts
// Duplicate because the default one is scriptable and this one is not
interface NonScriptableFontSpec {
family: string;
size: number;
style: 'normal' | 'italic' | 'oblique' | 'initial' | 'inherit';
weight: string | null;
lineHeight: number | string;
}

export interface CanvasFontSpec extends NonScriptableFontSpec {
string: string;
}
/**
* Parses font options and returns the font object.
* @param {object} options - A object that contains font options to be parsed.
* @return {object} The font object.
*/
export function toFont(options: Partial<FontSpec>): CanvasFontSpec;
export function toFont(options: Partial<NonScriptableFontSpec>): CanvasFontSpec;

/**
* Converts the given line height `value` in pixels for a specific font `size`.
Expand Down

0 comments on commit be37930

Please sign in to comment.