Skip to content

Commit

Permalink
Merge pull request BabylonJS#1796 from nockawa/Text2DDelayFont
Browse files Browse the repository at this point in the history
Canvas2D: Attempt #1 to fix Delayed FontTexture in Text2D
  • Loading branch information
nockawa committed Feb 22, 2017
2 parents f75f7b4 + 361bce5 commit c2fb3ad
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
9 changes: 9 additions & 0 deletions canvas2D/src/Engine/babylon.text2d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,15 @@
this._fontName = null;
this._fontSuperSample = false;
this._fontSDF = false;

let ft = this._fontTexture;
if (ft != null && !ft.isReady()) {
ft.onLoadObservable.add(() => {
this._positioningDirty();
this._setLayoutDirty();
this._instanceDirtyFlags |= Prim2DBase.originProperty.flagId; // To make sure the Text2D is issued again for render
});
}
} else {
this._fontName = (settings.fontName==null) ? "12pt Arial" : settings.fontName;
this._fontSuperSample= (settings.fontSuperSample!=null && settings.fontSuperSample);
Expand Down
8 changes: 8 additions & 0 deletions dist/preview release/canvas2D/babylon.canvas2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -14287,6 +14287,14 @@ var BABYLON;
_this._fontName = null;
_this._fontSuperSample = false;
_this._fontSDF = false;
var ft = _this._fontTexture;
if (ft != null && !ft.isReady()) {
ft.onLoadObservable.add(function () {
_this._positioningDirty();
_this._setLayoutDirty();
_this._instanceDirtyFlags |= BABYLON.Prim2DBase.originProperty.flagId; // To make sure the Text2D is issued again for render
});
}
}
else {
_this._fontName = (settings.fontName == null) ? "12pt Arial" : settings.fontName;
Expand Down
Loading

0 comments on commit c2fb3ad

Please sign in to comment.