Jump to content

Text fontSize doesn't do anything


Recommended Posts

Following the usual nine-part Phaser tutorial on making a platformer, I see code like:

scoreText = game.add.text(16, 16, 'score: 0', { fontSize: '32px', fill: '#000' });

Changing the fontSize property doesn't do anything. I tried multiple values (8px, 72px, etc.) as well as different types ('72px', '72pt', '72', 72, etc.) -- all to no avail.


Am I doing something wrong?

Link to comment
Share on other sites

I bookmarked the Phaser docs on text styles and refer to them frequently - take a look here: http://docs.phaser.io/Phaser.Text.html#setStyle


What you're looking for is the font property - so your code should look like:

scoreText = game.add.text(16, 16, 'score: 0', { font: '32pt Arial', fill: '#000' });

(assuming you want to use Arial  :) )

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.

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.


  • Recently Browsing   0 members

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