opentype.features.js
Version:
Library to list opentype fonts optional features.
206 lines (205 loc) • 6.33 kB
TypeScript
export default Font;
export type FontOptions = {
familyName: string;
styleName: string;
fullName?: string | undefined;
postScriptName?: string | undefined;
designer?: string | undefined;
designerURL?: string | undefined;
manufacturer?: string | undefined;
manufacturerURL?: string | undefined;
license?: string | undefined;
licenseURL?: string | undefined;
version?: string | undefined;
description?: string | undefined;
copyright?: string | undefined;
trademark?: string | undefined;
unitsPerEm: number;
ascender: number;
descender: number;
createdTimestamp: number;
weightClass?: string | undefined;
widthClass?: string | undefined;
fsSelection?: string | undefined;
};
export type GlyphRenderOptions = {
/**
* - language system used to determine which features to apply.
* See https://www.microsoft.com/typography/developers/opentype/languagetags.aspx
*/
language?: string | undefined;
/**
* - whether to include kerning values
*/
kerning?: boolean | undefined;
/**
* - OpenType Layout feature tags. Used to enable or disable the features of the given script/language system.
* See https://www.microsoft.com/typography/otspec/featuretags.htm
*/
features?: object | undefined;
};
/**
* @typedef FontOptions
* @type Object
* @property {Boolean} empty - whether to create a new empty font
* @property {string} familyName
* @property {string} styleName
* @property {string=} fullName
* @property {string=} postScriptName
* @property {string=} designer
* @property {string=} designerURL
* @property {string=} manufacturer
* @property {string=} manufacturerURL
* @property {string=} license
* @property {string=} licenseURL
* @property {string=} version
* @property {string=} description
* @property {string=} copyright
* @property {string=} trademark
* @property {Number} unitsPerEm
* @property {Number} ascender
* @property {Number} descender
* @property {Number} createdTimestamp
* @property {string=} weightClass
* @property {string=} widthClass
* @property {string=} fsSelection
*/
/**
* A Font represents a loaded OpenType font file.
* It contains a set of glyphs and methods to draw text on a drawing context,
* or to get a path representing the text.
* @exports opentype.Font
* @class
* @param {FontOptions}
* @constructor
*/
declare function Font(options: any): void;
declare class Font {
/**
* @typedef FontOptions
* @type Object
* @property {Boolean} empty - whether to create a new empty font
* @property {string} familyName
* @property {string} styleName
* @property {string=} fullName
* @property {string=} postScriptName
* @property {string=} designer
* @property {string=} designerURL
* @property {string=} manufacturer
* @property {string=} manufacturerURL
* @property {string=} license
* @property {string=} licenseURL
* @property {string=} version
* @property {string=} description
* @property {string=} copyright
* @property {string=} trademark
* @property {Number} unitsPerEm
* @property {Number} ascender
* @property {Number} descender
* @property {Number} createdTimestamp
* @property {string=} weightClass
* @property {string=} widthClass
* @property {string=} fsSelection
*/
/**
* A Font represents a loaded OpenType font file.
* It contains a set of glyphs and methods to draw text on a drawing context,
* or to get a path representing the text.
* @exports opentype.Font
* @class
* @param {FontOptions}
* @constructor
*/
constructor(options: any);
names: {
fontFamily: {
en: any;
};
fontSubfamily: {
en: any;
};
fullName: {
en: any;
};
postScriptName: {
en: any;
};
designer: {
en: any;
};
designerURL: {
en: any;
};
manufacturer: {
en: any;
};
manufacturerURL: {
en: any;
};
license: {
en: any;
};
licenseURL: {
en: any;
};
version: {
en: any;
};
description: {
en: any;
};
copyright: {
en: any;
};
trademark: {
en: any;
};
} | undefined;
unitsPerEm: any;
ascender: any;
descender: any;
createdTimestamp: any;
tables: any;
supported: boolean;
position: Position;
substitution: Substitution;
_push: any;
_hmtxTableData: {};
/**
* @typedef GlyphRenderOptions
* @type Object
* @property {string} [script] - script used to determine which features to apply. By default, 'DFLT' or 'latn' is used.
* See https://www.microsoft.com/typography/otspec/scripttags.htm
* @property {string} [language='dflt'] - language system used to determine which features to apply.
* See https://www.microsoft.com/typography/developers/opentype/languagetags.aspx
* @property {boolean} [kerning=true] - whether to include kerning values
* @property {object} [features] - OpenType Layout feature tags. Used to enable or disable the features of the given script/language system.
* See https://www.microsoft.com/typography/otspec/featuretags.htm
*/
defaultRenderOptions: {
kerning: boolean;
features: {
script: string;
tags: string[];
}[];
};
/**
* @param {string}
* @return {string}
*/
getEnglishName(name: any): string;
/**
* @private
*/
private fsSelectionValues;
/**
* @private
*/
private usWidthClasses;
/**
* @private
*/
private usWeightClasses;
}
import Position from "./position";
import Substitution from "./substitution";