We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 3531e47 + a7f5d46 commit 7c8974aCopy full SHA for 7c8974a
1 file changed
src/text.js
@@ -1,4 +1,5 @@
1
import mb2css from 'mapbox-to-css-font';
2
+import {checkedFonts} from 'ol/render/canvas.js';
3
import {createCanvas} from './util.js';
4
5
const hairSpacePool = Array(256).join('\u200A');
@@ -37,6 +38,12 @@ function measureText(text, letterSpacing) {
37
38
}
39
40
const measureCache = {};
41
+checkedFonts.on('propertychange', () => {
42
+ for (const key in measureCache) {
43
+ delete measureCache[key];
44
+ }
45
+});
46
+
47
export function wrapText(text, font, em, letterSpacing) {
48
if (text.indexOf('\n') !== -1) {
49
const hardLines = text.split('\n');
0 commit comments