@sutton-signwriting/font-ttf
Version:
a javascript package for the web components and browser that generates SVG and PNG images for individual symbols and complete signs
337 lines (336 loc) • 8.59 kB
TypeScript
export const __esModule: boolean;
/** The font module contains functions for handing the TrueType fonts.
* @module font
*/
declare var index$2: Readonly<{
__proto__: any;
cssAppend: (dir?: string) => void;
cssLoaded: (callback: Function) => void;
cssLoadedLine: (callback: Function) => void;
cssLoadedFill: (callback: Function) => void;
symbolSize: (id: number) => number[];
symbolLine: (id: number) => string;
symbolFill: (id: number) => string;
symbolText: (id: number) => string;
}>;
/** The fsw module contains functions for handling Formal SignWriitng in ASCII (FSW) characters.
* [FSW characters definition](https://tools.ietf.org/id/draft-slevinski-formal-signwriting-09.html#name-formal-signwriting-in-ascii)
* @module fsw
*/
declare var index$1: Readonly<{
__proto__: any;
symbolSize: (fsw: string) => number[];
symbolLine: (fsw: string) => string;
symbolFill: (fsw: string) => string;
symbolText: (fsw: string) => string;
symbolSvgBody: (fswSym: string) => string;
symbolSvg: (fswSym: string) => string;
symbolPng: (fswSym: string) => string;
symbolNormalize: (fswSym: string) => string;
symbolMirror: (fswSym: string) => string;
symbolRotate: (fswSym: string, clockwise?: boolean) => string;
symbolFlop: (fswSym: string, positive?: boolean) => string;
symbolScroll: (fswSym: string, positive?: boolean) => string;
signSvgBody: (fswSign: string) => string;
signSvg: (fswSign: string) => string;
signPng: (fswSign: string) => string;
signNormalize: (fswSign: string) => string;
columnSvg: (fswColumn: ColumnData, options: ColumnOptions) => string;
columnsSvg: (fswText: string, options: ColumnOptions) => string[];
columnPng: (fswColumn: ColumnData, options: ColumnOptions) => string;
columnsPng: (fswText: string, options: ColumnOptions) => string[];
}>;
/** The swu module contains functions for handling SignWriting in Unicode (SWU) characters.
* [SWU characters definition](https://tools.ietf.org/id/draft-slevinski-formal-signwriting-09.html#name-signwriting-in-unicode-swu)
* @module swu
*/
declare var index: Readonly<{
__proto__: any;
symbolSize: (swu: string) => number[];
symbolLine: (swu: string) => string;
symbolFill: (swu: string) => string;
symbolText: (swu: string) => string;
symbolSvgBody: (swuSym: string) => string;
symbolSvg: (swuSym: string) => string;
symbolPng: (swuSym: string) => string;
symbolNormalize: (swuSym: string) => string;
symbolMirror: (swuSym: string) => string;
symbolRotate: (swuSym: string, clockwise?: boolean) => string;
symbolFlop: (swuSym: string, positive?: boolean) => string;
symbolScroll: (swuSym: string, positive?: boolean) => string;
signSvgBody: (swuSign: string) => string;
signSvg: (swuSign: string) => string;
signPng: (swuSign: string) => string;
signNormalize: (swuSign: string) => string;
columnSvg: (swuColumn: ColumnData, options: ColumnOptions) => string;
columnsSvg: (swuText: string, options: ColumnOptions) => string[];
columnPng: (swuColumn: ColumnData, options: ColumnOptions) => string;
columnsPng: (swuText: string, options: ColumnOptions) => string[];
}>;
export { index$2 as font, index$1 as fsw, index as swu };
/**
* Object of query elements with regular expression identification.
*/
type QueryObject = {
/**
* - required true for query object
*/
query: boolean;
/**
* - an object for prefix elements
*/
prefix?: {
required: boolean;
parts?: (string | string[] | (string | string[])[])[];
};
/**
* - array of objects for symbols, ranges, and list of symbols or ranges, with optional coordinates
*/
signbox?: (QuerySignboxSymbol | QuerySignboxRange | QuerySignboxOr)[];
/**
* - amount that x or y coordinates can vary and find a match, defaults to 20
*/
variance?: number;
/**
* - boolean value for including style string in matches
*/
style?: boolean;
};
type QuerySignboxSymbol = {
/**
* - a symbol
*/
symbol: string;
/**
* - an optional coordinate
*/
coord?: number[];
};
type QuerySignboxRange = {
/**
* - an array of two symbols
*/
range: string[];
/**
* - an optional coordinate
*/
coord?: number[];
};
type QuerySignboxOr = {
/**
* - an array of symbol strings and range arrays
*/
or: (string | string[])[];
/**
* - an optional coordinate
*/
coord?: number[];
};
type ColumnOptions = {
/**
* - the height of the columns
*/
height?: number;
/**
* - the widths of the columns
*/
width?: number;
/**
* - the lane offset for left and right lanes
*/
offset?: number;
/**
* - amount of padding before and after signs as well as at top, left, and right of columns
*/
pad?: number;
/**
* - amount of space at bottom of column that is not available
*/
margin?: number;
/**
* - enables variable width columns
*/
dynamic?: boolean;
/**
* - background color for columns
*/
background?: string;
/**
* - an object of style options
*/
style?: StyleObject;
/**
* - an object of punctuation options
*/
punctuation?: {
spacing?: boolean;
pad?: number;
pull?: boolean;
};
};
type ColumnData = ColumnSegment[];
type ColumnSegment = {
/**
* - the x position in the column
*/
x: number;
/**
* - the y position in the column
*/
y: number;
/**
* - the min x value within the segment
*/
minX: number;
/**
* - the min y value within the segment
*/
minY: number;
/**
* - the width of the text segment
*/
width: number;
/**
* - the height of the text segment
*/
height: number;
/**
* - Left as -1, Middle as 0, Right as 1
*/
lane: number;
/**
* - the padding of the text segment affects colored background
*/
padding: number;
/**
* - "sign" or "symbol"
*/
segment: string;
/**
* - the text of the sign or symbol with optional style string
*/
text: string;
/**
* - the zoom size of the segment
*/
zoom: number;
};
type SegmentInfo = {
/**
* - the min x value within the segment
*/
minX: number;
/**
* - the min y value within the segment
*/
minY: number;
/**
* - the width of the text segment
*/
width: number;
/**
* - the height of the text segment
*/
height: number;
/**
* - Left as -1, Middle as 0, Right as 1
*/
lane: number;
/**
* - the padding of the text segment affects colored background
*/
padding: number;
/**
* - "sign" or "symbol"
*/
segment: string;
/**
* - the zoom size of the segment
*/
zoom: number;
};
/**
* The elements of a style string
*/
type StyleObject = {
/**
* - boolean to use standardized colors for symbol groups
*/
colorize?: boolean;
/**
* - integer value for padding around symbol or sign
*/
padding?: number;
/**
* - css name or hex color for background
*/
background?: string;
/**
* - array for css name or hex color for line and optional fill
*/
detail?: string[];
/**
* - decimal value for zoom level
*/
zoom?: number;
/**
* - custom colors for individual symbols
*/
detailsym?: {
index: number;
detail: string[];
};
/**
* - list of class names separated with spaces used for SVG
*/
classes?: string;
/**
* - id name used for SVG
*/
id?: string;
};
/**
* The elements of a symbol string
*/
type SymbolObject = {
/**
* - symbol identifier
*/
symbol?: string;
/**
* - x,y coordinate
*/
coord?: number[];
/**
* - style string
*/
style?: string;
};
/**
* The elements of a sign string
*/
type SignObject = {
/**
* - array of symbols
*/
sequence?: string[];
/**
* - signbox marker or lane
*/
box?: string;
/**
* - preprocessed x,y coordinate
*/
max?: number[];
/**
* - array of symbols with coordinates
*/
spatials?: {
symbol: string;
coord: number[];
}[];
/**
* - style string
*/
style?: string;
};