Jump to content

Embed retro font text into bitmap data


LLp
 Share

Recommended Posts

I actually create an image with embedded text like this:

 

 

GroupFactory.prototype.createImgFromImgAndText = function (type, text) {
var dataImg = this.game.cache.getFrame(type), bmd;
bmd = this.game.make.bitmapData(dataImg.width, dataImg.height);
bmd.load(type);
if (text === undefined) {
return bmd;
}
bmd.ctx.fillStyle = "#000000";
bmd.ctx.font = '25px san-serif';
bmd.ctx.fillText(text, 10, 50);
return bmd;
};

 

How can I do this with a retro font ?

 

This hasn't worked

 

 

GroupFactory.prototype.createImgFromImgAndText function (typetext) {
var dataImg = this.game.cache.getFrame(type)bmd;
bmd = this.game.make.bitmapData(dataImg.widthdataImg.height);
bmd.load(type);
if (text === undefined) {
return bmd;
}
bmd.ctx.fillStyle "#000000";
bmd.ctx.font this.game.add.retroFont('myfont', 60, 60, ",!?abcdefghijklmnopqrstuvwxyz.", 5, 0, 0, 0, 0);
bmd.ctx.fillText(text1050);
return bmd;
};

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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