widalarmeta: Only load required font
parent
957ccc431a
commit
e8a5d68d7d
|
|
@ -1,7 +1,4 @@
|
||||||
(() => {
|
(() => {
|
||||||
require("Font5x9Numeric7Seg").add(Graphics);
|
|
||||||
require("FontTeletext5x9Ascii").add(Graphics);
|
|
||||||
|
|
||||||
let config;
|
let config;
|
||||||
|
|
||||||
function loadSettings() {
|
function loadSettings() {
|
||||||
|
|
@ -12,6 +9,12 @@
|
||||||
showSeconds: 0, // 0=never, 1=only when display is unlocked, 2=for less than a minute
|
showSeconds: 0, // 0=never, 1=only when display is unlocked, 2=for less than a minute
|
||||||
font: 1, // 0=segment style font, 1=teletext font, 2=6x8:1x2
|
font: 1, // 0=segment style font, 1=teletext font, 2=6x8:1x2
|
||||||
}, require("Storage").readJSON("widalarmeta.json",1) || {});
|
}, require("Storage").readJSON("widalarmeta.json",1) || {});
|
||||||
|
|
||||||
|
if (config.font == 0) {
|
||||||
|
require("Font5x9Numeric7Seg").add(Graphics);
|
||||||
|
} else if (config.font == 1) {
|
||||||
|
require("FontTeletext5x9Ascii").add(Graphics);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
|
|
@ -68,13 +71,13 @@
|
||||||
if (drawSeconds) {
|
if (drawSeconds) {
|
||||||
text += ":" + seconds.padStart(2, '0');
|
text += ":" + seconds.padStart(2, '0');
|
||||||
}
|
}
|
||||||
if (config.font == 1) {
|
if (config.font == 0) {
|
||||||
|
g.setFont("5x9Numeric7Seg:1x2");
|
||||||
|
} else if (config.font == 1) {
|
||||||
g.setFont("Teletext5x9Ascii:1x2");
|
g.setFont("Teletext5x9Ascii:1x2");
|
||||||
} else if (config.font == 2) {
|
|
||||||
g.setFont("6x8:1x2");
|
|
||||||
} else {
|
} else {
|
||||||
// Default to this if no other font is set.
|
// Default to this if no other font is set.
|
||||||
g.setFont("5x9Numeric7Seg:1x2");
|
g.setFont("6x8:1x2");
|
||||||
}
|
}
|
||||||
g.drawString(text, this.x+1, this.y+12);
|
g.drawString(text, this.x+1, this.y+12);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue