Added sizeToFill option for resizing text to fill its container

This commit is contained in:
Ian Pearce
2014-10-06 03:00:53 +08:00
parent e5ad6e9e22
commit 60c009b432
3 changed files with 46 additions and 16 deletions
+3 -1
View File
@@ -15,6 +15,7 @@ new CanvasTextWrapper(HTMLCanvasElement, String [, options]);
- ```paddingY: Number``` - vertical padding in pixels set equally on both, top and bottom sides of the element
- ```fitParent: Boolean``` - parameter that controls which element to fit where ```true``` means fit canvas parent's width instead of canvas own width
- ```lineBreak: "auto" | "word"``` - text split rule. When using ```"auto"```, text fills the element's width going to a new line on a whole word when no more space. If ```"word"``` is set as value, each next word will be placed on a new line.
- ```sizeToFill: Boolean``` - ignore given font size and resize text to fill its padded container
NOTE: if a single word is too long to fit the width with specified font size, it will be broken into as many lines as required on any letter without specific word breaking rule.
@@ -30,7 +31,8 @@ The default options object which values will be used if a property is not specif
paddingX: 0,
paddingY: 0,
fitParent: false,
lineBreak: "auto"
lineBreak: "auto",
sizeToFill: false
}
```