Skip to content

Commit 79dc611

Browse files
committed
Quote the font family in Text objects.
1 parent 58c8ae8 commit 79dc611

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@ one set of bindings ever created, which makes things a lot cleaner.
288288
* `CanvasTexture.destroy` is a new method that specifically handles the destruction of the CanvasTexture and all of its associated typed arrays. This prevents a memory leak when creating and destroying lots of RenderTextures (which are CanvasTexture backed). Fix #4239 (thanks @sjb933)
289289
* The Alpha, Flip and Origin components have been removed from the Mesh Game Object (and by extension, Quad as well) as they are not used in the renderer and should be manipulated via the Mesh properties. Fix #4188 (thanks @enriqueto)
290290
* The `processDomCallbacks` method in the Input Manager wasn't correctly clearing the `once` arrays. Responsibility for this has now been passed to the queue methods `queueTouchStart`, `queueTouchMove`, `queueTouchEnd`, `queueMouseDown`, `queueMouseMove` and `queueMouseUp`. Fix #4257 (thanks @iArePJ)
291+
* The fontFamily in the Text object is now quoted when synced to the Canvas context, this fixes an issue where you couldn't use web fonts that had numbers in the name, such as "Press Start 2P" (thanks @BeFiveINFO)
291292

292293
### Examples and TypeScript
293294

src/gameobjects/text/TextStyle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ var TextStyle = new Class({
397397
this.setFont(font, false);
398398
}
399399

400-
this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim();
400+
this._font = [ this.fontStyle, this.fontSize, '"' + this.fontFamily + '"' ].join(' ').trim();
401401

402402
// Allow for 'fill' to be used in place of 'color'
403403
var fill = GetValue(style, 'fill', null);
@@ -493,7 +493,7 @@ var TextStyle = new Class({
493493
{
494494
if (recalculateMetrics)
495495
{
496-
this._font = [ this.fontStyle, this.fontSize, this.fontFamily ].join(' ').trim();
496+
this._font = [ this.fontStyle, this.fontSize, '"' + this.fontFamily + '"' ].join(' ').trim();
497497

498498
this.metrics = MeasureText(this);
499499
}

0 commit comments

Comments
 (0)