pebblepp 0.04: Ensure we only scale down clockinfo text if it really won't fit

master
Gordon Williams 2023-08-08 17:14:00 +01:00
parent fb2ffa4957
commit 57a9dd027f
3 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,5 @@
0.01: First release 0.01: First release
0.02: clock_info now uses app name to maintain settings specifically for this clock face 0.02: clock_info now uses app name to maintain settings specifically for this clock face
ensure clockinfo text is usppercase (font doesn't render lowercase) ensure clockinfo text is usppercase (font doesn't render lowercase)
0.03: Use smaller font if clock_info test doesn't fit in area 0.03: Use smaller font if clock_info test doesn't fit in area
0.04: Ensure we only scale down clockinfo text if it really won't fit

View File

@ -97,10 +97,10 @@ let clockInfoDraw = (itm, info, options) => {
} }
g.setFontLECO1976Regular22().setFontAlign(0, 0); g.setFontLECO1976Regular22().setFontAlign(0, 0);
var txt = info.text.toString().toUpperCase(); var txt = info.text.toString().toUpperCase();
if (g.stringWidth(txt) > options.w-4) // if too big, smaller font if (g.stringWidth(txt) > options.w) // if too big, smaller font
g.setFontLECO1976Regular14(); g.setFontLECO1976Regular14();
if (g.stringWidth(txt) > options.w-4) {// if still too big, split to 2 lines if (g.stringWidth(txt) > options.w) {// if still too big, split to 2 lines
var l = g.wrapString(txt, options.w-2); var l = g.wrapString(txt, options.w);
txt = l.slice(0,2).join("\n") + (l.length>2)?"...":""; txt = l.slice(0,2).join("\n") + (l.length>2)?"...":"";
} }
g.drawString(txt, midx,options.y+options.h-12); // draw the text g.drawString(txt, midx,options.y+options.h-12); // draw the text

View File

@ -2,7 +2,7 @@
"id": "pebblepp", "id": "pebblepp",
"name": "Pebble++ Clock", "name": "Pebble++ Clock",
"shortName": "Pebble++", "shortName": "Pebble++",
"version": "0.03", "version": "0.04",
"description": "A pebble style clock (based on the 'Pebble Clock' app) but with two configurable ClockInfo items at the top", "description": "A pebble style clock (based on the 'Pebble Clock' app) but with two configurable ClockInfo items at the top",
"icon": "app.png", "icon": "app.png",
"screenshots": [{"url":"screenshot.png"}], "screenshots": [{"url":"screenshot.png"}],