From a0459c06b451a7dc5a8816858544bddee9dc86b2 Mon Sep 17 00:00:00 2001 From: Freubert <46076489+Freubert@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:00:23 +0200 Subject: [PATCH] remove special chars for 7seg font --- apps/lcdclock/app.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/lcdclock/app.js b/apps/lcdclock/app.js index 77e1afdf08..bf0ea83e9f 100644 --- a/apps/lcdclock/app.js +++ b/apps/lcdclock/app.js @@ -38,7 +38,7 @@ let clockInfoDraw = (itm, info, options) => { if (info.img) g.drawImage(info.img, options.x+2, options.y+2); var title = clockInfoItems[options.menuA].name; - var text = info.text.toString().toUpperCase(); + var text = info.text.toString().toUpperCase().replace(/[^A-Z0-9]/g, ""); if (title!="Bangle") g.setFontAlign(1,0).drawString(title.toUpperCase(), options.x+options.w-2, options.y+14); if (g.setFont("7Seg:2").stringWidth(text)+8>options.w) g.setFont("7Seg"); g.setFontAlign(0,0).drawString(text, options.x+options.w/2, options.y+40); @@ -82,4 +82,4 @@ Bangle.drawWidgets(); let clockInfoItems = require("clock_info").load(); let clockInfoMenu = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:R.x, y:R.y, w:midX-2, h:barY-R.y-2, draw : clockInfoDraw}); let clockInfoMenu2 = require("clock_info").addInteractive(clockInfoItems, { app:"lcdclock", x:midX+2, y:R.y, w:midX-3, h:barY-R.y-2, draw : clockInfoDraw}); -} \ No newline at end of file +}