Skip to content

Commit

Permalink
Canvas2D: Attempt #1 to fix Delayed FontTexture in Text2D
Browse files Browse the repository at this point in the history
  • Loading branch information
nockawa committed Feb 22, 2017
1 parent 6900730 commit b667685
Showing 1 changed file with 9 additions and 0 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

0 comments on commit b667685

Please sign in to comment.