Skip to content

Commit d6f5aab

Browse files
committed
The TextStyle.resolution property is no longer read from the Game Config. You can still set it via the Text Style config to a value other than 1, but it will default to this now.
1 parent 0acdf43 commit d6f5aab

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/gameobjects/text/static/Text.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ var TextStyle = require('../TextStyle');
1919
/**
2020
* @classdesc
2121
* A Text Game Object.
22-
*
22+
*
2323
* Text objects work by creating their own internal hidden Canvas and then renders text to it using
2424
* the standard Canvas `fillText` API. It then creates a texture from this canvas which is rendered
2525
* to your game during the render pass.
26-
*
26+
*
2727
* Because it uses the Canvas API you can take advantage of all the features this offers, such as
2828
* applying gradient fills to the text, or strokes, shadows and more. You can also use custom fonts
2929
* loaded externally, such as Google or TypeKit Web fonts.
@@ -46,7 +46,7 @@ var TextStyle = require('../TextStyle');
4646
*
4747
* See {@link http://www.jordanm.co.uk/tinytype this compatibility table} for the available default fonts
4848
* across mobile browsers.
49-
*
49+
*
5050
* A note on performance: Every time the contents of a Text object changes, i.e. changing the text being
5151
* displayed, or the style of the text, it needs to remake the Text canvas, and if on WebGL, re-upload the
5252
* new texture to the GPU. This can be an expensive operation if used often, or with large quantities of
@@ -220,7 +220,7 @@ var Text = new Class({
220220
* The line spacing value.
221221
* This value is added to the font height to calculate the overall line height.
222222
* Only has an effect if this Text object contains multiple lines of text.
223-
*
223+
*
224224
* If you update this property directly, instead of using the `setLineSpacing` method, then
225225
* be sure to call `updateText` after, or you won't see the change reflected in the Text object.
226226
*
@@ -240,10 +240,10 @@ var Text = new Class({
240240
*/
241241
this.dirty = false;
242242

243-
// If resolution wasn't set, then we get it from the game config
243+
// If resolution wasn't set, force it to 1
244244
if (this.style.resolution === 0)
245245
{
246-
this.style.resolution = scene.sys.game.config.resolution;
246+
this.style.resolution = 1;
247247
}
248248

249249
/**
@@ -680,10 +680,10 @@ var Text = new Class({
680680
* ```javascript
681681
* Text.setFont('"Press Start 2P"');
682682
* ```
683-
*
683+
*
684684
* Equally, if you wish to provide a list of fallback fonts, then you should ensure they are all
685685
* quoted properly, too:
686-
*
686+
*
687687
* ```javascript
688688
* Text.setFont('Georgia, "Goudy Bookletter 1911", Times, serif');
689689
* ```
@@ -951,9 +951,9 @@ var Text = new Class({
951951

952952
/**
953953
* Set the alignment of the text in this Text object.
954-
*
954+
*
955955
* The argument can be one of: `left`, `right`, `center` or `justify`.
956-
*
956+
*
957957
* Alignment only works if the Text object has more than one line of text.
958958
*
959959
* @method Phaser.GameObjects.Text#setAlign
@@ -973,10 +973,10 @@ var Text = new Class({
973973
*
974974
* By default it will be set to match the resolution set in the Game Config,
975975
* but you can override it via this method, or by specifying it in the Text style configuration object.
976-
*
976+
*
977977
* It allows for much clearer text on High DPI devices, at the cost of memory because it uses larger
978978
* internal Canvas textures for the Text.
979-
*
979+
*
980980
* Therefore, please use with caution, as the more high res Text you have, the more memory it uses.
981981
*
982982
* @method Phaser.GameObjects.Text#setResolution
@@ -1233,9 +1233,9 @@ var Text = new Class({
12331233
var spaceSize = context.measureText(' ').width;
12341234
var trimmedLine = lines[i].trim();
12351235
var array = trimmedLine.split(' ');
1236-
1236+
12371237
extraSpace += (lines[i].length - trimmedLine.length) * spaceSize;
1238-
1238+
12391239
var extraSpaceCharacters = Math.floor(extraSpace / spaceSize);
12401240
var idx = 0;
12411241

@@ -1245,7 +1245,7 @@ var Text = new Class({
12451245
idx = (idx + 1) % (array.length - 1 || 1);
12461246
--extraSpaceCharacters;
12471247
}
1248-
1248+
12491249
lines[i] = array.join(' ');
12501250
}
12511251
}

0 commit comments

Comments
 (0)