Jump to content

How to use Font.js with Pixi?


wijesijp
 Share

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);
      gameScene.addChild(title);
    };
    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?

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