diff --git a/demo/OpenSans-Bold.ttf b/demo/OpenSans-Bold.ttf
new file mode 100644
index 0000000..a1398b3
Binary files /dev/null and b/demo/OpenSans-Bold.ttf differ
diff --git a/demo/OpenSans-Regular.ttf b/demo/OpenSans-Regular.ttf
new file mode 100644
index 0000000..1dc226d
Binary files /dev/null and b/demo/OpenSans-Regular.ttf differ
diff --git a/demo/Roboto-Bold.ttf b/demo/Roboto-Bold.ttf
deleted file mode 100644
index 43da14d..0000000
Binary files a/demo/Roboto-Bold.ttf and /dev/null differ
diff --git a/demo/Roboto-Regular.ttf b/demo/Roboto-Regular.ttf
deleted file mode 100644
index ddf4bfa..0000000
Binary files a/demo/Roboto-Regular.ttf and /dev/null differ
diff --git a/demo/index.html b/demo/index.html
index 393dc44..731da81 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -41,9 +41,9 @@
Internal Preview
const style = new PIXI.HTMLTextStyle({
fontSize: 40,
- fontFamily: ['Roboto', 'Arial'],
+ fontFamily: ['OpenSans', 'Courier New'],
align: 'justify',
- letterSpacing: 3,
+ letterSpacing: 1,
wordWrap: true,
wordWrapWidth: 600,
lineHeight: 48,
@@ -59,24 +59,31 @@ Internal Preview
const text = 'Lorem ipsum dolor sit amet, 🚀 consectetur adipiscing elit.
Phasellus porta nisi est, vitae sagittis ex gravida ac. Sed vitae malesuada neque.';
const text2 = new PIXI.HTMLText(text, style);
- text2.texture.baseTexture.on('update', () => app.render());
+ text2.texture.baseTexture.on('update', () => {
+ app.render();
+ refreshBounds();
+ });
text2.y = 20;
text2.x = 20;
// Load the font weights
Promise.all([
- text2.style.loadFont('./Roboto-Regular.ttf', { family: 'Roboto' }),
- text2.style.loadFont('./Roboto-Bold.ttf', { family: 'Roboto', weight: 'bold' }),
+ text2.style.loadFont('./OpenSans-Regular.ttf', { family: 'OpenSans' }),
+ text2.style.loadFont('./OpenSans-Bold.ttf', { family: 'OpenSans', weight: 'bold' }),
]).then(() => app.render());
document.getElementById('text').appendChild(text2.canvas);
+ const rect = new PIXI.Graphics();
+
+ const refreshBounds = () => rect
+ .clear()
+ .beginFill(0, 0.01)
+ .lineStyle({ color: 0xffffff, width: 1, native: true })
+ .drawRect(text2.x, text2.y, text2.width, text2.height);
- const rect = new PIXI.Graphics()
- .beginFill(0, 0)
- .lineStyle({ color: 0xff0000, width: 1, native: true })
- .drawShape(text2.getBounds());
+ refreshBounds();
- app.stage.addChild(rect, text2);
+ app.stage.addChild(text2, rect);