From ce0d24490c6416b952359954e6a2c929e4e8a782 Mon Sep 17 00:00:00 2001 From: Jake Wang Date: Sat, 4 Feb 2023 07:55:33 +0800 Subject: [PATCH] Minor improvement to reduce function call --- src/canvas-txt/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/canvas-txt/index.ts b/src/canvas-txt/index.ts index 511ea94..48d757d 100644 --- a/src/canvas-txt/index.ts +++ b/src/canvas-txt/index.ts @@ -81,7 +81,7 @@ const canvasTxt = { while (textpixlen < linelen) { textlen++ texttoprint = temptext.substr(0, textlen) - textpixlen = ctx.measureText(temptext.substr(0, textlen)).width + textpixlen = ctx.measureText(texttoprint).width } // Remove last character that was out of the box textlen--