How to use Font.js with Pixi?

Recommended Posts

I am new to pixijs development.

I am trying display some text using Font.js


var font = new Font();
    font.onload = function() {
      var title = new PIXI.Text("This is a test", {
        fontFamily: "48px A.C.M.E. Secret Agent"
      title.position.set(100, 100);
    font.onerror = function(err) {
      console.log("font error " + err);
    font.fontFamily = "A.C.M.E. Secret Agent";
    font.src = "fonts/acmesa.ttf";


But I am getting a warning 

Failed to decode downloaded font: data:application/x-font-

OTS parsing error: post: Failed to parse table

And the text is not getting displayed with the correct ttf font.

Can someone post a simple example showing how to use pixijs with Font.js?

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.