Text#addFontWeight()

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

Set specific font weights for certain characters within the Text.

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

If you wish to change the text font style see addFontStyle instead.

Parameters
Name Type Description
style string

A canvas font-weight that will be used on the text weight eg normal, bold, bolder, lighter, etc.

position number

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

Returns

This Text instance.

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

Please login to continue.