Skip to content

Commit 8332c29

Browse files
committed
Fix incorrect font styles in text bubbles
1 parent 4a913db commit 8332c29

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/TextBubbleSkin.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ class TextBubbleSkin extends Skin {
121121
*/
122122
setStyle (newStyle) {
123123
this._style = Object.assign({}, this._style, newStyle);
124+
this.measurementProvider.clearCache();
124125
this._restyleCanvas();
125126
this._textDirty = true;
126127
this._textureDirty = true;
@@ -131,7 +132,6 @@ class TextBubbleSkin extends Skin {
131132
* Re-style the canvas after resizing it. This is necessary to ensure proper text measurement.
132133
*/
133134
_restyleCanvas () {
134-
this.measurementProvider.clearCache();
135135
this._canvas.getContext('2d').font = `${this._style.fontSize}px ${this._style.font}, sans-serif`;
136136
}
137137

@@ -178,6 +178,7 @@ class TextBubbleSkin extends Skin {
178178
// Resize the canvas to the correct screen-space size
179179
this._canvas.width = Math.ceil(this._size[0] * scale);
180180
this._canvas.height = Math.ceil(this._size[1] * scale);
181+
this._restyleCanvas();
181182

182183
// Reset the transform before clearing to ensure 100% clearage
183184
ctx.setTransform(1, 0, 0, 1, 0, 0);

0 commit comments

Comments
 (0)