Quantcast
Channel: Pixi.js Latest Topics
Viewing all articles
Browse latest Browse all 3978

Can't create custom BitmapFont

$
0
0

Good morning, I created a font using bmGlyph and exported as 'Sparrow/Starling' to use with pixi.

 

Using the font directly on the bitmapText style works correctly:

// Load font
app.loader.add('dafont', 'dafont.fnt').load(startup);

function startup() {
   const text = new PIXI.BitmapText('ABCDEFGHIJLMNOPQRSTUVWXYZ\nabcdefghijlmnopqrstuvwxyz\n0123456789', { fontName: 'dafont' });
   app.stage.addChild(text);
}   

result_correct.png

Trying to create a bitmapFont with a custom style it just doesnt' apply the intended font: 

// Load font
app.loader.add('dafont', 'dafont.fnt').load(startup);

function startup()
{
   PIXI.BitmapFont.from('bestfont', {fontName: 'dafont', size: 48});
   const text = new PIXI.BitmapText('ABCDEFGHIJLMNOPQRSTUVWXYZ\nabcdefghijlmnopqrstuvwxyz\n0123456789', { fontName: 'bestfont' });
   app.stage.addChild(text);
}   

result_wrong.png

Can't actually understand if I'm doing something wrong or if it's a misbehaviour.

Thanks in advance :)


Viewing all articles
Browse latest Browse all 3978

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>