Lkuich Posted December 29, 2014 Share Posted December 29, 2014 Hi, I am trying to format a specific part of a Phaser.Text object as a superscript. I am using TypeScript in the project. For example:var question: Phaser.Text = this.add.text(0, 0, "3x2", { font: "24px Arial", fill: "#000", align: "center" });Looks like:3x2 But I want it to look like:3x2 Unfortunately String.prototype.sup() is depreciated. How would I get this result? I know I can use the <sup> tag, but am not sure how to use this in a Phaser.Text object. Thank you. Link to comment Share on other sites More sharing options...
lewster32 Posted December 29, 2014 Share Posted December 29, 2014 Unicode has a lot of superscript characters which you could use: http://unicode-table.com/en/search/?q=superscript for instance the '²' character. Lkuich 1 Link to comment Share on other sites More sharing options...
Lkuich Posted December 31, 2014 Author Share Posted December 31, 2014 Ah, of course. Thank you. Link to comment Share on other sites More sharing options...
terencechow Posted January 12, 2015 Share Posted January 12, 2015 Is there superscript for 'st' 'nd' 'rd' and 'th'? I'm trying to superscript 1st 2nd 3rd 4th in my game... Link to comment Share on other sites More sharing options...
satya4satyanm Posted August 12, 2020 Share Posted August 12, 2020 (edited) Looking for the same solution. Got stuck with this. Using "°" but Phaser 3 displays A above A before the degree symbol. Any example would be good. Edited August 12, 2020 by satya4satyanm Link to comment Share on other sites More sharing options...
satya4satyanm Posted August 12, 2020 Share Posted August 12, 2020 Found the solution "\u{00B0}" Link to comment Share on other sites More sharing options...
Recommended Posts