1.18.0 • Published 5 years ago
@pencil.js/text v1.18.0
Text
Text writing.

Installation
npm install @pencil.js/textExamples
import Text from "@pencil.js/text";
const position = [100, 200];
const options = {
font: "comic-sans",
fontSize: 42
};
const message = new Text(position, "Hellow 😺", options);
// Change the text
message.text = "Henlo 🐶";
// Can be use to preload a bunch of fonts
Text.load([url1, url2, url3]).then(() => {
console.log("Fonts ready");
});Be aware this example overrides Javascript's Text global. Prefer another name for the import if you have collision.
import PText from "@pencil.js/text";TextOptions
Inherit from ComponentOptions.
| Name | Type | Default | Comment |
|---|---|---|---|
| font | String | "sans-serif" | Font to use (can be a URL) |
| fontSize | Number | 20 | Size of the text in pixels |
| align | String | Text.alignments.start | Text horizontal alignment (use the origin option to move the text) |
| bold | Boolean | false | Use bold font-weight |
| italic | Boolean | false | Use italic font-style |
| underscore | Boolean | false | Draw a line under the text |
| lineHeight | Number | 1 | Ratio of line height (1 is normal, 2 is twice the space) |
1.18.0
5 years ago
1.17.0
6 years ago
1.16.0
6 years ago
1.15.0
6 years ago
1.14.0
6 years ago
1.13.1
6 years ago
1.13.0
6 years ago
1.12.0
6 years ago
1.11.0
6 years ago
1.10.2
6 years ago
1.10.1
6 years ago
1.10.0
6 years ago
1.9.2
6 years ago
1.9.0
6 years ago
1.8.0
6 years ago
1.7.0
7 years ago
1.6.6
7 years ago
1.6.5
7 years ago
1.6.4
7 years ago
1.6.3
7 years ago
1.6.2
7 years ago
1.6.1
7 years ago
1.6.0
7 years ago
1.5.0
7 years ago
1.4.1
7 years ago
1.4.0
7 years ago
1.3.1
7 years ago
1.2.0
7 years ago
1.1.0
7 years ago
1.0.2
7 years ago
1.0.0
7 years ago
0.9.2
7 years ago
0.9.1
7 years ago
0.8.3
7 years ago
0.8.2
7 years ago
0.8.1
8 years ago
0.8.0
8 years ago
0.7.1
8 years ago
0.7.0
8 years ago
0.6.0
8 years ago
0.5.0
8 years ago
0.4.1
8 years ago
0.4.0
8 years ago
0.3.0
8 years ago
0.2.0
8 years ago