Skip to content

Commit

Permalink
tweak font size match regex
Browse files Browse the repository at this point in the history
  • Loading branch information
plainheart authored May 14, 2024
1 parent f58b8d3 commit 76daa1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export const platformApi: Platform = {
text = text || '';
font = font || DEFAULT_FONT;
// Use font size if there is no other method can be used.
const res = /((\d+)?\.?\d*)px/.exec(font);
const res = /((?:\d+)?\.?\d*)px/.exec(font);
const fontSize = res && +res[1] || DEFAULT_FONT_SIZE;
let width = 0;
if (font.indexOf('mono') >= 0) { // is monospace
Expand Down

0 comments on commit 76daa1c

Please sign in to comment.