koishi-plugin-ll-mc 3.1.11 → 3.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/fonts/digits.ttf +0 -0
- package/lib/index.js +14 -4
- package/package.json +1 -1
|
Binary file
|
package/lib/index.js
CHANGED
|
@@ -304,6 +304,17 @@ async function apply(ctx, config) {
|
|
|
304
304
|
} catch (error) {
|
|
305
305
|
logger.warn("[ll-mc] 强制更新 NotoEmoji 字体失败:", error?.message);
|
|
306
306
|
}
|
|
307
|
+
// 官机补丁(HTML 模板):系统装了 emoji 字体(如 font-noto-emoji)时,emoji 字体自带 0-9 字形
|
|
308
|
+
// (给 keycap 用)且字宽很宽,会导致所有数字被撑成 "2 9 1 7"。
|
|
309
|
+
// 这里内嵌一个只含 0-9 的极小正常字体(约 3KB),用 unicode-range 把数字锁死在它上面;
|
|
310
|
+
// 用 base64 data URI 内嵌(而非相对路径),因为 file:// 页面加载 @font-face 本地文件不可靠。
|
|
311
|
+
let digitsFontFaceCss = "";
|
|
312
|
+
try {
|
|
313
|
+
const digitsBuf = await fs.readFile(import_path.default.join(assetsDir, "fonts", "digits.ttf"));
|
|
314
|
+
digitsFontFaceCss = `@font-face { font-family: 'LLMCDigits'; src: url("data:font/ttf;base64,${digitsBuf.toString("base64")}") format('truetype'); unicode-range: U+0030-0039; }`;
|
|
315
|
+
} catch (error) {
|
|
316
|
+
logger.warn("[ll-mc] 加载 digits.ttf 失败,模板数字可能被 emoji 字体撑宽:", error?.message);
|
|
317
|
+
}
|
|
307
318
|
const avatarCache = /* @__PURE__ */ new Map();
|
|
308
319
|
let iconCache = [];
|
|
309
320
|
let barBgImgCache = [];
|
|
@@ -2471,10 +2482,9 @@ ${targetUserRecord[0].username}
|
|
|
2471
2482
|
<meta charset="UTF-8">
|
|
2472
2483
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
2473
2484
|
<style>
|
|
2474
|
-
/*
|
|
2475
|
-
emoji
|
|
2476
|
-
|
|
2477
|
-
@font-face { font-family: 'LLMCDigits'; src: url('fonts/HarmonyOS_Sans_Medium.ttf') format('truetype'); unicode-range: U+0030-0039; }
|
|
2485
|
+
/* 数字锁定:内嵌一个只含 0-9 的极小正常字体,避免被系统 emoji 字体(自带 0-9 且字宽很宽)撑成 "2 9 1 7"。
|
|
2486
|
+
其余字符(中文/字母/emoji)照常走下面的系统字体栈。 */
|
|
2487
|
+
${digitsFontFaceCss}
|
|
2478
2488
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
|
2479
2489
|
html, body {
|
|
2480
2490
|
width: 900px;
|