Skip to content

Commit

Permalink
fix: platform-fontSize-reg
Browse files Browse the repository at this point in the history
  • Loading branch information
Unlasting1 committed May 13, 2024
1 parent 379f91f commit f58b8d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 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+)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 Expand Up @@ -108,4 +108,4 @@ export function setPlatformAPI(newPlatformApis: Partial<Platform>) {
(platformApi as any)[key] = (newPlatformApis as any)[key];
}
}
}
}

0 comments on commit f58b8d3

Please sign in to comment.