Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Displaying text

The Graphic Entity Module includes two different classes to display text, here's how they work.


The basic class to display text, it will be displayed as a label in the viewer.

graphicEntityModule.createText("Hello World")
    .setStrokeThickness(5) // Adding an outline
    .setStrokeColor(0xffffff) // a white outline
    .setFillColor(0x000000); // Setting the text color to black


The only font family values that will work are: "Lato" and those that are available by default on all browsers. If the browser does not recognise the font family, it will be displayed in a fallback font chosen by the browser.


This class is used to display text using a bitmap font in your assets folder.

    .setText("Hello World")
    // Assuming that you have a working 'myCustomFont.fnt' and 'myCustomFont.png' in your assets folder
    .setTint(0xff0000); // Tinting it in red


Extra tips :

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content