aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapp.mjs31
-rw-r--r--font.ttf (renamed from ocr-a-ext.ttf)bin55400 -> 55400 bytes
-rw-r--r--package-lock.json1
3 files changed, 14 insertions, 18 deletions
diff --git a/app.mjs b/app.mjs
index a558885..7325da9 100755
--- a/app.mjs
+++ b/app.mjs
@@ -4,14 +4,14 @@ import { registerFont } from "canvas";
const defaultFont = "OCR A Extended";
if (process.platform == "linux") {
- console.warn(
- "node-canvas does not support directly using font file in Linux (see https://github.com/Automattic/node-canvas/issues/2097#issuecomment-1803950952), please copy ./ocr-a-ext.ttf in this folder to your local font folder (~/.fonts/) or install it system-wide.",
- );
-} else {
- registerFont(`${import.meta.dirname}/ocr-a-ext.ttf`, {
- family: defaultFont,
- });
+ process.env.FONTCONFIG_FILE = import.meta.dirname;
+ //console.warn(
+ // "node-canvas does not support directly using font file in Linux (see https://github.com/Automattic/node-canvas/issues/2097#issuecomment-1803950952), please copy ./ocr-a-ext.ttf in this folder to your local font folder (~/.fonts/) or install it system-wide.",
+ //);
}
+registerFont(`${import.meta.dirname}/font.ttf`, {
+ family: defaultFont,
+});
import { discover, HAPTIC } from "loupedeck";
import { readFile } from "fs/promises";
@@ -241,18 +241,13 @@ const drawKey = async (id, conf, pressed) => {
c.lineWidth = 2;
c.strokeStyle = fg;
c.strokeRect(padding, padding, w - padding * 2, h - padding * 2);
-
if (conf != null) {
- renderMultiLineText(
- c,
- 0,
- 0,
- w,
- h,
- getLabels(conf),
- getTextStyles(conf),
- conf,
- );
+ const labels = getLabels(conf);
+ const styles = getTextStyles(conf);
+ for (let i = 0; i < labels.length; i++) {
+ styles.color_fg[i] = fg;
+ }
+ renderMultiLineText(c, 0, 0, w, h, labels, styles, conf);
}
// otherwise the empty key style is still drawn
});
diff --git a/ocr-a-ext.ttf b/font.ttf
index 0e77e20..0e77e20 100644
--- a/ocr-a-ext.ttf
+++ b/font.ttf
Binary files differ
diff --git a/package-lock.json b/package-lock.json
index 6ea17ef..518dbb4 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -582,6 +582,7 @@
"resolved": "https://registry.npmjs.org/canvas/-/canvas-2.11.2.tgz",
"integrity": "sha512-ItanGBMrmRV7Py2Z+Xhs7cT+FNt5K0vPL4p9EZ/UX/Mu7hFbkxSjKF2KVtPwX7UYWp7dRKnrTvReflgrItJbdw==",
"hasInstallScript": true,
+ "license": "MIT",
"dependencies": {
"@mapbox/node-pre-gyp": "^1.0.0",
"nan": "^2.17.0",