Text#addFontStyle()

addFontStyle(style, position) → {Phaser.Text}

Set specific font styles for certain characters within the Text.

It works by taking a font style value, which is a typical string such as normal, italic or oblique.
The position value is the index of the character in the Text string to start applying this font style to.
Once set the font style remains in use until either another font style or the end of the string is encountered.
For example if the Text was Photon Storm and you did Text.addFontStyle('italic', 6) it would font style in the word Storm in italic.

If you wish to change the text font weight see addFontWeight instead.

Parameters
Name Type Description
style string

A canvas font-style that will be used on the text style eg normal, italic, oblique.

position number

The index of the character in the string to start applying this font style value from.

Returns

This Text instance.

Source code: gameobjects/Text.js (Line 879)
doc_phaser
2017-02-14 11:13:24
Comments
Leave a Comment

Please login to continue.