Skip to content

Commit 76daa1c

Browse files
authored
tweak font size match regex
1 parent f58b8d3 commit 76daa1c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/core/platform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const platformApi: Platform = {
7575
text = text || '';
7676
font = font || DEFAULT_FONT;
7777
// Use font size if there is no other method can be used.
78-
const res = /((\d+)?\.?\d*)px/.exec(font);
78+
const res = /((?:\d+)?\.?\d*)px/.exec(font);
7979
const fontSize = res && +res[1] || DEFAULT_FONT_SIZE;
8080
let width = 0;
8181
if (font.indexOf('mono') >= 0) { // is monospace

0 commit comments

Comments
 (0)