Skip to content

Latest commit

 

History

History
 
 

text

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Text

Text writing.

Installation

npm install @pencil.js/text

Examples

import Text from "@pencil.js/text";

const options = {
    font: "comic-sans",
    fontSize: 42
};
const text = new Text(aPosition, "Hello world !", options);

// Can be use to preload a bunch of fonts
Text.load([url1, url2, url3]).then(() => {
    console.log("Fonts ready");
});

Be aware that this example overrides Javascript's Text global. Use namespace to avoid this issue.

import * as Namespace from "@pencil.js/text";
new Namespace.Text();