quark Posted July 28, 2020 Share Posted July 28, 2020 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); } 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); } Can't actually understand if I'm doing something wrong or if it's a misbehaviour. Thanks in advance Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted July 28, 2020 Share Posted July 28, 2020 There are many people who work with BitmapText here, sohelp is on the way Alternatively: just debug this thing. Its not a rocket science. Quote Link to comment Share on other sites More sharing options...
themoonrat Posted July 29, 2020 Share Posted July 29, 2020 The 'from' function here is meant to be to generate your own bitmap font dynamically from a text style... which uses the Text class on the background. And the Text class uses the Canvas API to generate textures. You can use custom fonts via loaded woff / woff2 files, just like in html and CSS. But you cannot use a Bitmap font as a source to draw regular Text quark 1 Quote Link to comment Share on other sites More sharing options...
quark Posted July 30, 2020 Author Share Posted July 30, 2020 19 hours ago, themoonrat said: The 'from' function here is meant to be to generate your own bitmap font dynamically from a text style... which uses the Text class on the background. And the Text class uses the Canvas API to generate textures. You can use custom fonts via loaded woff / woff2 files, just like in html and CSS. But you cannot use a Bitmap font as a source to draw regular Text Thanks for your reply and the explanation. I misunderstood it's behaviour! I already had it working with regular web fonts and somehow I expected the same behaviour to the already created BitmapFonts ? Just a simple note, I made a simple trick so that i don't need to create a bitmapFont for each text color (that share same font), every bitmapFont from an web font is generated with fill white, and then it's applied tint instead of fill to the bitmapText directly to change text color. themoonrat 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.