diff --git a/src/App.tsx b/src/App.tsx index e9e253b..a01885e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -111,8 +111,9 @@ function App() { set_outType(config.supportedOutTypes?.[0] || "ttf"); } if (fontList.length > 0) { - /** 标语随机使用一个字体展示 */ - const randomFont = fontList[Math.floor(Math.random() * fontList.length)]; + /** 标语随机使用一个 TTF 字体展示(目前仅 TTF 格式兼容性最佳) */ + const ttfFonts = fontList.filter((f) => /\.ttf$/i.test(f.name)); + const randomFont = (ttfFonts.length > 0 ? ttfFonts : fontList)[Math.floor(Math.random() * (ttfFonts.length > 0 ? ttfFonts : fontList).length)]; (globalThis as any).WebFont?.loadText({ fontName: randomFont.name, text: SLOGAN, diff --git a/src/UploadSection.tsx b/src/UploadSection.tsx index e1d9659..84f7635 100644 --- a/src/UploadSection.tsx +++ b/src/UploadSection.tsx @@ -3,6 +3,9 @@ import { uploadFont, type UploadResult, type ServerConfig } from "./api"; const ACCEPT = ".ttf,.otf,.woff,.woff2"; +/** 目前仅 TTF 格式兼容性最佳,上传其他格式可能无法正常使用 */ +const UPLOAD_TIP = "当前仅 TTF 格式兼容性最佳,建议上传 .ttf 字体文件"; + const btn = { padding: "6px 20px", "font-size": "14px", @@ -173,6 +176,9 @@ export default function UploadSection(props: { config: ServerConfig; onUploaded:
+
+ {UPLOAD_TIP} +
{(m) => (