Jump to content

PIXI.BitmapText font from PIXI.TextStyle


Steve73
 Share

Recommended Posts

Is there a way to create a BitmapText font from a PIXI.TextStyle? I would like to combine pre-installed system fonts, that don‘t require any downloads, with the performance of BitmapText.

If I use a Bitmap font consisting of a png and fnt file the download size of my app is increased by ~70kB. If I use PIXI.Text the text rendering of my app gets too slow.

Link to comment
Share on other sites

Thank you for your prompt reply! Yes, the that‘s what I‘m looking for! I think this functionality would be a really nice addition to the API. Something like:

const style = new PIXI.TextStyle({
    fontFamily: "Verdana"
});

// ### some function to convert the style into a loaded bitmap font

let bitmapText = new PIXI.BitmapText("text using a fancy font!", {font: "Verdana"});

My usecase is a mmo game with many players on the screen (can be more than 100 players). Every player has a player name shown above his player sprite). Additionally players can send short messages which are also shown above the player.

As a consequence I have hundreds of PIXI.Text objects. The creation of these objects during startup takes several seconds. But I want the game start instantly. Actually it does (thanks to PIXI’s incredible speed and minimal footprint!). Only the Text object creation takes too long.

 

 

Link to comment
Share on other sites

Thanks. Currently I‘m using v5. I don‘t really want to go back to v4.

After thinking this through, I‘m planning to use BitmapText objects and live with the increased download size until the required text-related plugins are available or I find the time to write the „TextStyle to BitmapText“ converter myself.

Thanks again for your prompt feedback! It was highly appreciated.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...