Jump to content

Pixi text


Enigmafan
 Share

Recommended Posts

Hi all,

 

another question (still working on the sprite stuff from another question, but in the meanwhile); how can I include a ttf file for Pixi to use. It seems that every example I see does not work for me. It is a ttf file that is not available standard in browser, it needs to be included.

 

If anyone can provide me with a an example, just the basics, I'd be very happy :-)

 

Thanx.

Link to comment
Share on other sites

Pixi use the canvas to draw text, so the same requirement for using external font are needed, I found this post on stackoverflow which explain how you can use css @font-face to make a font available for the canvas to use.

 

http://stackoverflow.com/questions/2608022/how-can-i-use-custom-fonts-in-an-html5-canvas-element

 

If your font doesn't work make sure it has been preloaded:

 

http://stackoverflow.com/questions/2756575/drawing-text-to-canvas-with-font-face-does-not-work-at-the-first-time

Link to comment
Share on other sites

Of course, a font is only useful as a bitmap font if you use it in one or two fixed sizes, and if the font does not have too many glyphs (i.e. unicode).

 

For other cases, there are multiple great online tools that generate font files for the different browsers and a nice piece of CSS code you can put in your site to load them. I've had good experiences with FontSquirrel myself.

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...