-
Notifications
You must be signed in to change notification settings - Fork 46
/
index.d.ts
67 lines (64 loc) · 1.93 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
export function CanvasTextWrapper(element: HTMLCanvasElement, text: string, options?: CanvasTextWrapperOptions): void;
export interface CanvasTextWrapperOptions {
/**
* Text style that includes font size (in px), font weight, font family, etc.
*/
font?: string,
/**
* Number - 'n' times font size where 1 is equivalent to '100%'. Also the property can be set in '%' or 'px'.
*/
lineHeight?: string | number,
/**
* Horizontal alignment of each line.
*/
textAlign?: "left" | "center" | "right",
/**
* Vertical alignment of the whole text block.
*/
verticalAlign?: "top" | "middle" | "bottom",
/**
* Horizontal padding (in px) that is equally set on left and right sides.
*/
paddingX?: number,
/**
* Vertical padding (in px) that is equally set on top and bottoms.
*/
paddingY?: number,
/**
* Fit canvas' container size instead of its own size.
*/
fitParent?: boolean,
/**
* "auto" - text goes to the next line on a whole word when there's no room
* "word" - each next word is placed on a new line
*/
lineBreak?: "auto" | "word",
/**
* Ignore given font size and line height and resize text to fill its padded container.
*/
sizeToFill?: boolean,
/**
* If above option is true text won't be bigger than set.
*/
maxFontSizeToFill?: number,
/**
* Allow text outline based on canvas context configuration.
*/
strokeText?: boolean,
/**
* All lines will try to match the same width with flexed spaces between the words.
*/
justifyLines?: boolean,
/**
* Text breaks on a new line character "\n". Supports multiple consecutive new lines.
*/
allowNewLine?: boolean,
/**
* Text is rendered based on device pixel ratio.
*/
renderHDPI?: boolean,
/**
* Text is underlined according to context.strokeStyle and context.lineWidth
*/
textDecoration?: "none" | "underline"
}