mirror of
https://github.com/YuleBest/FontMM.git
synced 2026-12-04 05:44:50 +08:00
Compare commits
54
Commits
No files matched your search
@@ -1 +0,0 @@
|
||||
template/*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Build & Upload Artifacts
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 11
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
cache-dependency-path: web/pnpm-lock.yaml
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm -C web install --frozen-lockfile
|
||||
|
||||
- name: Build WebUI
|
||||
run: pnpm -C web build
|
||||
|
||||
- name: Pack module (preplace / template)
|
||||
run: bash dev/cd.sh
|
||||
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: fontmm-build
|
||||
path: dist/*.zip
|
||||
retention-days: 14
|
||||
@@ -1,50 +0,0 @@
|
||||
name: Release Package & Attach
|
||||
|
||||
# 触发条件:当发布(published)一个 Release 时
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
upload-assets:
|
||||
runs-on: ubuntu-latest
|
||||
# 授予写入 Release 内容的权限
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
# 1. 拉取代码并包含 LFS
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
- name: Pull LFS objects
|
||||
run: git lfs pull
|
||||
|
||||
# 2. 准备打包环境并压缩
|
||||
- name: Cleanup and Zip
|
||||
id: pack
|
||||
run: |
|
||||
# 删除 .gitattributes
|
||||
rm -f .gitattributes
|
||||
|
||||
# 获取当前 Release 的 Tag 名字 (比如 V1.1)
|
||||
TAG_NAME="${{ github.event.release.tag_name }}"
|
||||
# 按照你的要求命名:FontMM-[Tag]-release.zip
|
||||
FILENAME="FontMM-${TAG_NAME}-release.zip"
|
||||
|
||||
# 执行最高压缩
|
||||
zip -r -9 "$FILENAME" . -x "*.git*" ".github*"
|
||||
|
||||
# 存入环境变量供下一步引用
|
||||
echo "ZIP_PATH=$FILENAME" >> $GITHUB_ENV
|
||||
|
||||
# 3. 将打包好的文件上传到当前的 Release 页面
|
||||
- name: Upload Release Asset
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
# files 指向刚才生成的压缩包路径
|
||||
files: ${{ env.ZIP_PATH }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,42 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 11
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
cache-dependency-path: web/pnpm-lock.yaml
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm -C web install --frozen-lockfile
|
||||
|
||||
- name: Build WebUI
|
||||
run: pnpm -C web build
|
||||
|
||||
- name: Pack module (preplace / template)
|
||||
run: bash dev/cd.sh
|
||||
|
||||
- name: Upload release assets
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: dist/*.zip
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Executable → Regular
+9
-2
@@ -1,2 +1,9 @@
|
||||
/.build/
|
||||
/ttf/*.ttf
|
||||
node_modules/
|
||||
web/node_modules/
|
||||
dist/
|
||||
src/webroot/
|
||||
reasonix.toml
|
||||
.reasonix/
|
||||
.agent/
|
||||
|
||||
.ref/
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["oxc.oxc-vscode"]
|
||||
}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
{
|
||||
// 官方推荐: https://oxc.rs/docs/guide/usage/linter/editors.html
|
||||
// https://oxc.rs/docs/guide/usage/formatter/editors.html
|
||||
// 使用 Oxc 扩展 (oxlint --lsp / oxfmt --lsp), 需本地安装 oxlint 与 oxfmt
|
||||
"editor.defaultFormatter": "oxc.oxc-vscode",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll.oxc": "always"
|
||||
},
|
||||
// 显式指定 JavaScript/TypeScript 由 oxfmt 格式化
|
||||
"[javascript]": {
|
||||
"editor.defaultFormatter": "oxc.oxc-vscode"
|
||||
},
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "oxc.oxc-vscode"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2026 Yule
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -1,26 +1,267 @@
|
||||
# FontMM
|
||||
|
||||
FontMM 是一个用于在 Android 设备上一键生成 Magisk 字体模块的工具集
|
||||
FontMM 是一个用于在 ColorOS 设备上一键更换系统字体的 **Magisk / KernelSU 模块**,内置 WebUI 字体管理界面。
|
||||
|
||||
**目前已适配系统:**
|
||||
只需在 WebUI 中挑选一个 `.ttf` 字体文件,点一下「应用字体」,重启即可生效——不需要在电脑上手动解压、改名、打包模块。
|
||||
|
||||
- ColorOS 16
|
||||
> 当前为 v26 架构(WebUI + 统一 `apply.sh` 安装逻辑),旧版 v1.x 的「解压模板 → 放入 ttf → 运行打包脚本」流程已被取代。
|
||||
|
||||
## 使用方法
|
||||
## 特性
|
||||
|
||||
1. 在 Release 下载最新版本
|
||||
- **内置 WebUI**:Material Design 3 风格的管理界面,在 KernelSU 管理器(或支持 WebUI 的 Root 管理器)中直接打开
|
||||
- **五槽位字体**:中文简体 / 中文繁体 / 英文与数字 / 等宽 / Emoji 分别独立设置
|
||||
- **智能回退**:繁体、英文未设置时自动回退到简体
|
||||
- **可视化文件选择器**:浏览设备目录、仅显示 `.ttf` 文件
|
||||
- **安装自检**:刷入时自动校验 ColorOS 版本、KernelSU 元模块、FontLoader 版本
|
||||
- **更新模式**:覆盖安装/更新模块时自动继承旧版模块中已设置的字体
|
||||
- **补充字库**:内置 OFL/MIT 许可字体,兜底 CJK 扩展区、最新 Unicode 字符与小篆(Seal)等罕见字形
|
||||
|
||||
2. 将下载到的压缩包进行解压,请确保所有文件均被解压
|
||||
## 支持环境
|
||||
|
||||
3. 自定义 `module.prop`(可选)
|
||||
| 项目 | 要求 |
|
||||
| --------- | ----------------------------------------------------------------------------------------- |
|
||||
| 系统 | ColorOS 16.0+(检测 `ro.build.version.oplus.api` 与 `ro.build.version.oplusrom.display`) |
|
||||
| Root 环境 | Magisk 20.4+ / KernelSU(KernelSU ≥ 3.0.0 需先安装元模块) |
|
||||
| 推荐组件 | [FontLoader](https://github.com/KernelSU-Modules-Repo/fontloader) v1.2.3+(提升字体显示) |
|
||||
| 字体格式 | `.ttf`(支持可变字体) |
|
||||
|
||||
4. 在 `ttf/` 里面放入你的字体
|
||||
> 非 ColorOS 系统、ColorOS 版本低于 16 的设备会在安装时被 `customize.sh` 直接拒绝。
|
||||
|
||||
- `ch.ttf` -- 中文(简体)
|
||||
- `tc.ttf` -- 中文(繁体)
|
||||
- `en.ttf` -- 英文和数字
|
||||
## 安装
|
||||
|
||||
你也可以只放入一个 `ch.ttf`
|
||||
这样的话,中文(繁体)和英数都会使用 `ch.ttf`
|
||||
### 选择版本
|
||||
|
||||
3. 使用 Root 权限运行 `开始打包.sh`
|
||||
每个 Release 提供两个压缩包,区别仅在是否预置字体:
|
||||
|
||||
| 版本 | FONT 目录 | 适用场景 |
|
||||
| ----------------------- | ------------------------------------------ | --------------------------------------------------------------------------- |
|
||||
| `FontMM_*_preplace.zip` | 含预置简体字体 `FONTS/hans.ttf`(约 20MB) | **全新安装**:刷入后立即可用默认字体,随后可再在 WebUI 更换 |
|
||||
| `FontMM_*_template.zip` | `FONTS/` 为空目录(约 3MB) | **更新已有模块**:`customize.sh` 会自动从旧模块继承已设置的字体,包体积更小 |
|
||||
|
||||
选择建议:
|
||||
|
||||
- **首次安装**:用 `_preplace` 版,开箱即用;如果用 `_template` 版,刷入后需先在 WebUI 设置简体字体,否则 `apply.sh` 会因缺少 `hans.ttf` 报错。
|
||||
- **更新已安装的模块**:用 `_template` 版——更新模式会从旧模块的 `FONTS/` 目录继承 `hans.ttf` / `hant.ttf` / `en.ttf` / `mono.ttf` / `emoji.ttf`,无需重新设置字体,也不浪费下载预置字体。
|
||||
- 在线更新(KernelSU 管理器检测到新版本时)走 `update.json`,其 `zipUrl` 指向 `_template` 版,行为同上。
|
||||
|
||||
### 安装步骤
|
||||
|
||||
1. 按上述说明下载对应版本(`FontMM_v*.zip`)
|
||||
2. 在 KernelSU / Magisk 管理器中刷入该 zip(无需解压)
|
||||
3. 安装脚本自动完成系统检查与字体安装,日志会给出「成功 / 失败原因」
|
||||
4. **重启设备**
|
||||
|
||||
## 使用
|
||||
|
||||
### 通过 WebUI 更换字体
|
||||
|
||||
1. 打开 KernelSU 管理器,进入 FontMM 模块,点击「打开 WebUI」
|
||||
2. 在槽位中分别选择字体:
|
||||
- **中文简体**——必选
|
||||
- **中文繁体**——可选,未选择时自动使用简体
|
||||
- **英文 & 数字**——可选,未选择时自动使用简体
|
||||
- **等宽字体**——可选,未选择时不覆盖系统等宽字体
|
||||
- **Emoji 表情**——可选,未选择时使用系统默认 Emoji
|
||||
3. 点击「应用字体」,弹窗展示完整应用日志
|
||||
4. **重启设备**后生效
|
||||
|
||||
### 手动放置字体(可选)
|
||||
|
||||
1. 把字体放入 `/data/adb/modules/FontMM/FONTS/`,命名规则:
|
||||
- `hans.ttf`——中文简体(必选)
|
||||
- `hant.ttf`——中文繁体(可选)
|
||||
- `en.ttf`——英文与数字(可选)
|
||||
- `mono.ttf`——等宽字体(可选)
|
||||
- `emoji.ttf`——Emoji 表情(可选)
|
||||
2. 在 Root 管理器中点击本模块的「执行」(Action),或执行 `sh /data/adb/modules/FontMM/apply.sh`
|
||||
3. 重启设备
|
||||
|
||||
## 字体映射
|
||||
|
||||
模块把 5 个用户字体槽位映射到 ColorOS 的系统字体文件:
|
||||
|
||||
| 槽位 | 用户文件 | 覆盖的系统字体文件 |
|
||||
| ----------- | ----------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| 中文简体 | `FONTS/hans.ttf` | `SysSans-Hans-Regular.ttf`、`SysFont-Static-Regular.ttf`、`SysFont-Myanmar.ttf`、`SysFont-Hans-Regular.ttf`、`SysFont-Regular.ttf` |
|
||||
| 中文繁体 | `FONTS/hant.ttf` | `SysSans-Hant-Regular.ttf`、`SysFont-Hant-Regular.ttf` |
|
||||
| 英文 & 数字 | `FONTS/en.ttf` | `SysSans-En-Regular.ttf` |
|
||||
| 等宽字体 | `FONTS/mono.ttf` | `DroidSansMono.ttf`(直接替换系统等宽字体;未设置时移除模块内该文件,恢复系统原字体) |
|
||||
| Emoji 表情 | `FONTS/emoji.ttf` | `NotoColorEmoji.ttf`(直接替换系统 Emoji;未设置时从模块备份恢复默认,见下) |
|
||||
|
||||
**回退规则**:`hant.ttf` / `en.ttf` 缺失时对应槽位自动使用 `hans.ttf`;`hans.ttf` 缺失时 `apply.sh` 直接报错退出(WebUI 也会禁用「应用」按钮)。`mono.ttf` 未设置时**恢复**系统等宽字体(移除模块内 `DroidSansMono.ttf`,overlay 机制自动还原系统原文件)。`emoji.ttf` 未设置时**恢复**默认 Emoji(模块安装时已备份内嵌补充字库 `NotoColorEmoji.ttf` 到模块 `backup/`,清除槽位时自动还原;全新安装未设置时直接使用补充字库内嵌 Emoji)。
|
||||
|
||||
> 注意:等宽字体若不含中文字形,等宽区域的中文会按系统机制回退到中文字体(属正常 fallback)。如需等宽中文,请使用含中文字形的等宽字体(如 Sarasa、Maple Mono 等)。
|
||||
|
||||
### 补充字库
|
||||
|
||||
模块内置一组补充字体(OFL-1.1 / MIT 许可),作为 `fonts.xml` 末尾的全局 fallback,兜底用户字体与系统字体未覆盖的字形(CJK 扩展区生僻字、最新 Unicode 字符、小篆等):
|
||||
|
||||
| 字体 | 说明 |
|
||||
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `PlangothicP1/P2.ttf` | CJK 扩展区覆盖(Ext-B、G/H、**I、J** 等生僻字与新汉字) |
|
||||
| `PlanschriftSeal-Regular.ttf` | **Seal(小篆)区块 11328 字符全覆盖**(Unicode 18 新增,子集化 34M;MIT/OFL 双许可,源自 [Planschrift_Project](https://github.com/Fitzgerald-Porthmouth-Koenigsegg/Planschrift_Project)) |
|
||||
| `NotoSansPro.otf` | 多 Noto 家族合并,覆盖广泛语言字形 |
|
||||
| `Unicode16/17/18-new.ttf` | Unicode 最新版本已定义字符覆盖 |
|
||||
| `ZUno-Number.ttf` | 保留符号 / 私用区未定义符号显示编码信息 |
|
||||
|
||||
补充字库不参与用户槽位替换(`SysFont*` / `SysSans*` 槽位规则不变),仅在缺字形时按顺序兜底。字体来源与许可详见模块内 `system/fonts/LICENSE-*` 及 [MakeFontsGreatAgain](https://github.com/Numbersf/MakeFontsGreatAgain) 的 LICENSES。
|
||||
|
||||
## 工作原理
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ KernelSU 管理器 │
|
||||
│ ┌──────────────────────────────┐ │
|
||||
│ │ WebUI (web/ 构建产物) │ ksu.exec / toast │
|
||||
│ └──────────────┬───────────────┘ │
|
||||
└───────────────────┼──────────────────────────────────────┘
|
||||
│ sh /data/adb/modules/FontMM/apply.sh
|
||||
▼
|
||||
┌───────────────────────┐ cp -f ┌──────────────────────┐
|
||||
│ FONTS/ 用户字体 │ ──────────► │ system/fonts/ │
|
||||
│ hans.ttf │ │ SysFont/SysSans 等 │
|
||||
│ hant.ttf (可选) │ └──────────────────────┘
|
||||
│ en.ttf (可选) │
|
||||
└───────────────────────┘
|
||||
```
|
||||
|
||||
1. **安装阶段**(`customize.sh`):系统检查(ColorOS 版本、KernelSU 元模块、FontLoader)→ 更新模式检测与旧字体继承 → 调用 `apply.sh` 完成首次字体安装。
|
||||
2. **换字体阶段**(WebUI):选择文件 → 复制到 `FONTS/` → 调用同一个 `apply.sh`,两条路径行为一致。
|
||||
3. **`apply.sh` 核心逻辑**:按字体映射表把 `FONTS/` 中的字体复制到 `system/fonts/` 的对应文件,缺繁体/英文时回退简体。
|
||||
4. **字体生效**:ColorOS 通过 `/system/etc/fonts.xml` 等配置引用 `SysFont*` / `SysSans*` 字体族——模块内嵌从 ColorOS 16 提取的配置(`fonts.xml` 为唯一源,开发阶段自动生成 `fonts_base.xml` / `fonts_ule.xml` / `font_fallback.xml`),替换字体文件即可全局生效。
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
FontMM/
|
||||
├── src/ # Magisk 模块源(打包时 zip 根 = 模块根)
|
||||
│ ├── module.prop # 模块元信息(id/version/updateJson)
|
||||
│ ├── customize.sh # 安装脚本:系统检查 + 更新模式 + 调用 apply.sh
|
||||
│ ├── apply.sh # 字体应用脚本(安装 & WebUI 共用)
|
||||
│ ├── FONTS/ # 用户字体目录(preplace 版含默认 hans.ttf)
|
||||
│ ├── META-INF/ # Magisk 安装入口(update-binary / updater-script)
|
||||
│ ├── system/
|
||||
│ │ ├── fonts/ # 字体槽位 + 补充字库(占位文件安装时被填充)
|
||||
│ │ └── etc/ # fonts.xml / fonts_base.xml / fonts_ule.xml / font_fallback.xml
|
||||
│ ├── system_ext/etc/ # system_ext 分区字体配置(fonts_base.xml / fonts_ule.xml)
|
||||
│ └── webroot/ # WebUI 构建产物(pnpm build 生成,不入库)
|
||||
├── web/ # WebUI 前端源码(Vite + TypeScript)
|
||||
│ ├── index.html
|
||||
│ ├── vite.config.ts # base './',产物输出到 ../src/webroot
|
||||
│ └── src/
|
||||
│ ├── main.ts # 主界面:字体槽位 + 应用 + 日志
|
||||
│ ├── fontPicker.ts # 字体文件选择器
|
||||
│ ├── ksu.ts # kernelsu API 封装(DEV 模式内置 mock)
|
||||
│ ├── theme.scss # Material Design 3 主题变量
|
||||
│ └── style.scss # 全局样式
|
||||
├── dev/ # 开发脚本
|
||||
│ ├── cd.sh # 打包模块 zip(preplace / template 两版)→ dist/
|
||||
│ ├── ci.sh # shellcheck + shfmt 检查
|
||||
│ ├── webzip.sh # 仅打包 WebUI 产物 → dist/webroot.zip
|
||||
│ ├── sync-fonts-xml.sh # 以 fonts.xml 为唯一源生成派生字体配置
|
||||
│ ├── check-unicode-coverage.py # 本地模拟字体 fallback, 统计 Unicode 区块覆盖
|
||||
│ └── empty_font.sh # 生成 0 字节占位字体
|
||||
├── package.json # pnpm workspace 根
|
||||
├── web/package.json # WebUI 依赖与脚本
|
||||
└── dist/ # 打包产物(构建时生成,不入库)
|
||||
```
|
||||
|
||||
## 开发指南
|
||||
|
||||
### 环境要求
|
||||
|
||||
- Node.js ≥ 18 + [pnpm](https://pnpm.io/)
|
||||
- `zip` / `unzip`(打包)
|
||||
- `shellcheck` + `shfmt`(仅 CI 检查需要)
|
||||
- Python 3 + fontTools(Unicode 覆盖测试)
|
||||
- Android 设备(Termux)或任意可运行 `ash` 的环境(验证 shell 脚本)
|
||||
|
||||
### 安装依赖
|
||||
|
||||
```bash
|
||||
pnpm install # 根 workspace(会联动安装 web/)
|
||||
```
|
||||
|
||||
### 本地预览 WebUI
|
||||
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
`dev` 模式下 `ksu.ts` 使用内置 mock 文件系统,文件选择、槽位切换、应用字体全流程可脱离真机调试。
|
||||
|
||||
### 构建与打包
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
|
||||
依次执行:
|
||||
|
||||
1. `vite build`——把 WebUI 构建到 `src/webroot/`(相对路径,适配本地 WebView 加载)
|
||||
2. `bash dev/cd.sh`——读取 `src/module.prop` 的 `version` 字段,打包出两个版本(zip 根 = 模块根):
|
||||
- `dist/FontMM_v{VERSION}_preplace.zip`——含预置字体 `FONTS/hans.ttf`
|
||||
- `dist/FontMM_v{VERSION}_template.zip`——`FONTS/` 为空目录
|
||||
|
||||
产物均校验内含 `module.prop`;template 版额外校验 `FONTS/` 下不含字体文件。打包前会自动同步派生字体 XML(`sync-fonts-xml.sh`)。
|
||||
|
||||
单独构建 WebUI 产物(调试用):
|
||||
|
||||
```bash
|
||||
pnpm build:only-web # 产出 dist/webroot.zip
|
||||
```
|
||||
|
||||
### 代码检查
|
||||
|
||||
```bash
|
||||
pnpm lint # 前端 oxlint 检查 (web/src)
|
||||
pnpm fmt # 前端 oxfmt 格式化
|
||||
pnpm fmt:check # 前端 oxfmt 格式检查
|
||||
bash dev/ci.sh # src/ 下所有 .sh 的 shellcheck + shfmt 检查
|
||||
```
|
||||
|
||||
前端 lint/format 由 [oxlint](https://oxc.rs/) 与 [oxfmt](https://oxc.rs/) 提供。
|
||||
|
||||
### Unicode 覆盖测试
|
||||
|
||||
```bash
|
||||
python3 dev/check-unicode-coverage.py # 全部区块
|
||||
python3 dev/check-unicode-coverage.py "Archaic" "Seal" # 只测指定区块
|
||||
```
|
||||
|
||||
本地模拟 `fonts.xml` 的 fallback 链(fontTools 读取 `src/system/fonts/` 各字体 cmap),对照 Unicode Blocks.txt 统计每个区块覆盖率(首次运行自动下载 Blocks.txt 缓存到 `dev/`)。
|
||||
|
||||
### 占位字体机制
|
||||
|
||||
`src/system/fonts/` 下的 `SysFont*` / `SysSans*` 是 **0 字节占位文件**,避免把大字体文件提交进仓库;安装或应用字体时由 `apply.sh` 用 `FONTS/` 里的真实字体覆盖。
|
||||
|
||||
- 开发时可用 `dev/empty_font.sh` 重新生成这些占位文件
|
||||
- `src/FONTS/hans.ttf` 是内置默认简体字体(仅 preplace 版打包)
|
||||
|
||||
## 常见问题
|
||||
|
||||
**Q:装完模块后字体没变?**
|
||||
|
||||
A:先重启设备;确认系统是 ColorOS 16+;建议安装 [FontLoader](https://github.com/KernelSU-Modules-Repo/fontloader)(v1.2.3+)。
|
||||
|
||||
**Q:KernelSU 3.0+ 装不上 / 报元模块错误?**
|
||||
|
||||
A:KernelSU ≥ 3.0.0 需要先安装元模块(`/data/adb/metamodule/module.prop`),安装日志会明确提示。
|
||||
|
||||
**Q:更新模块会丢失我设置好的字体吗?**
|
||||
|
||||
A:不会。`customize.sh` 检测到已安装的 FontMM 时会进入更新模式,从旧模块的 `FONTS/` 目录继承 `hans.ttf` / `hant.ttf` / `en.ttf` / `mono.ttf` / `emoji.ttf`。
|
||||
|
||||
**Q:`system/fonts/` 里的字体文件为什么是 0 字节?**
|
||||
|
||||
A:那是占位文件,安装或应用字体时会被真实字体覆盖(见「占位字体机制」)。
|
||||
|
||||
**Q:等宽字体设置了但不生效 / 显示成了简体字体?**
|
||||
|
||||
A:确认已重启;等宽字体不含中文字形时,等宽区域的中文会按系统机制回退到中文字体(正常行为),请使用含中文的等宽字体(Sarasa、Maple Mono 等)。
|
||||
|
||||
## 致谢
|
||||
|
||||
- 字体映射与配置文件参考 ColorOS 16 系统字体体系(`SysFont` / `SysSans` 字体族)
|
||||
- 补充字库与 `fonts.xml` fallback 结构参考 [MakeFontsGreatAgain](https://github.com/Numbersf/MakeFontsGreatAgain)(Unicode Latest 全覆盖思路)
|
||||
- WebUI 基于 [Material Web](https://github.com/material-components/material-web)(Material Design 3)与 [kernelsu](https://www.npmjs.com/package/kernelsu) SDK 构建
|
||||
@@ -0,0 +1,30 @@
|
||||
# Changelog
|
||||
|
||||
## v26.8.0-beta.3
|
||||
|
||||
- **新增「工具」页**(底部导航第 4 个 tab):下载国际版小米主题字体 v1.0.0
|
||||
- 搜索小米主题商店字体(跨域走 root shell 解决)、缩略图预览、分页浏览
|
||||
- 下载 mtz 并自动解压提取 `fonts/` 目录字体,日志实时展示(后台运行 + 轮询,避免阻塞 WebUI)
|
||||
- **等宽/Emoji 修复**:`mono.ttf` 与 `emoji.ttf` 改回**直接替换系统字体**(`DroidSansMono.ttf` / `NotoColorEmoji.ttf`,overlay 生效),不再使用自创独立字体文件(`FontMM-Mono` / `FontMM-Emoji` 不生效)
|
||||
- **Emoji 槽位完善**:清除 emoji 槽位时从模块 `backup/` 恢复内嵌补充字库 Emoji(安装时自动备份);旧包更新继承列表补全 `emoji.ttf`
|
||||
|
||||
## v26.8.0-beta.2
|
||||
|
||||
- **补充字库**:内置 OFL-1.1 / MIT 许可字体,在 `fonts.xml` 末尾作为全局 fallback:
|
||||
- PlangothicP1/P2——CJK 扩展区覆盖(Ext-B、G/H、**I、J** 等生僻字与新汉字)
|
||||
- PlanschriftSeal——**Seal(小篆)区块 11328 字符 100% 覆盖**(Unicode 18 新增,子集化 34M,MIT/OFL 双许可)
|
||||
- ArchaicCuneiformNumerals、NotoUnicode、NotoColorEmoji、UnicodiaFunky、Unknown-symbol 等
|
||||
- **等宽字体修复**:改为独立文件 `FontMM-Mono.ttf`(monospace 家族优先引用),不再覆盖系统 `DroidSansMono`,解决设置等宽字体后不生效的问题
|
||||
- **单一源字体配置**:`fonts.xml` 为唯一源,`dev/sync-fonts-xml.sh` 自动生成 `fonts_base.xml` / `fonts_ule.xml` / `font_fallback.xml`
|
||||
- **Unicode 覆盖测试**:新增 `dev/check-unicode-coverage.py`,本地模拟 fallback 链统计各区块覆盖率
|
||||
- 致谢补充字库来源 [MakeFontsGreatAgain](https://github.com/Numbersf/MakeFontsGreatAgain)
|
||||
|
||||
## v26.8.0-beta.1
|
||||
|
||||
全新 v26 架构重构:
|
||||
|
||||
- **WebUI 重写**(Material Design 3 + 底部导航):字体槽位选择/应用、字体测试(字重 100–900、可变字体滑条、字号调节)、关于页、深色模式跟随系统、edge-to-edge 延伸至小白条
|
||||
- **字体名称解析**:打开 WebUI 时用 opentype.js 读取 FONT/ 内字体的真实名称并显示在卡片(如 OPPO Sans 4.0)
|
||||
- **双版本打包**:`_preplace`(含预置字体)与 `_template`(FONT 空目录)两版;新增 `build:only-web` 快速调试产物
|
||||
- **开发工具链**:oxlint / oxfmt / type-check / shellcheck 脚本化
|
||||
- 新增 MIT LICENSE
|
||||
+391
@@ -0,0 +1,391 @@
|
||||
# Blocks-18.0.0.txt
|
||||
# Date: 2026-02-03
|
||||
# © 2026 Unicode®, Inc.
|
||||
# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
|
||||
# For terms of use and license, see https://www.unicode.org/terms_of_use.html
|
||||
#
|
||||
# Unicode Character Database
|
||||
# For documentation, see https://www.unicode.org/reports/tr44/
|
||||
#
|
||||
# Format:
|
||||
# Start Code..End Code; Block Name
|
||||
|
||||
# ================================================
|
||||
|
||||
# Note: When comparing block names, casing, whitespace, hyphens,
|
||||
# and underbars are ignored.
|
||||
# For example, "Latin Extended-A" and "latin extended a" are equivalent.
|
||||
# For more information on the comparison of property values,
|
||||
# see UAX #44: https://www.unicode.org/reports/tr44/
|
||||
#
|
||||
# All block ranges start with a value where (cp MOD 16) = 0,
|
||||
# and end with a value where (cp MOD 16) = 15. In other words,
|
||||
# the last hexadecimal digit of the start of range is ...0
|
||||
# and the last hexadecimal digit of the end of range is ...F.
|
||||
# This constraint on block ranges guarantees that allocations
|
||||
# are done in terms of whole columns, and that code chart display
|
||||
# never involves splitting columns in the charts.
|
||||
#
|
||||
# All code points not explicitly listed for Block
|
||||
# have the value No_Block.
|
||||
|
||||
# Property: Block
|
||||
#
|
||||
# @missing: 0000..10FFFF; No_Block
|
||||
|
||||
0000..007F; Basic Latin
|
||||
0080..00FF; Latin-1 Supplement
|
||||
0100..017F; Latin Extended-A
|
||||
0180..024F; Latin Extended-B
|
||||
0250..02AF; IPA Extensions
|
||||
02B0..02FF; Spacing Modifier Letters
|
||||
0300..036F; Combining Diacritical Marks
|
||||
0370..03FF; Greek and Coptic
|
||||
0400..04FF; Cyrillic
|
||||
0500..052F; Cyrillic Supplement
|
||||
0530..058F; Armenian
|
||||
0590..05FF; Hebrew
|
||||
0600..06FF; Arabic
|
||||
0700..074F; Syriac
|
||||
0750..077F; Arabic Supplement
|
||||
0780..07BF; Thaana
|
||||
07C0..07FF; NKo
|
||||
0800..083F; Samaritan
|
||||
0840..085F; Mandaic
|
||||
0860..086F; Syriac Supplement
|
||||
0870..089F; Arabic Extended-B
|
||||
08A0..08FF; Arabic Extended-A
|
||||
0900..097F; Devanagari
|
||||
0980..09FF; Bengali
|
||||
0A00..0A7F; Gurmukhi
|
||||
0A80..0AFF; Gujarati
|
||||
0B00..0B7F; Oriya
|
||||
0B80..0BFF; Tamil
|
||||
0C00..0C7F; Telugu
|
||||
0C80..0CFF; Kannada
|
||||
0D00..0D7F; Malayalam
|
||||
0D80..0DFF; Sinhala
|
||||
0E00..0E7F; Thai
|
||||
0E80..0EFF; Lao
|
||||
0F00..0FFF; Tibetan
|
||||
1000..109F; Myanmar
|
||||
10A0..10FF; Georgian
|
||||
1100..11FF; Hangul Jamo
|
||||
1200..137F; Ethiopic
|
||||
1380..139F; Ethiopic Supplement
|
||||
13A0..13FF; Cherokee
|
||||
1400..167F; Unified Canadian Aboriginal Syllabics
|
||||
1680..169F; Ogham
|
||||
16A0..16FF; Runic
|
||||
1700..171F; Tagalog
|
||||
1720..173F; Hanunoo
|
||||
1740..175F; Buhid
|
||||
1760..177F; Tagbanwa
|
||||
1780..17FF; Khmer
|
||||
1800..18AF; Mongolian
|
||||
18B0..18FF; Unified Canadian Aboriginal Syllabics Extended
|
||||
1900..194F; Limbu
|
||||
1950..197F; Tai Le
|
||||
1980..19DF; New Tai Lue
|
||||
19E0..19FF; Khmer Symbols
|
||||
1A00..1A1F; Buginese
|
||||
1A20..1AAF; Tai Tham
|
||||
1AB0..1AFF; Combining Diacritical Marks Extended
|
||||
1B00..1B7F; Balinese
|
||||
1B80..1BBF; Sundanese
|
||||
1BC0..1BFF; Batak
|
||||
1C00..1C4F; Lepcha
|
||||
1C50..1C7F; Ol Chiki
|
||||
1C80..1C8F; Cyrillic Extended-C
|
||||
1C90..1CBF; Georgian Extended
|
||||
1CC0..1CCF; Sundanese Supplement
|
||||
1CD0..1CFF; Vedic Extensions
|
||||
1D00..1D7F; Phonetic Extensions
|
||||
1D80..1DBF; Phonetic Extensions Supplement
|
||||
1DC0..1DFF; Combining Diacritical Marks Supplement
|
||||
1E00..1EFF; Latin Extended Additional
|
||||
1F00..1FFF; Greek Extended
|
||||
2000..206F; General Punctuation
|
||||
2070..209F; Superscripts and Subscripts
|
||||
20A0..20CF; Currency Symbols
|
||||
20D0..20FF; Combining Diacritical Marks for Symbols
|
||||
2100..214F; Letterlike Symbols
|
||||
2150..218F; Number Forms
|
||||
2190..21FF; Arrows
|
||||
2200..22FF; Mathematical Operators
|
||||
2300..23FF; Miscellaneous Technical
|
||||
2400..243F; Control Pictures
|
||||
2440..245F; Optical Character Recognition
|
||||
2460..24FF; Enclosed Alphanumerics
|
||||
2500..257F; Box Drawing
|
||||
2580..259F; Block Elements
|
||||
25A0..25FF; Geometric Shapes
|
||||
2600..26FF; Miscellaneous Symbols
|
||||
2700..27BF; Dingbats
|
||||
27C0..27EF; Miscellaneous Mathematical Symbols-A
|
||||
27F0..27FF; Supplemental Arrows-A
|
||||
2800..28FF; Braille Patterns
|
||||
2900..297F; Supplemental Arrows-B
|
||||
2980..29FF; Miscellaneous Mathematical Symbols-B
|
||||
2A00..2AFF; Supplemental Mathematical Operators
|
||||
2B00..2BFF; Miscellaneous Symbols and Arrows
|
||||
2C00..2C5F; Glagolitic
|
||||
2C60..2C7F; Latin Extended-C
|
||||
2C80..2CFF; Coptic
|
||||
2D00..2D2F; Georgian Supplement
|
||||
2D30..2D7F; Tifinagh
|
||||
2D80..2DDF; Ethiopic Extended
|
||||
2DE0..2DFF; Cyrillic Extended-A
|
||||
2E00..2E7F; Supplemental Punctuation
|
||||
2E80..2EFF; CJK Radicals Supplement
|
||||
2F00..2FDF; Kangxi Radicals
|
||||
2FF0..2FFF; Ideographic Description Characters
|
||||
3000..303F; CJK Symbols and Punctuation
|
||||
3040..309F; Hiragana
|
||||
30A0..30FF; Katakana
|
||||
3100..312F; Bopomofo
|
||||
3130..318F; Hangul Compatibility Jamo
|
||||
3190..319F; Kanbun
|
||||
31A0..31BF; Bopomofo Extended
|
||||
31C0..31EF; CJK Strokes
|
||||
31F0..31FF; Katakana Phonetic Extensions
|
||||
3200..32FF; Enclosed CJK Letters and Months
|
||||
3300..33FF; CJK Compatibility
|
||||
3400..4DBF; CJK Unified Ideographs Extension A
|
||||
4DC0..4DFF; Yijing Hexagram Symbols
|
||||
4E00..9FFF; CJK Unified Ideographs
|
||||
A000..A48F; Yi Syllables
|
||||
A490..A4CF; Yi Radicals
|
||||
A4D0..A4FF; Lisu
|
||||
A500..A63F; Vai
|
||||
A640..A69F; Cyrillic Extended-B
|
||||
A6A0..A6FF; Bamum
|
||||
A700..A71F; Modifier Tone Letters
|
||||
A720..A7FF; Latin Extended-D
|
||||
A800..A82F; Syloti Nagri
|
||||
A830..A83F; Common Indic Number Forms
|
||||
A840..A87F; Phags-pa
|
||||
A880..A8DF; Saurashtra
|
||||
A8E0..A8FF; Devanagari Extended
|
||||
A900..A92F; Kayah Li
|
||||
A930..A95F; Rejang
|
||||
A960..A97F; Hangul Jamo Extended-A
|
||||
A980..A9DF; Javanese
|
||||
A9E0..A9FF; Myanmar Extended-B
|
||||
AA00..AA5F; Cham
|
||||
AA60..AA7F; Myanmar Extended-A
|
||||
AA80..AADF; Tai Viet
|
||||
AAE0..AAFF; Meetei Mayek Extensions
|
||||
AB00..AB2F; Ethiopic Extended-A
|
||||
AB30..AB6F; Latin Extended-E
|
||||
AB70..ABBF; Cherokee Supplement
|
||||
ABC0..ABFF; Meetei Mayek
|
||||
AC00..D7AF; Hangul Syllables
|
||||
D7B0..D7FF; Hangul Jamo Extended-B
|
||||
D800..DB7F; High Surrogates
|
||||
DB80..DBFF; High Private Use Surrogates
|
||||
DC00..DFFF; Low Surrogates
|
||||
E000..F8FF; Private Use Area
|
||||
F900..FAFF; CJK Compatibility Ideographs
|
||||
FB00..FB4F; Alphabetic Presentation Forms
|
||||
FB50..FDFF; Arabic Presentation Forms-A
|
||||
FE00..FE0F; Variation Selectors
|
||||
FE10..FE1F; Vertical Forms
|
||||
FE20..FE2F; Combining Half Marks
|
||||
FE30..FE4F; CJK Compatibility Forms
|
||||
FE50..FE6F; Small Form Variants
|
||||
FE70..FEFF; Arabic Presentation Forms-B
|
||||
FF00..FFEF; Halfwidth and Fullwidth Forms
|
||||
FFF0..FFFF; Specials
|
||||
10000..1007F; Linear B Syllabary
|
||||
10080..100FF; Linear B Ideograms
|
||||
10100..1013F; Aegean Numbers
|
||||
10140..1018F; Ancient Greek Numbers
|
||||
10190..101CF; Ancient Symbols
|
||||
101D0..101FF; Phaistos Disc
|
||||
10280..1029F; Lycian
|
||||
102A0..102DF; Carian
|
||||
102E0..102FF; Coptic Epact Numbers
|
||||
10300..1032F; Old Italic
|
||||
10330..1034F; Gothic
|
||||
10350..1037F; Old Permic
|
||||
10380..1039F; Ugaritic
|
||||
103A0..103DF; Old Persian
|
||||
10400..1044F; Deseret
|
||||
10450..1047F; Shavian
|
||||
10480..104AF; Osmanya
|
||||
104B0..104FF; Osage
|
||||
10500..1052F; Elbasan
|
||||
10530..1056F; Caucasian Albanian
|
||||
10570..105BF; Vithkuqi
|
||||
105C0..105FF; Todhri
|
||||
10600..1077F; Linear A
|
||||
10780..107BF; Latin Extended-F
|
||||
10800..1083F; Cypriot Syllabary
|
||||
10840..1085F; Imperial Aramaic
|
||||
10860..1087F; Palmyrene
|
||||
10880..108AF; Nabataean
|
||||
108E0..108FF; Hatran
|
||||
10900..1091F; Phoenician
|
||||
10920..1093F; Lydian
|
||||
10940..1095F; Sidetic
|
||||
10980..1099F; Meroitic Hieroglyphs
|
||||
109A0..109FF; Meroitic Cursive
|
||||
10A00..10A5F; Kharoshthi
|
||||
10A60..10A7F; Old South Arabian
|
||||
10A80..10A9F; Old North Arabian
|
||||
10AC0..10AFF; Manichaean
|
||||
10B00..10B3F; Avestan
|
||||
10B40..10B5F; Inscriptional Parthian
|
||||
10B60..10B7F; Inscriptional Pahlavi
|
||||
10B80..10BAF; Psalter Pahlavi
|
||||
10C00..10C4F; Old Turkic
|
||||
10C80..10CFF; Old Hungarian
|
||||
10D00..10D3F; Hanifi Rohingya
|
||||
10D40..10D8F; Garay
|
||||
10E60..10E7F; Rumi Numeral Symbols
|
||||
10E80..10EBF; Yezidi
|
||||
10EC0..10EFF; Arabic Extended-C
|
||||
10F00..10F2F; Old Sogdian
|
||||
10F30..10F6F; Sogdian
|
||||
10F70..10FAF; Old Uyghur
|
||||
10FB0..10FDF; Chorasmian
|
||||
10FE0..10FFF; Elymaic
|
||||
11000..1107F; Brahmi
|
||||
11080..110CF; Kaithi
|
||||
110D0..110FF; Sora Sompeng
|
||||
11100..1114F; Chakma
|
||||
11150..1117F; Mahajani
|
||||
11180..111DF; Sharada
|
||||
111E0..111FF; Sinhala Archaic Numbers
|
||||
11200..1124F; Khojki
|
||||
11280..112AF; Multani
|
||||
112B0..112FF; Khudawadi
|
||||
11300..1137F; Grantha
|
||||
11380..113FF; Tulu-Tigalari
|
||||
11400..1147F; Newa
|
||||
11480..114DF; Tirhuta
|
||||
11580..115FF; Siddham
|
||||
11600..1165F; Modi
|
||||
11660..1167F; Mongolian Supplement
|
||||
11680..116CF; Takri
|
||||
116D0..116FF; Myanmar Extended-C
|
||||
11700..1174F; Ahom
|
||||
11800..1184F; Dogra
|
||||
118A0..118FF; Warang Citi
|
||||
11900..1195F; Dives Akuru
|
||||
119A0..119FF; Nandinagari
|
||||
11A00..11A4F; Zanabazar Square
|
||||
11A50..11AAF; Soyombo
|
||||
11AB0..11ABF; Unified Canadian Aboriginal Syllabics Extended-A
|
||||
11AC0..11AFF; Pau Cin Hau
|
||||
11B00..11B5F; Devanagari Extended-A
|
||||
11B60..11B7F; Sharada Supplement
|
||||
11BC0..11BFF; Sunuwar
|
||||
11C00..11C6F; Bhaiksuki
|
||||
11C70..11CBF; Marchen
|
||||
11D00..11D5F; Masaram Gondi
|
||||
11D60..11DAF; Gunjala Gondi
|
||||
11DB0..11DEF; Tolong Siki
|
||||
11DF0..11DFF; Bengali Supplement
|
||||
11EE0..11EFF; Makasar
|
||||
11F00..11F5F; Kawi
|
||||
11FB0..11FBF; Lisu Supplement
|
||||
11FC0..11FFF; Tamil Supplement
|
||||
12000..123FF; Cuneiform
|
||||
12400..1247F; Cuneiform Numbers and Punctuation
|
||||
12480..1254F; Early Dynastic Cuneiform
|
||||
12550..1268F; Archaic Cuneiform Numerals
|
||||
12F90..12FFF; Cypro-Minoan
|
||||
13000..1342F; Egyptian Hieroglyphs
|
||||
13430..1345F; Egyptian Hieroglyph Format Controls
|
||||
13460..143FF; Egyptian Hieroglyphs Extended-A
|
||||
14400..1467F; Anatolian Hieroglyphs
|
||||
16100..1613F; Gurung Khema
|
||||
16800..16A3F; Bamum Supplement
|
||||
16A40..16A6F; Mro
|
||||
16A70..16ACF; Tangsa
|
||||
16AD0..16AFF; Bassa Vah
|
||||
16B00..16B8F; Pahawh Hmong
|
||||
16D40..16D7F; Kirat Rai
|
||||
16D80..16DAF; Chisoi
|
||||
16E40..16E9F; Medefaidrin
|
||||
16EA0..16EDF; Beria Erfe
|
||||
16F00..16F9F; Miao
|
||||
16FE0..16FFF; Ideographic Symbols and Punctuation
|
||||
17000..187FF; Tangut
|
||||
18800..18AFF; Tangut Components
|
||||
18B00..18CFF; Khitan Small Script
|
||||
18D00..18D7F; Tangut Supplement
|
||||
18D80..18DFF; Tangut Components Supplement
|
||||
18E00..1919F; Jurchen
|
||||
191A0..191DF; Jurchen Radicals
|
||||
1AFF0..1AFFF; Kana Extended-B
|
||||
1B000..1B0FF; Kana Supplement
|
||||
1B100..1B12F; Kana Extended-A
|
||||
1B130..1B16F; Small Kana Extension
|
||||
1B170..1B2FF; Nushu
|
||||
1BC00..1BC9F; Duployan
|
||||
1BCA0..1BCAF; Shorthand Format Controls
|
||||
1CC00..1CEBF; Symbols for Legacy Computing Supplement
|
||||
1CEC0..1CEFF; Miscellaneous Symbols Supplement
|
||||
1CF00..1CFCF; Znamenny Musical Notation
|
||||
1D000..1D0FF; Byzantine Musical Symbols
|
||||
1D100..1D1FF; Musical Symbols
|
||||
1D200..1D24F; Ancient Greek Musical Notation
|
||||
1D250..1D28F; Musical Symbols Supplement
|
||||
1D2C0..1D2DF; Kaktovik Numerals
|
||||
1D2E0..1D2FF; Mayan Numerals
|
||||
1D300..1D35F; Tai Xuan Jing Symbols
|
||||
1D360..1D37F; Counting Rod Numerals
|
||||
1D400..1D7FF; Mathematical Alphanumeric Symbols
|
||||
1D800..1DAAF; Sutton SignWriting
|
||||
1DB00..1DBFF; Miscellaneous Symbols and Arrows Extended
|
||||
1DF00..1DFFF; Latin Extended-G
|
||||
1E000..1E02F; Glagolitic Supplement
|
||||
1E030..1E08F; Cyrillic Extended-D
|
||||
1E100..1E14F; Nyiakeng Puachue Hmong
|
||||
1E290..1E2BF; Toto
|
||||
1E2C0..1E2FF; Wancho
|
||||
1E4D0..1E4FF; Nag Mundari
|
||||
1E5D0..1E5FF; Ol Onal
|
||||
1E6C0..1E6FF; Tai Yo
|
||||
1E7E0..1E7FF; Ethiopic Extended-B
|
||||
1E800..1E8DF; Mende Kikakui
|
||||
1E900..1E95F; Adlam
|
||||
1EC70..1ECBF; Indic Siyaq Numbers
|
||||
1ED00..1ED4F; Ottoman Siyaq Numbers
|
||||
1EE00..1EEFF; Arabic Mathematical Alphabetic Symbols
|
||||
1F000..1F02F; Mahjong Tiles
|
||||
1F030..1F09F; Domino Tiles
|
||||
1F0A0..1F0FF; Playing Cards
|
||||
1F100..1F1FF; Enclosed Alphanumeric Supplement
|
||||
1F200..1F2FF; Enclosed Ideographic Supplement
|
||||
1F300..1F5FF; Miscellaneous Symbols and Pictographs
|
||||
1F600..1F64F; Emoticons
|
||||
1F650..1F67F; Ornamental Dingbats
|
||||
1F680..1F6FF; Transport and Map Symbols
|
||||
1F700..1F77F; Alchemical Symbols
|
||||
1F780..1F7FF; Geometric Shapes Extended
|
||||
1F800..1F8FF; Supplemental Arrows-C
|
||||
1F900..1F9FF; Supplemental Symbols and Pictographs
|
||||
1FA00..1FA6F; Chess Symbols
|
||||
1FA70..1FAFF; Symbols and Pictographs Extended-A
|
||||
1FB00..1FBFF; Symbols for Legacy Computing
|
||||
20000..2A6DF; CJK Unified Ideographs Extension B
|
||||
2A700..2B73F; CJK Unified Ideographs Extension C
|
||||
2B740..2B81F; CJK Unified Ideographs Extension D
|
||||
2B820..2CEAF; CJK Unified Ideographs Extension E
|
||||
2CEB0..2EBEF; CJK Unified Ideographs Extension F
|
||||
2EBF0..2EE5F; CJK Unified Ideographs Extension I
|
||||
2F800..2FA1F; CJK Compatibility Ideographs Supplement
|
||||
30000..3134F; CJK Unified Ideographs Extension G
|
||||
31350..323AF; CJK Unified Ideographs Extension H
|
||||
323B0..3347F; CJK Unified Ideographs Extension J
|
||||
3D000..3FC3F; Seal
|
||||
E0000..E007F; Tags
|
||||
E0100..E01EF; Variation Selectors Supplement
|
||||
F0000..FFFFF; Supplementary Private Use Area-A
|
||||
100000..10FFFF; Supplementary Private Use Area-B
|
||||
|
||||
# EOF
|
||||
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# dev/cd.sh — 打包 FontMM 模块 (preplace / template 两版)
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SRC_DIR="$ROOT_DIR/src"
|
||||
DIST_DIR="$ROOT_DIR/dist"
|
||||
PROP_FILE="$SRC_DIR/module.prop"
|
||||
|
||||
command -v zip >/dev/null 2>&1 || {
|
||||
echo "[!] 未找到 zip 命令, 请先安装" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 1. 从 module.prop 读版本号: version=26.8.0-beta.1(260800001)
|
||||
VERSION="$(sed -n 's/^version=//p' "$PROP_FILE" 2>/dev/null | head -n 1 | tr -d '\r' || true)"
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "[!] 无法从 $PROP_FILE 读取 version 字段" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 文件名安全化: 括号 -> 点 (GitHub Release 网页上传会把括号改写为点, 导致 URL 不一致)
|
||||
# 26.8.0-beta.1(260800001) -> 26.8.0-beta.1.260800001
|
||||
FILE_VERSION="$(printf '%s' "$VERSION" | sed 's/(/./g; s/)//g')"
|
||||
|
||||
PRE_OUT="$DIST_DIR/FontMM_v${FILE_VERSION}_preplace.zip"
|
||||
TPL_OUT="$DIST_DIR/FontMM_v${FILE_VERSION}_template.zip"
|
||||
|
||||
mkdir -p "$DIST_DIR"
|
||||
rm -f "$PRE_OUT" "$TPL_OUT" # 先删旧的, 防止 zip 增量更新残留已删除的文件
|
||||
|
||||
# 0. 同步派生字体配置 (fonts.xml 为唯一源, 复制生成 fonts_base/ule/font_fallback 等)
|
||||
bash "$ROOT_DIR/dev/sync-fonts-xml.sh"
|
||||
|
||||
# 2. 打包函数: $1=输出路径, $2=额外排除模式 (可选)
|
||||
# (zip 根 = 模块根, 不含 src 这层目录)
|
||||
pack() {
|
||||
local out="$1" extra="${2:-}"
|
||||
local args=(-r -2 "$out" . -x '*.git*' -x '*.DS_Store' -x '*.swp' -x '*~' -x '*.bak')
|
||||
if [ -n "$extra" ]; then
|
||||
args+=(-x "$extra")
|
||||
fi
|
||||
(
|
||||
cd "$SRC_DIR"
|
||||
zip "${args[@]}"
|
||||
)
|
||||
}
|
||||
|
||||
echo "[*] 打包 preplace 版 (含预置字体)..."
|
||||
pack "$PRE_OUT"
|
||||
echo "[*] 打包 template 版 (FONT 目录为空)..."
|
||||
pack "$TPL_OUT" 'FONTS/*'
|
||||
# -x 'FONTS/*' 会连目录条目一起排除, 这里补回空的 FONTS/ 目录
|
||||
(
|
||||
cd "$SRC_DIR"
|
||||
zip -g "$TPL_OUT" 'FONTS/'
|
||||
)
|
||||
|
||||
# 3. 产物校验: 必须含 module.prop, 防止打包错目录
|
||||
# 注意: 不能用 grep -q, 它匹配后立即退出会使上游 unzip 收到 SIGPIPE (141),
|
||||
# 在 pipefail 下整个管道被判失败, 产生"缺少 module.prop"的偶发误报
|
||||
check() {
|
||||
local out="$1"
|
||||
if ! unzip -l "$out" | grep 'module\.prop' >/dev/null; then
|
||||
echo "[!] 打包产物缺少 module.prop: $out" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
check "$PRE_OUT"
|
||||
check "$TPL_OUT"
|
||||
|
||||
# 4. template 版校验: FONTS 目录必须不含字体文件 (保留空目录)
|
||||
if unzip -l "$TPL_OUT" | grep 'FONTS/.*\.ttf' >/dev/null; then
|
||||
echo "[!] template 版不应包含 FONTS 字体文件" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "[✓] 打包完成:"
|
||||
echo " preplace: $PRE_OUT ($(du -h "$PRE_OUT" | cut -f1))"
|
||||
echo " template: $TPL_OUT ($(du -h "$TPL_OUT" | cut -f1))"
|
||||
@@ -0,0 +1,120 @@
|
||||
#!/usr/bin/env python3
|
||||
"""check-unicode-coverage.py — 本地模拟 Android 字体 fallback 链, 统计 Unicode 区块覆盖率.
|
||||
|
||||
原理: 按 fonts.xml 中 family 的声明顺序构成 fallback 链, 逐字形检查覆盖;
|
||||
用 fontTools 读取各字体 cmap, 对照 Unicode Blocks.txt 统计每个区块的覆盖率.
|
||||
|
||||
用法:
|
||||
python3 dev/check-unicode-coverage.py # 全部区块 (自动获取 Blocks.txt 缓存到 dev/)
|
||||
python3 dev/check-unicode-coverage.py --blocks-file Blocks.txt
|
||||
python3 dev/check-unicode-coverage.py Hebrew "Archaic" # 只测匹配的区块名 (子串)
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import urllib.request
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from fontTools.ttLib import TTFont
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
FONTS_DIR = os.path.join(ROOT, 'src', 'system', 'fonts')
|
||||
FONTS_XML = os.path.join(ROOT, 'src', 'system', 'etc', 'fonts.xml')
|
||||
BLOCKS_URL = 'https://www.unicode.org/Public/draft/ucd/Blocks.txt'
|
||||
|
||||
|
||||
def load_chain(xml_path):
|
||||
"""按 fonts.xml 声明顺序提取 fallback 链 (全部 font 文件名, 去重)."""
|
||||
root = ET.parse(xml_path).getroot()
|
||||
chain, seen = [], set()
|
||||
for family in root.iter('family'):
|
||||
for font in family.iter('font'):
|
||||
name = (font.text or '').strip()
|
||||
if name and name not in seen:
|
||||
seen.add(name)
|
||||
chain.append(name)
|
||||
return chain
|
||||
|
||||
|
||||
def load_cmaps(fonts_dir, chain):
|
||||
cmaps, missing = {}, []
|
||||
for name in chain:
|
||||
path = os.path.join(fonts_dir, name)
|
||||
if not os.path.exists(path):
|
||||
missing.append(name)
|
||||
continue
|
||||
try:
|
||||
cmaps[name] = TTFont(path, lazy=True).getBestCmap()
|
||||
except Exception as exc: # 解析失败 (如特殊字体) 跳过
|
||||
missing.append(f'{name} ({exc})')
|
||||
return cmaps, missing
|
||||
|
||||
|
||||
def load_blocks(path):
|
||||
blocks = []
|
||||
with open(path, encoding='utf-8') as fh:
|
||||
for line in fh:
|
||||
line = line.strip()
|
||||
if not line or line.startswith('#') or '..' not in line:
|
||||
continue
|
||||
rng, name = line.split(';')
|
||||
start, end = (int(x, 16) for x in rng.strip().split('..'))
|
||||
blocks.append((name.strip(), start, end))
|
||||
return blocks
|
||||
|
||||
|
||||
def fetch_blocks(dest):
|
||||
print(f'[i] 获取 Blocks.txt: {BLOCKS_URL}')
|
||||
urllib.request.urlretrieve(BLOCKS_URL, dest)
|
||||
return dest
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description='本地 Unicode 覆盖测试 (模拟 fonts.xml fallback 链)')
|
||||
ap.add_argument('blocks', nargs='*', help='只测试匹配的区块名 (子串, 如 Hebrew)')
|
||||
ap.add_argument('--blocks-file', help='本地 Blocks.txt 路径 (默认自动下载缓存到 dev/Blocks.txt)')
|
||||
args = ap.parse_args()
|
||||
|
||||
chain = load_chain(FONTS_XML)
|
||||
print(f'[i] fallback 链: {len(chain)} 个字体 ({FONTS_XML})')
|
||||
cmaps, missing = load_cmaps(FONTS_DIR, chain)
|
||||
if missing:
|
||||
print(f'[!] 缺失/无法解析的字体: {missing}')
|
||||
if not cmaps:
|
||||
print('[!] 无可用字体, 退出', file=os.sys.stderr)
|
||||
return 1
|
||||
|
||||
# 合并全部 cmap 为并集, 快速判字形
|
||||
union = set()
|
||||
for cm in cmaps.values():
|
||||
union.update(cm)
|
||||
print(f'[i] 可用字体 {len(cmaps)} 个, 字形码位并集 {len(union):,}')
|
||||
|
||||
blocks_file = args.blocks_file
|
||||
if not blocks_file:
|
||||
blocks_file = os.path.join(ROOT, 'dev', 'Blocks.txt')
|
||||
if not os.path.exists(blocks_file):
|
||||
fetch_blocks(blocks_file)
|
||||
blocks = load_blocks(blocks_file)
|
||||
if args.blocks:
|
||||
blocks = [b for b in blocks if any(k.lower() in b[0].lower() for k in args.blocks)]
|
||||
|
||||
print(f'\n{"Block":<42}{"Covered":>9}{"Total":>8}{"Pct":>9} Status')
|
||||
print('-' * 76)
|
||||
failed = []
|
||||
for name, start, end in blocks:
|
||||
total = end - start + 1
|
||||
covered = sum(1 for cp in range(start, end + 1) if cp in union)
|
||||
pct = covered / total * 100 if total else 0
|
||||
status = 'PASS' if covered == total else ('FAIL' if pct < 95 else '')
|
||||
if status == 'FAIL':
|
||||
failed.append(name)
|
||||
print(f'{name:<42}{covered:>9}{total:>8}{pct:>8.2f}% {status}')
|
||||
|
||||
print(f'\n[=] 共 {len(blocks)} 个区块, FAIL (<95%): {len(failed)} 个')
|
||||
for name in failed:
|
||||
print(f' - {name}')
|
||||
return 1 if failed else 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
raise SystemExit(main())
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# ---------- Termux 兼容 ----------
|
||||
# Termux 的 shellcheck / shfmt 安装在 app 私有目录, 需手动加入 PATH 与 LD_LIBRARY_PATH;
|
||||
# 其他环境 (Linux/macOS 等) 直接使用系统 PATH 中的工具
|
||||
if [ -n "${PREFIX:-}" ] && [ -d "$PREFIX/bin" ]; then
|
||||
export PATH="$PREFIX/bin:${PATH}"
|
||||
export LD_LIBRARY_PATH="$PREFIX/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
elif [ -d /data/user/0/com.termux/files/usr/bin ]; then
|
||||
export PATH="/data/user/0/com.termux/files/usr/bin:${PATH}"
|
||||
export LD_LIBRARY_PATH="/data/user/0/com.termux/files/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
fi
|
||||
|
||||
# 工具可用性检查
|
||||
command -v shellcheck >/dev/null 2>&1 || {
|
||||
echo "[!] 未找到 shellcheck, 请先安装" >&2
|
||||
exit 1
|
||||
}
|
||||
command -v shfmt >/dev/null 2>&1 || {
|
||||
echo "[!] 未找到 shfmt, 请先安装" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
shopt -s nullglob globstar
|
||||
files=("$SCRIPT_DIR/src"/**/*.sh)
|
||||
|
||||
for f in "${files[@]}"; do
|
||||
echo "> Checking: $f"
|
||||
shellcheck "$f" || exit 1
|
||||
done
|
||||
|
||||
for f in "${files[@]}"; do
|
||||
echo "> Formatting: $f"
|
||||
shfmt -i 4 -w -d "$f"
|
||||
done
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
FONT_DIR="$SCRIPT_DIR/src/system/fonts"
|
||||
|
||||
# 字体清单(记得和 customize.sh 保持一致)
|
||||
all_fonts='SysSans-Hans-Regular.ttf
|
||||
SysFont-Static-Regular.ttf
|
||||
SysFont-Myanmar.ttf
|
||||
SysFont-Hans-Regular.ttf
|
||||
SysFont-Regular.ttf
|
||||
SysSans-Hant-Regular.ttf
|
||||
SysFont-Hant-Regular.ttf
|
||||
SysSans-En-Regular.ttf'
|
||||
|
||||
mkdir -p "$FONT_DIR"
|
||||
|
||||
count=0
|
||||
while IFS= read -r font; do
|
||||
[ -z "$font" ] && continue
|
||||
: > "$FONT_DIR/$font"
|
||||
echo "[*] 已生成空字体: $font"
|
||||
count=$((count + 1))
|
||||
done <<< "$all_fonts"
|
||||
|
||||
echo "[✓] 完成,共 $count 个空字体 -> $FONT_DIR"
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# dev/sync-fonts-xml.sh — 以 fonts.xml 为唯一源, 复制生成各派生字体配置
|
||||
# ColorOS 在不同场景加载 fonts.xml / fonts_base.xml / fonts_ule.xml / font_fallback.xml,
|
||||
# 参考 MakeFontsGreatAgain 的做法, 开发阶段直接复制, 避免维护多份几乎重复的 XML
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SRC="$ROOT_DIR/src/system/etc/fonts.xml"
|
||||
|
||||
[ -f "$SRC" ] || {
|
||||
echo "[!] 找不到源文件: $SRC" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
DEST=(
|
||||
"$ROOT_DIR/src/system/etc/fonts_base.xml"
|
||||
"$ROOT_DIR/src/system/etc/fonts_ule.xml"
|
||||
"$ROOT_DIR/src/system/etc/font_fallback.xml"
|
||||
"$ROOT_DIR/src/system/system_ext/etc/fonts_base.xml"
|
||||
"$ROOT_DIR/src/system/system_ext/etc/fonts_ule.xml"
|
||||
)
|
||||
|
||||
for f in "${DEST[@]}"; do
|
||||
cp -f "$SRC" "$f"
|
||||
echo "[✓] 已同步: $f"
|
||||
done
|
||||
|
||||
echo "[✓] 完成, 共 ${#DEST[@]} 个派生文件"
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# dev/webzip.sh — 仅把构建产物 src/webroot 压缩为 dist/webroot.zip (调试 WebUI 用)
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
SRC="$ROOT_DIR/src/webroot"
|
||||
OUT="$ROOT_DIR/dist/webroot.zip"
|
||||
|
||||
command -v zip >/dev/null 2>&1 || {
|
||||
echo "[!] 未找到 zip 命令, 请先安装" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
[ -d "$SRC" ] || {
|
||||
echo "[!] $SRC 不存在, 请先执行 pnpm -C web build" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
mkdir -p "$(dirname "$OUT")"
|
||||
rm -f "$OUT"
|
||||
|
||||
# zip 根 = webroot 内容 (不含 webroot 这层目录)
|
||||
(
|
||||
cd "$SRC"
|
||||
zip -r -9 "$OUT" . \
|
||||
-x '*.git*' \
|
||||
-x '*.DS_Store'
|
||||
)
|
||||
|
||||
echo "[✓] 已打包: $OUT ($(du -h "$OUT" | cut -f1))"
|
||||
@@ -1,6 +0,0 @@
|
||||
id=MyFontModule
|
||||
name=我的字体模块
|
||||
version=1.0
|
||||
versionCode=10
|
||||
author=Yule
|
||||
description=我的字体模块
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "fontmm",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "pnpm -C web dev",
|
||||
"build": "pnpm -C web build && bash dev/cd.sh",
|
||||
"build:only-web": "pnpm -C web build && bash dev/webzip.sh",
|
||||
"lint": "pnpm -C web lint",
|
||||
"fmt": "pnpm -C web fmt",
|
||||
"fmt:check": "pnpm -C web fmt:check",
|
||||
"type-check": "pnpm -C web type-check",
|
||||
"shellcheck": "find src -name '*.sh' -print0 | xargs -0 shellcheck",
|
||||
"shfmt": "find src -name '*.sh' -print0 | xargs -0 shfmt -i 4 -w -d"
|
||||
}
|
||||
}
|
||||
Generated
+9
@@ -0,0 +1,9 @@
|
||||
lockfileVersion: '9.0'
|
||||
|
||||
settings:
|
||||
autoInstallPeers: true
|
||||
excludeLinksFromLockfile: false
|
||||
|
||||
importers:
|
||||
|
||||
.: {}
|
||||
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
#!/sbin/sh
|
||||
|
||||
#################
|
||||
# Initialization
|
||||
#################
|
||||
|
||||
umask 022
|
||||
|
||||
# echo before loading util_functions
|
||||
ui_print() { echo "$1"; }
|
||||
|
||||
require_new_magisk() {
|
||||
ui_print "*******************************"
|
||||
ui_print " Please install Magisk v20.4+! "
|
||||
ui_print "*******************************"
|
||||
exit 1
|
||||
}
|
||||
|
||||
#########################
|
||||
# Load util_functions.sh
|
||||
#########################
|
||||
|
||||
OUTFD=$2
|
||||
ZIPFILE=$3
|
||||
|
||||
mount /data 2>/dev/null
|
||||
|
||||
[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
|
||||
. /data/adb/magisk/util_functions.sh
|
||||
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
|
||||
|
||||
install_module
|
||||
exit 0
|
||||
@@ -0,0 +1 @@
|
||||
#MAGISK
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/system/bin/sh
|
||||
# shellcheck shell=ash
|
||||
# FontMM apply.sh — 应用字体: 把 FONTS/ 里的字体安装到 system/fonts
|
||||
# 用法: apply.sh [模块目录] 默认 /data/adb/modules/FontMM
|
||||
# 回退逻辑: hant/en 缺失时回退到 hans; mono/emoji 缺失时恢复系统原字体
|
||||
MODDIR="${1:-/data/adb/modules/FontMM}"
|
||||
FONTS_DIR="$MODDIR/FONTS"
|
||||
SYS_FONT_DIR="$MODDIR/system/fonts"
|
||||
|
||||
hans_fonts='SysSans-Hans-Regular.ttf
|
||||
SysFont-Static-Regular.ttf
|
||||
SysFont-Myanmar.ttf
|
||||
SysFont-Hans-Regular.ttf
|
||||
SysFont-Regular.ttf'
|
||||
hant_fonts='SysSans-Hant-Regular.ttf
|
||||
SysFont-Hant-Regular.ttf'
|
||||
en_fonts='SysSans-En-Regular.ttf'
|
||||
|
||||
[ -f "$FONTS_DIR/hans.ttf" ] || {
|
||||
echo "[✗] FONTS/hans.ttf 不存在, 请先在 WebUI 选择字体"
|
||||
exit 1
|
||||
}
|
||||
|
||||
mkdir -p "$SYS_FONT_DIR"
|
||||
|
||||
install_from() {
|
||||
local src="$1" list="$2" line=""
|
||||
while IFS= read -r line; do
|
||||
cp -f "$src" "$SYS_FONT_DIR/$line" || {
|
||||
echo "[✗] 复制 $line 失败"
|
||||
exit 1
|
||||
}
|
||||
echo "[*] 安装: $line"
|
||||
done <<EOF
|
||||
$list
|
||||
EOF
|
||||
}
|
||||
|
||||
echo "[*] 安装简体字体..."
|
||||
install_from "$FONTS_DIR/hans.ttf" "$hans_fonts"
|
||||
|
||||
echo "[*] 处理繁体字体..."
|
||||
if [ -f "$FONTS_DIR/hant.ttf" ]; then
|
||||
install_from "$FONTS_DIR/hant.ttf" "$hant_fonts"
|
||||
else
|
||||
echo "[-] 未设置繁体, 回退使用简体"
|
||||
install_from "$FONTS_DIR/hans.ttf" "$hant_fonts"
|
||||
fi
|
||||
|
||||
echo "[*] 处理英文&数字..."
|
||||
if [ -f "$FONTS_DIR/en.ttf" ]; then
|
||||
install_from "$FONTS_DIR/en.ttf" "$en_fonts"
|
||||
else
|
||||
echo "[-] 未设置英文, 回退使用简体"
|
||||
install_from "$FONTS_DIR/hans.ttf" "$en_fonts"
|
||||
fi
|
||||
|
||||
echo "[*] 处理等宽字体..."
|
||||
if [ -f "$FONTS_DIR/mono.ttf" ]; then
|
||||
# 直接替换系统等宽字体 DroidSansMono.ttf (overlay 生效)
|
||||
install_from "$FONTS_DIR/mono.ttf" 'DroidSansMono.ttf'
|
||||
else
|
||||
echo "[-] 未设置等宽字体, 恢复系统等宽字体"
|
||||
rm -f "$SYS_FONT_DIR/DroidSansMono.ttf"
|
||||
fi
|
||||
|
||||
echo "[*] 处理 Emoji 字体..."
|
||||
if [ -f "$FONTS_DIR/emoji.ttf" ]; then
|
||||
# 首次设置前备份模块内嵌的补充字库 NotoColorEmoji.ttf, 供清除时恢复
|
||||
if [ -f "$SYS_FONT_DIR/NotoColorEmoji.ttf" ] && [ ! -f "$MODDIR/backup/NotoColorEmoji.ttf" ]; then
|
||||
mkdir -p "$MODDIR/backup"
|
||||
cp -f "$SYS_FONT_DIR/NotoColorEmoji.ttf" "$MODDIR/backup/NotoColorEmoji.ttf"
|
||||
fi
|
||||
# 直接替换系统 emoji 字体 NotoColorEmoji.ttf (overlay 生效)
|
||||
install_from "$FONTS_DIR/emoji.ttf" 'NotoColorEmoji.ttf'
|
||||
else
|
||||
echo "[-] 未设置 Emoji 字体, 恢复默认"
|
||||
if [ -f "$MODDIR/backup/NotoColorEmoji.ttf" ]; then
|
||||
cp -f "$MODDIR/backup/NotoColorEmoji.ttf" "$SYS_FONT_DIR/NotoColorEmoji.ttf"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "[*] 全部完成, 重启后生效"
|
||||
@@ -0,0 +1,193 @@
|
||||
#!/system/bin/sh
|
||||
# shellcheck shell=ash
|
||||
# shellcheck disable=SC2034
|
||||
# FontMM ColorOS 16 — 刷入脚本
|
||||
# 字体安装统一交给 apply.sh (与 WebUI 共用同一套逻辑)
|
||||
|
||||
REPLACE=""
|
||||
REMOVE=""
|
||||
|
||||
# ---------- 路径 ----------
|
||||
if [ -z "${MODPATH+x}" ]; then
|
||||
case "$0" in
|
||||
*/*) MODPATH="${0%/*}" ;;
|
||||
*) MODPATH="." ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
MOD_WORK_PATH="$MODPATH/FONTS"
|
||||
UPDATE_MODE=0
|
||||
|
||||
# ---------- 日志 ----------
|
||||
log() {
|
||||
local msg="$1"
|
||||
echo "[-] $msg"
|
||||
}
|
||||
|
||||
log_err() {
|
||||
local msg="$1"
|
||||
local code="${2:-1}"
|
||||
if command -v abort >/dev/null 2>&1; then
|
||||
abort "$msg"
|
||||
fi
|
||||
echo "[✗] $msg"
|
||||
exit "$code"
|
||||
}
|
||||
|
||||
log_succ() {
|
||||
local msg="$1"
|
||||
echo "[*] $msg"
|
||||
}
|
||||
|
||||
# ---------- 更新模式 ----------
|
||||
# 检测旧版 FontMM 是否已安装
|
||||
DETECT_UPDATE_MODE() {
|
||||
if [ -d /data/adb/modules/FontMM ]; then
|
||||
UPDATE_MODE=1
|
||||
log "检测到已安装的 FontMM, 进入更新模式"
|
||||
else
|
||||
log "全新安装"
|
||||
fi
|
||||
}
|
||||
|
||||
# 更新模式: 以旧包为主继承字体
|
||||
IMPORT_OLD_FONTS() {
|
||||
[ "$UPDATE_MODE" -eq 1 ] || return 0
|
||||
|
||||
local old_fonts="/data/adb/modules/FontMM/FONTS"
|
||||
if [ ! -d "$old_fonts" ]; then
|
||||
log "注意: 旧模块中没有 FONTS 目录, 将使用新包字体"
|
||||
return 0
|
||||
fi
|
||||
|
||||
mkdir -p "$MOD_WORK_PATH"
|
||||
local f=""
|
||||
for f in hans.ttf hant.ttf en.ttf mono.ttf emoji.ttf; do
|
||||
if [ -f "$old_fonts/$f" ]; then
|
||||
if cp -f "$old_fonts/$f" "$MOD_WORK_PATH/$f"; then
|
||||
log_succ "已从旧模块继承字体: $f"
|
||||
else
|
||||
log_err "继承字体 $f 失败"
|
||||
fi
|
||||
else
|
||||
log "旧包没有 $f, 使用新包字体"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# ---------- 系统检查 ----------
|
||||
# 仅支持 ColorOS 且版本 >= 16.0, 否则拒绝安装
|
||||
CHECK_COLOROS() {
|
||||
local oplus_api=""
|
||||
oplus_api="$(getprop ro.build.version.oplus.api 2>/dev/null || true)"
|
||||
|
||||
if [ -z "$oplus_api" ]; then
|
||||
log_err "当前系统不是 ColorOS, 本模块仅支持 ColorOS 16.0+"
|
||||
fi
|
||||
|
||||
local oplus_display=""
|
||||
oplus_display="$(getprop ro.build.version.oplusrom.display 2>/dev/null || true)"
|
||||
local major="${oplus_display%%.*}"
|
||||
|
||||
if [ "${major:-0}" -lt 16 ] 2>/dev/null; then
|
||||
log_err "ColorOS 版本过低 (${oplus_display:-未知}), 需要 16.0 及以上"
|
||||
fi
|
||||
|
||||
log_succ "ColorOS ${oplus_display}"
|
||||
}
|
||||
|
||||
# ---------- 检查元模块 ----------
|
||||
CHECK_META_MODULE() {
|
||||
if [ ! -f /data/adb/ksud ]; then
|
||||
log "非 KernelSU 环境, 跳过元模块检查"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local ksud_version=""
|
||||
ksud_version="$(/data/adb/ksud --version 2>/dev/null | tr -d '\r' || true)"
|
||||
local ver_num
|
||||
ver_num="$(printf '%s' "$ksud_version" |
|
||||
grep -o '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*' |
|
||||
head -n 1 || true)"
|
||||
log_succ "KernelSU v${ver_num}"
|
||||
local major="${ver_num%%.*}"
|
||||
|
||||
if [ "${major:-0}" -lt 3 ] 2>/dev/null; then
|
||||
log "KernelSU 版本 ${ver_num:-未知} < 3.0.0, 无需元模块"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ ! -f /data/adb/metamodule/module.prop ]; then
|
||||
log "警告: KernelSU >= 3.0.0 需要元模块, 请先安装"
|
||||
return 1
|
||||
fi
|
||||
|
||||
local meta_name=""
|
||||
meta_name="$(sed -n 's/^name=//p' /data/adb/metamodule/module.prop | head -n 1 || true)"
|
||||
if [ -n "$meta_name" ]; then
|
||||
log_succ "元模块已安装: $meta_name"
|
||||
else
|
||||
log "元模块已安装 (但读不到 name 字段)"
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# ---------- 判断 FontLoader ----------
|
||||
CHECK_FONTLOADER() {
|
||||
local fontloader_moddir="/data/adb/modules/fontloader"
|
||||
local fontloader_github="https://github.com/KernelSU-Modules-Repo/fontloader/releases"
|
||||
|
||||
if [ ! -d "$fontloader_moddir" ]; then
|
||||
log "注意: 你还没安装 FontLoader, 如果字体显示效果不佳请安装"
|
||||
log "前往 $fontloader_github 安装 FontLoader"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local prop_file="$fontloader_moddir/module.prop"
|
||||
local version_code=""
|
||||
if [ -f "$prop_file" ]; then
|
||||
version_code="$(sed -n 's/^versionCode=//p' "$prop_file")"
|
||||
fi
|
||||
version_code="$(printf '%s' "$version_code" | tr -cd '0-9')"
|
||||
|
||||
if [ -z "$version_code" ]; then
|
||||
log "注意: 无法读取 FontLoader 版本号, 建议更新到最新版"
|
||||
log "前往 $fontloader_github 更新 FontLoader"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$version_code" -lt 33 ] 2>/dev/null; then
|
||||
log "注意: 你的 FontLoader 版本过低, 建议更新到 v1.2.3+"
|
||||
log "前往 $fontloader_github 更新 FontLoader"
|
||||
else
|
||||
log_succ "FontLoader 版本正常"
|
||||
fi
|
||||
}
|
||||
|
||||
# ---------- 主流程 ----------
|
||||
MAIN() {
|
||||
CHECK_COLOROS
|
||||
if ! CHECK_META_MODULE; then
|
||||
log_err "元模块检查不通过"
|
||||
fi
|
||||
CHECK_FONTLOADER
|
||||
|
||||
echo && log "开始准备字体..."
|
||||
DETECT_UPDATE_MODE
|
||||
IMPORT_OLD_FONTS
|
||||
|
||||
# 备份模块内嵌的补充字库 Emoji 字体, 供用户清除 emoji 槽位时恢复
|
||||
if [ -f "$MODPATH/system/fonts/NotoColorEmoji.ttf" ] && [ ! -f "$MODPATH/backup/NotoColorEmoji.ttf" ]; then
|
||||
mkdir -p "$MODPATH/backup"
|
||||
cp -f "$MODPATH/system/fonts/NotoColorEmoji.ttf" "$MODPATH/backup/NotoColorEmoji.ttf"
|
||||
fi
|
||||
|
||||
echo && log "开始安装字体..."
|
||||
if sh "$MODPATH/apply.sh" "$MODPATH"; then
|
||||
echo && log_succ "所有字体安装成功, 重启设备后生效"
|
||||
else
|
||||
echo && log_err "字体安装出现问题, 请联系开发者"
|
||||
fi
|
||||
}
|
||||
|
||||
MAIN
|
||||
@@ -0,0 +1,7 @@
|
||||
id=FontMM
|
||||
name=FontMM
|
||||
version=26.8.0-beta.3(260800003)
|
||||
versionCode=26080003
|
||||
author=Yule
|
||||
description=ColorOS 16 字体模块模板
|
||||
updateJson=https://raw.githubusercontent.com/YuleBest/FontMM/main/update.json
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018–2022 Cyano Hao
|
||||
Copyright (c) 2022 Shiroki Satsuki
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Losketch
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,94 @@
|
||||
Copyright 2025 The Noto Project Authors (https://github.com/notofonts)
|
||||
Copyright 2025 Mercury13 (https://github.com/Mercury13/unicodia)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
https://openfontlicense.org
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
@@ -0,0 +1,91 @@
|
||||
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font creation
|
||||
efforts of academic and linguistic communities, and to provide a free and
|
||||
open framework in which fonts may be shared and improved in partnership
|
||||
with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply
|
||||
to any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software components as
|
||||
distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to, deleting,
|
||||
or substituting -- in part or in whole -- any of the components of the
|
||||
Original Version, by changing formats or by porting the Font Software to a
|
||||
new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
||||
redistribute, and sell modified and unmodified copies of the Font
|
||||
Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components,
|
||||
in Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the corresponding
|
||||
Copyright Holder. This restriction only applies to the primary font name as
|
||||
presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created
|
||||
using the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Executable → Regular
File renamed without changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,61 @@
|
||||
#!/system/bin/sh
|
||||
# FontMM 工具: 下载国际版小米主题字体并解压提取 (v1.0.0)
|
||||
# 用法: mi-font-download.sh "<标题>" "<主题ID>" "<URL编码标题>"
|
||||
# 流程: 详情API取下载地址 -> 下载 .mtz -> 解压提取 fonts/ 目录字体
|
||||
|
||||
DOWN_DIR="/storage/emulated/0/Download/xttdown"
|
||||
DETAILS_API="https://api.zhuti.intl.xiaomi.com/app/v9/uipages/theme/"
|
||||
DL_BASE="https://f17.market.xiaomi.com/issue/"
|
||||
|
||||
TITLE="$1"
|
||||
ID="$2"
|
||||
ENCODED="$3"
|
||||
|
||||
[ -z "$TITLE" ] || [ -z "$ID" ] || [ -z "$ENCODED" ] && {
|
||||
echo "[x] 参数不足: <标题> <主题ID> <URL编码标题>"
|
||||
echo "__DONE__"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 文件名安全化
|
||||
SAFE_TITLE=$(printf "%s" "$TITLE" | tr -c 'A-Za-z0-9._-' '_')
|
||||
|
||||
echo "[*] 获取「$TITLE」下载链接..."
|
||||
DOWN_URL=$(curl -s "${DETAILS_API}${ID}" | sed -n 's/.*"downloadUrl":"\([^"]*\)".*/\1/p' | head -1)
|
||||
[ -z "$DOWN_URL" ] && {
|
||||
echo "[x] 获取下载链接失败"
|
||||
echo "__DONE__"
|
||||
exit 1
|
||||
}
|
||||
|
||||
DL_URL="${DL_BASE}${DOWN_URL}/${ENCODED}.mtz"
|
||||
SAVE="${DOWN_DIR}/${SAFE_TITLE}.mtz"
|
||||
echo "[*] 下载: ${DL_URL}"
|
||||
mkdir -p "$DOWN_DIR"
|
||||
if ! curl -sL -o "$SAVE" "$DL_URL" || [ ! -s "$SAVE" ]; then
|
||||
echo "[x] 下载失败"
|
||||
echo "__DONE__"
|
||||
exit 1
|
||||
fi
|
||||
echo "[✓] 下载完成: ${SAVE} ($(du -h "$SAVE" | cut -f1))"
|
||||
|
||||
EXTRACT_DIR="${DOWN_DIR}/extracted/${SAFE_TITLE}"
|
||||
echo "[*] 解压 mtz 并提取字体..."
|
||||
mkdir -p "$EXTRACT_DIR"
|
||||
unzip -o -j "$SAVE" 'fonts/*' -d "$EXTRACT_DIR" >/dev/null 2>&1
|
||||
|
||||
# 收集提取出的字体文件 (ttf/otf)
|
||||
FONTS=''
|
||||
for f in "$EXTRACT_DIR"/*.ttf "$EXTRACT_DIR"/*.otf; do
|
||||
[ -f "$f" ] && FONTS="${FONTS} $(basename "$f")"
|
||||
done
|
||||
|
||||
if [ -n "$FONTS" ]; then
|
||||
echo "[✓] 提取字体:"
|
||||
for f in $FONTS; do
|
||||
echo " ${EXTRACT_DIR}/${f}"
|
||||
done
|
||||
else
|
||||
echo "[-] 未在 mtz 中找到字体文件, 原始包保留在 ${SAVE}"
|
||||
fi
|
||||
echo "__DONE__"
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:71fe884571de27f95cc810e1e75c3f73a640283344d3665cac0b64e45baefcc9
|
||||
size 112704011
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"versionCode": 26080003,
|
||||
"version": "v26.8.0-beta.3",
|
||||
"zipUrl": "https://github.com/YuleBest/FontMM/releases/download/v26.8.0-beta.3/FontMM_v26.8.0-beta.3.260800003_template.zip",
|
||||
"changelog": "https://raw.githubusercontent.com/YuleBest/FontMM/main/changelog.md"
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxfmt/configuration_schema.json",
|
||||
"singleQuote": true,
|
||||
"ignorePatterns": []
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "./node_modules/oxlint/configuration_schema.json",
|
||||
"plugins": ["typescript", "unicorn", "oxc"],
|
||||
"categories": {
|
||||
"correctness": "error"
|
||||
},
|
||||
"rules": {},
|
||||
"env": {
|
||||
"builtin": true
|
||||
}
|
||||
}
|
||||
+326
@@ -0,0 +1,326 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta
|
||||
name="viewport"
|
||||
content="width=device-width, initial-scale=1.0, user-scalable=no, viewport-fit=cover"
|
||||
/>
|
||||
<title>FontMM</title>
|
||||
</head>
|
||||
<body>
|
||||
<!-- Top App Bar (滚动后标题固定在左侧, 右上角重启按钮) -->
|
||||
<header class="top-app-bar">
|
||||
<span class="top-app-bar__title" id="top-bar-title"></span>
|
||||
<div class="top-app-bar__actions">
|
||||
<md-icon-button id="reboot-btn" aria-label="重启设备">
|
||||
<md-icon>autorenew</md-icon>
|
||||
</md-icon-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 滑动视图轨道 (三页横排, 切换/手势滑动) -->
|
||||
<div class="view-track" id="view-track">
|
||||
<!-- 主页视图 -->
|
||||
<main id="home-view" class="view view-home active">
|
||||
<div class="home-title">FontMM</div>
|
||||
|
||||
<!-- 模块状态 -->
|
||||
<md-elevated-card class="home-card home-status-card">
|
||||
<div class="home-status-icon">
|
||||
<md-icon>check</md-icon>
|
||||
</div>
|
||||
<div class="home-status-text">
|
||||
<div class="home-status-title" id="home-status">已挂载字体</div>
|
||||
<div class="home-status-sub">版本 <span id="home-version">-</span></div>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<!-- 请我喝咖啡 -->
|
||||
<md-elevated-card class="home-card home-entry-card" id="donate-card">
|
||||
<div class="home-entry-row" id="donate-entry">
|
||||
<div class="home-entry-icon">
|
||||
<md-icon>coffee</md-icon>
|
||||
</div>
|
||||
<div class="home-entry-text">
|
||||
<div class="home-entry-title">请我喝咖啡</div>
|
||||
<div class="home-entry-sub">FontMM 将保持免费开源</div>
|
||||
</div>
|
||||
<md-icon class="home-entry-arrow" id="donate-arrow">expand_more</md-icon>
|
||||
</div>
|
||||
<div class="home-entry-expand" id="donate-expand" hidden>
|
||||
<div class="home-donate-note">感谢您的自愿捐献</div>
|
||||
<button class="home-donate-item" id="donate-alipay">
|
||||
<span class="home-donate-logo">支付宝</span>
|
||||
</button>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<!-- 开发者 -->
|
||||
<md-elevated-card class="home-card home-entry-card">
|
||||
<div class="home-entry-row" id="dev-entry">
|
||||
<div class="home-entry-icon">
|
||||
<md-icon>code</md-icon>
|
||||
</div>
|
||||
<div class="home-entry-text">
|
||||
<div class="home-entry-title">开发者</div>
|
||||
<div class="home-entry-sub">Yule</div>
|
||||
</div>
|
||||
<md-icon class="home-entry-arrow">chevron_right</md-icon>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<!-- 设备信息 -->
|
||||
<md-elevated-card class="home-card home-info-card">
|
||||
<div class="home-info-title">设备信息</div>
|
||||
<div class="home-info-row">
|
||||
<div class="home-info-label">系统版本</div>
|
||||
<div class="home-info-value" id="home-android-version">-</div>
|
||||
</div>
|
||||
<div class="home-info-row">
|
||||
<div class="home-info-label">设备型号</div>
|
||||
<div class="home-info-value" id="home-device-model">-</div>
|
||||
</div>
|
||||
<div class="home-info-row">
|
||||
<div class="home-info-label">系统架构</div>
|
||||
<div class="home-info-value" id="home-abi">-</div>
|
||||
</div>
|
||||
<div class="home-info-row">
|
||||
<div class="home-info-label">已安装字体</div>
|
||||
<div class="home-info-value" id="home-font-count">-</div>
|
||||
</div>
|
||||
<div class="home-info-row">
|
||||
<div class="home-info-label">元模块</div>
|
||||
<div class="home-info-value" id="home-metamodule">-</div>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
</main>
|
||||
|
||||
<!-- 配置视图 -->
|
||||
<main id="config-view" class="view view-config">
|
||||
<div class="home-title">字体配置</div>
|
||||
<div id="slots"></div>
|
||||
</main>
|
||||
|
||||
<!-- 字体测试视图 -->
|
||||
<div id="test-view" class="view view-test">
|
||||
<div class="home-title">字体测试</div>
|
||||
<md-elevated-card class="test-status-card" id="test-status">
|
||||
<div class="test-status-icon">
|
||||
<md-icon>info</md-icon>
|
||||
</div>
|
||||
<div class="test-status-text" id="test-status-text">正在加载字体...</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<div id="test-content" class="test-content" hidden>
|
||||
<md-elevated-card class="test-card test-card-editable" data-edit-target="test-hans">
|
||||
<div class="test-section-title">
|
||||
中文简体 <span class="test-tag" id="hans-tag"></span>
|
||||
</div>
|
||||
<div class="test-sample test-sample-hans" id="test-hans">
|
||||
天地玄黄,宇宙洪荒。日月盈昃,辰宿列张。寒来暑往,秋收冬藏。ABCDE 12345
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<md-elevated-card class="test-card test-card-editable" data-edit-target="test-hant">
|
||||
<div class="test-section-title">
|
||||
中文繁体 <span class="test-tag" id="hant-tag"></span>
|
||||
</div>
|
||||
<div class="test-sample" id="test-hant">
|
||||
天地玄黃,宇宙洪荒。日月盈昃,辰宿列張。寒來暑往,秋收冬藏。ABCDE 12345
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<md-elevated-card class="test-card test-card-editable" data-edit-target="test-en">
|
||||
<div class="test-section-title">
|
||||
英文 & 数字 <span class="test-tag" id="en-tag"></span>
|
||||
</div>
|
||||
<div class="test-sample" id="test-en">
|
||||
The quick brown fox jumps over the lazy dog. 0123456789
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<md-elevated-card class="test-card">
|
||||
<div class="test-section-title">字重<span class="test-tag" id="weight-tag"></span></div>
|
||||
<div class="test-var-note">
|
||||
若各字重显示相同,说明字体为静态单字重或未包含对应字重。
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 100">
|
||||
<span class="test-w-text">100 - 淡体 Thin</span>
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 200">
|
||||
<span class="test-w-text">200 - 特细 ExtraLight</span>
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 300">
|
||||
<span class="test-w-text">300 - 细体 Light</span>
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 400">
|
||||
<span class="test-w-text">400 - 标准 Regular</span>
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 500">
|
||||
<span class="test-w-text">500 - 适中 Medium</span>
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 600">
|
||||
<span class="test-w-text">600 - 次粗 SemiBold</span>
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 700">
|
||||
<span class="test-w-text">700 - 粗体 Bold</span>
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 800">
|
||||
<span class="test-w-text">800 - 特粗 ExtraBold</span>
|
||||
</div>
|
||||
<div class="test-w-row" style="font-weight: 900">
|
||||
<span class="test-w-text">900 - 浓体 Black</span>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<md-elevated-card class="test-card">
|
||||
<div class="test-section-title">
|
||||
可变字体<span class="test-tag" id="var-tag"></span>
|
||||
</div>
|
||||
<div class="test-var-note">
|
||||
拖动滑条调整字重,停止滑动后应用;仅对可变字体 (VF) 生效,静态字体下无变化。
|
||||
</div>
|
||||
<div class="test-wght-row">
|
||||
<span class="test-wght-label">字重</span>
|
||||
<md-slider
|
||||
id="wght-slider"
|
||||
min="100"
|
||||
max="900"
|
||||
step="1"
|
||||
value="400"
|
||||
aria-label="字重滑条"
|
||||
></md-slider>
|
||||
<span class="test-wght-value" id="wght-value">400</span>
|
||||
</div>
|
||||
<div class="test-wght-row">
|
||||
<span class="test-wght-label">字号</span>
|
||||
<md-slider
|
||||
id="size-slider"
|
||||
min="12"
|
||||
max="40"
|
||||
step="1"
|
||||
value="16"
|
||||
aria-label="字号滑条"
|
||||
></md-slider>
|
||||
<span class="test-wght-value" id="size-value">16</span>
|
||||
</div>
|
||||
<div class="test-var-preview" id="test-var-preview">400 - 标准 Regular</div>
|
||||
</md-elevated-card>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 工具视图 -->
|
||||
<div id="tools-view" class="view view-tools">
|
||||
<!-- 工具列表 -->
|
||||
<div id="tools-list">
|
||||
<div class="home-title">工具</div>
|
||||
|
||||
<md-elevated-card class="home-card tool-card home-entry-card" id="mi-font-tool">
|
||||
<div class="home-entry-row">
|
||||
<div class="home-entry-icon">
|
||||
<md-icon>download</md-icon>
|
||||
</div>
|
||||
<div class="home-entry-text">
|
||||
<div class="home-entry-title">下载国际版小米主题字体</div>
|
||||
<div class="home-entry-sub">v1.0.0 · 搜索并下载国际版主题商店的字体 (.mtz)</div>
|
||||
</div>
|
||||
<md-icon class="home-entry-arrow">chevron_right</md-icon>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
</div>
|
||||
|
||||
<!-- 工具详情: 下载国际版小米主题字体 -->
|
||||
<div id="mi-font-page" class="tool-page" hidden>
|
||||
<div class="view-topbar">
|
||||
<md-icon-button id="mi-font-back" aria-label="返回">
|
||||
<md-icon>arrow_back</md-icon>
|
||||
</md-icon-button>
|
||||
<span class="view-topbar-title">下载国际版小米主题字体</span>
|
||||
</div>
|
||||
<div class="mi-search-row">
|
||||
<md-outlined-text-field
|
||||
id="mi-keyword"
|
||||
label="字体关键词"
|
||||
style="flex: 1"
|
||||
></md-outlined-text-field>
|
||||
<md-filled-button id="mi-search-btn">搜索</md-filled-button>
|
||||
</div>
|
||||
<div id="mi-result" class="mi-result"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 悬浮应用按钮 (仅配置页, 向下滚动时隐藏) -->
|
||||
<button id="apply-btn" class="fab" disabled aria-label="应用字体">
|
||||
<md-icon>check_circle</md-icon>
|
||||
<span>应用</span>
|
||||
</button>
|
||||
|
||||
<!-- 测试文本编辑对话框 -->
|
||||
<md-dialog id="edit-text-dialog">
|
||||
<div slot="headline">编辑测试文本</div>
|
||||
<div slot="content">
|
||||
<md-outlined-text-field
|
||||
id="edit-text-input"
|
||||
type="textarea"
|
||||
rows="3"
|
||||
label="测试文本"
|
||||
style="width: 100%"
|
||||
></md-outlined-text-field>
|
||||
</div>
|
||||
<div slot="actions">
|
||||
<md-text-button id="edit-text-cancel">取消</md-text-button>
|
||||
<md-text-button id="edit-text-save">保存</md-text-button>
|
||||
</div>
|
||||
</md-dialog>
|
||||
|
||||
<!-- 重启确认对话框 -->
|
||||
<md-dialog id="reboot-dialog">
|
||||
<div slot="headline">重启设备?</div>
|
||||
<div slot="content">重启后字体才会生效,确定要立即重启设备吗?</div>
|
||||
<div slot="actions">
|
||||
<md-text-button id="reboot-cancel">取消</md-text-button>
|
||||
<md-text-button id="reboot-confirm">重启</md-text-button>
|
||||
</div>
|
||||
</md-dialog>
|
||||
|
||||
<!-- 日志弹窗 -->
|
||||
<md-dialog id="log-dialog">
|
||||
<div slot="headline">应用日志</div>
|
||||
<div slot="content">
|
||||
<pre
|
||||
id="log-content"
|
||||
style="white-space: pre-wrap; font-family: monospace; font-size: 0.8rem"
|
||||
></pre>
|
||||
</div>
|
||||
<div slot="actions">
|
||||
<md-text-button id="log-close">关闭</md-text-button>
|
||||
</div>
|
||||
</md-dialog>
|
||||
|
||||
<!-- 底部导航栏 -->
|
||||
<nav class="bottom-nav">
|
||||
<md-navigation-bar id="nav-bar" active-index="0">
|
||||
<md-navigation-tab label="主页">
|
||||
<md-icon slot="active-icon">home</md-icon>
|
||||
<md-icon slot="inactive-icon">home</md-icon>
|
||||
</md-navigation-tab>
|
||||
<md-navigation-tab label="配置">
|
||||
<md-icon slot="active-icon">tune</md-icon>
|
||||
<md-icon slot="inactive-icon">tune</md-icon>
|
||||
</md-navigation-tab>
|
||||
<md-navigation-tab label="字体测试">
|
||||
<md-icon slot="active-icon">text_fields</md-icon>
|
||||
<md-icon slot="inactive-icon">text_fields</md-icon>
|
||||
</md-navigation-tab>
|
||||
<md-navigation-tab label="工具">
|
||||
<md-icon slot="active-icon">build</md-icon>
|
||||
<md-icon slot="inactive-icon">build</md-icon>
|
||||
</md-navigation-tab>
|
||||
</md-navigation-bar>
|
||||
</nav>
|
||||
|
||||
<script type="module" src="/src/main.ts"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "fontmm-webui",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"lint": "oxlint",
|
||||
"fmt": "oxfmt",
|
||||
"fmt:check": "oxfmt --check",
|
||||
"type-check": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@material/web": "^2.4.1",
|
||||
"kernelsu": "^3.0.2",
|
||||
"material-symbols": "^0.28.0",
|
||||
"opentype.js": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"oxfmt": "^0.61.0",
|
||||
"oxlint": "^1.76.0",
|
||||
"sass": "^1.86.0",
|
||||
"typescript": "^5.8.0",
|
||||
"vite": "^6.0.11"
|
||||
}
|
||||
}
|
||||
Generated
+1402
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,3 @@
|
||||
allowBuilds:
|
||||
'@parcel/watcher': true
|
||||
esbuild: true
|
||||
@@ -0,0 +1,185 @@
|
||||
import '@material/web/dialog/dialog.js';
|
||||
import '@material/web/list/list.js';
|
||||
import '@material/web/list/list-item.js';
|
||||
import '@material/web/icon/icon.js';
|
||||
import '@material/web/iconbutton/icon-button.js';
|
||||
import '@material/web/button/text-button.js';
|
||||
import { exec } from './ksu';
|
||||
|
||||
export interface FileItem {
|
||||
name: string;
|
||||
isDir: boolean;
|
||||
size?: string;
|
||||
}
|
||||
|
||||
export class FontFilePicker {
|
||||
private currentPath = '/storage/emulated/0';
|
||||
private dialogEl!: HTMLElement;
|
||||
private listEl!: HTMLElement;
|
||||
private pathEl!: HTMLElement;
|
||||
private onSelectCallback: (path: string, fileName: string) => void;
|
||||
|
||||
constructor(onSelect: (path: string, fileName: string) => void) {
|
||||
this.onSelectCallback = onSelect;
|
||||
this.initDialog();
|
||||
}
|
||||
|
||||
private initDialog(): void {
|
||||
if (document.getElementById('picker-dialog')) {
|
||||
this.dialogEl = document.getElementById('picker-dialog')!;
|
||||
this.listEl = document.getElementById('picker-list')!;
|
||||
this.pathEl = document.getElementById('picker-path')!;
|
||||
return;
|
||||
}
|
||||
|
||||
const dialogHTML = `
|
||||
<md-dialog id="picker-dialog" class="font-picker-dialog">
|
||||
<div slot="headline" class="picker-header">
|
||||
<div class="picker-title-bar">
|
||||
<md-icon-button id="picker-back-btn" class="picker-back" aria-label="返回上一级">
|
||||
<md-icon>arrow_back</md-icon>
|
||||
</md-icon-button>
|
||||
<div class="picker-path-group">
|
||||
<div class="picker-subtitle">选择字体文件</div>
|
||||
<div id="picker-path" class="picker-path-text">/storage/emulated/0</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div slot="content" class="picker-content">
|
||||
<md-list id="picker-list" class="picker-list"></md-list>
|
||||
</div>
|
||||
|
||||
<div slot="actions">
|
||||
<md-text-button id="picker-cancel-btn">取消</md-text-button>
|
||||
</div>
|
||||
</md-dialog>
|
||||
`;
|
||||
document.body.insertAdjacentHTML('beforeend', dialogHTML);
|
||||
|
||||
this.dialogEl = document.getElementById('picker-dialog')!;
|
||||
this.listEl = document.getElementById('picker-list')!;
|
||||
this.pathEl = document.getElementById('picker-path')!;
|
||||
|
||||
document.getElementById('picker-back-btn')?.addEventListener('click', () => this.navigateUp());
|
||||
document.getElementById('picker-cancel-btn')?.addEventListener('click', () => this.hide());
|
||||
}
|
||||
|
||||
public show(initialPath = '/storage/emulated/0'): void {
|
||||
this.currentPath = initialPath;
|
||||
(this.dialogEl as any).open = true;
|
||||
this.loadDirectory(this.currentPath);
|
||||
}
|
||||
|
||||
public hide(): void {
|
||||
(this.dialogEl as any).open = false;
|
||||
}
|
||||
|
||||
private navigateUp(): void {
|
||||
if (this.currentPath === '/' || this.currentPath === '') return;
|
||||
const parts = this.currentPath.split('/').filter(Boolean);
|
||||
parts.pop();
|
||||
this.currentPath = parts.length === 0 ? '/' : '/' + parts.join('/');
|
||||
this.loadDirectory(this.currentPath);
|
||||
}
|
||||
|
||||
private async loadDirectory(path: string): Promise<void> {
|
||||
this.pathEl.textContent = path;
|
||||
this.listEl.innerHTML = `<div class="picker-loading">正在读取目录...</div>`;
|
||||
|
||||
try {
|
||||
const { items, failed } = await this.readDir(path);
|
||||
if (failed) {
|
||||
this.listEl.innerHTML = `<div class="picker-error">无法读取该目录</div>`;
|
||||
return;
|
||||
}
|
||||
this.renderList(items);
|
||||
} catch (e) {
|
||||
this.listEl.innerHTML = `<div class="picker-error">读取目录异常: ${String(e)}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
// 用 find 列出目录与文件: -print0 以 NUL 分隔路径, 路径含空格/换行也安全
|
||||
// (兼容 busybox 与 GNU find, 不解析 ls 的列输出)
|
||||
private async readDir(path: string): Promise<{ items: FileItem[]; failed: boolean }> {
|
||||
const [dirRes, fileRes] = await Promise.all([
|
||||
exec(`find "${path}" -maxdepth 1 -mindepth 1 -type d -print0`),
|
||||
exec(`find "${path}" -maxdepth 1 -mindepth 1 -type f -print0`),
|
||||
]);
|
||||
|
||||
if (dirRes.errno !== 0 || fileRes.errno !== 0) {
|
||||
return { items: [], failed: true };
|
||||
}
|
||||
|
||||
const dirs = this.splitNul(dirRes.stdout).map((p) => this.basename(p));
|
||||
const files = this.splitNul(fileRes.stdout)
|
||||
.map((p) => this.basename(p))
|
||||
// 仅显示扩展名为 .ttf 的文件
|
||||
.filter((name) => name.toLowerCase().endsWith('.ttf'));
|
||||
|
||||
const items: FileItem[] = [
|
||||
...dirs.map((name) => ({ name, isDir: true })),
|
||||
...files.map((name) => ({ name, isDir: false })),
|
||||
].sort((a, b) => {
|
||||
if (a.isDir && !b.isDir) return -1;
|
||||
if (!a.isDir && b.isDir) return 1;
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
|
||||
return { items, failed: false };
|
||||
}
|
||||
|
||||
// 按 NUL 分隔 find -print0 的输出 (路径内的换行/空格不受影响)
|
||||
private splitNul(output: string): string[] {
|
||||
return output.split('\0').filter(Boolean);
|
||||
}
|
||||
|
||||
private basename(path: string): string {
|
||||
return path.slice(path.lastIndexOf('/') + 1) || path;
|
||||
}
|
||||
|
||||
private renderList(items: FileItem[]): void {
|
||||
if (items.length === 0) {
|
||||
this.listEl.innerHTML = `
|
||||
<div class="picker-empty">
|
||||
<md-icon>find_in_page</md-icon>
|
||||
<span>此目录下没有 .ttf 字体文件</span>
|
||||
</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
this.listEl.innerHTML = items
|
||||
.map(
|
||||
(item) => `
|
||||
<md-list-item class="picker-item ${item.isDir ? 'is-dir' : 'is-file'}" data-name="${item.name}" data-isdir="${item.isDir}">
|
||||
<md-icon slot="start" class="item-icon">
|
||||
${item.isDir ? 'folder' : 'font_download'}
|
||||
</md-icon>
|
||||
<div slot="headline" class="item-name">${item.name}</div>
|
||||
${
|
||||
item.isDir
|
||||
? `<md-icon slot="end" class="item-arrow">chevron_right</md-icon>`
|
||||
: `<md-text-button slot="end" class="item-select-btn">选择</md-text-button>`
|
||||
}
|
||||
</md-list-item>
|
||||
`,
|
||||
)
|
||||
.join('');
|
||||
|
||||
this.listEl.querySelectorAll('.picker-item').forEach((el) => {
|
||||
el.addEventListener('click', () => {
|
||||
const name = (el as HTMLElement).dataset.name!;
|
||||
const isDir = (el as HTMLElement).dataset.isdir === 'true';
|
||||
|
||||
if (isDir) {
|
||||
this.currentPath = this.currentPath === '/' ? `/${name}` : `${this.currentPath}/${name}`;
|
||||
this.loadDirectory(this.currentPath);
|
||||
} else {
|
||||
const fullPath = `${this.currentPath}/${name}`;
|
||||
this.onSelectCallback(fullPath, name);
|
||||
this.hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
+248
@@ -0,0 +1,248 @@
|
||||
import { exec as ksuExec, toast as ksuToast, moduleInfo as ksuModuleInfo } from 'kernelsu';
|
||||
|
||||
export interface ExecResult {
|
||||
errno: number;
|
||||
stdout: string;
|
||||
stderr: string;
|
||||
}
|
||||
|
||||
// dev 模式假文件系统 (用于文件选择器, 路径结构与 Android 一致)
|
||||
const FAKE_FS: Record<string, { dirs: string[]; fonts: string[]; files: string[] }> = {
|
||||
'/': { dirs: ['storage'], fonts: [], files: [] },
|
||||
'/storage': { dirs: ['emulated'], fonts: [], files: [] },
|
||||
'/storage/emulated': { dirs: ['0'], fonts: [], files: [] },
|
||||
'/storage/emulated/0': {
|
||||
dirs: ['Download', 'Fonts', 'Documents', '字体'],
|
||||
fonts: [],
|
||||
files: ['notes.txt'],
|
||||
},
|
||||
'/storage/emulated/0/Download': {
|
||||
dirs: [],
|
||||
fonts: ['HarmonyOS_Sans.ttf', 'MiSans-Bold.ttf', 'AlibabaPuHuiTi.otf'],
|
||||
files: ['a.pdf'],
|
||||
},
|
||||
'/storage/emulated/0/Fonts': {
|
||||
dirs: [],
|
||||
fonts: ['OPPOSans.ttf', 'SourceHanSansCN.ttf', 'Inter-Variable.otf'],
|
||||
files: [],
|
||||
},
|
||||
'/storage/emulated/0/Documents': { dirs: [], fonts: [], files: ['notes.txt'] },
|
||||
'/storage/emulated/0/字体': { dirs: [], fonts: ['思源黑体.ttf', '霞鹜文楷.ttf'], files: [] },
|
||||
};
|
||||
|
||||
async function mockExec(command: string): Promise<ExecResult> {
|
||||
const fake = (stdout = ''): ExecResult => ({ errno: 0, stdout, stderr: '' });
|
||||
const fail = (stderr: string): ExecResult => ({ errno: 1, stdout: '', stderr });
|
||||
const slow = (stdout = '') =>
|
||||
new Promise<ExecResult>((r) => setTimeout(() => r(fake(stdout)), 200));
|
||||
const slowFail = (stderr: string) =>
|
||||
new Promise<ExecResult>((r) => setTimeout(() => r(fail(stderr)), 200));
|
||||
|
||||
// find 命令: 解析路径与类型 (d/f), 返回假目录/文件, 以 NUL 分隔 (与 -print0 一致)
|
||||
if (command.startsWith('find ')) {
|
||||
const m = command.match(
|
||||
/^find ['"]([^'"]*)['"] -maxdepth 1 -mindepth 1 -type ([df]) ?-print0$/,
|
||||
);
|
||||
if (!m) return slow(`(mock 未定义: ${command})`);
|
||||
const dir = m[1];
|
||||
const node = FAKE_FS[dir];
|
||||
if (!node) return slowFail(`find: ${dir}: No such file or directory`);
|
||||
const full = (name: string) => (dir === '/' ? `/${name}` : `${dir}/${name}`);
|
||||
const lines = m[2] === 'd' ? node.dirs.map(full) : [...node.fonts, ...node.files].map(full);
|
||||
return slow(lines.join('\0'));
|
||||
}
|
||||
|
||||
// 字体测试: 模拟 FONT 字体已放入 webroot/fonts-test, 返回可用字体列表
|
||||
if (command.includes('fonts-test')) {
|
||||
return slow('hans.ttf\nhant.ttf\nen.ttf\nmono.ttf\nemoji.ttf');
|
||||
}
|
||||
|
||||
if (command.includes('rm -f')) return fake('');
|
||||
if (command.includes('cp -f')) return fake('');
|
||||
if (command.includes('apply.sh')) {
|
||||
return fake('[*] 安装: SysSans-Hans-Regular.ttf (模拟)\n[*] 全部完成, 重启后生效 (模拟)');
|
||||
}
|
||||
|
||||
// 元模块 (KernelSU 3.0+ 需要): 模拟已安装
|
||||
if (command.includes('metamodule')) {
|
||||
return slow('name=KernelSU MetaModule\nversion=v1.0\nauthor=KernelSU');
|
||||
}
|
||||
|
||||
// 小米主题字体工具: 搜索/详情/下载 (模拟)
|
||||
if (command.includes('thm.market.intl.xiaomi.com')) {
|
||||
return slow(
|
||||
JSON.stringify({
|
||||
apiData: {
|
||||
cards: [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
schema: {
|
||||
clicks: [
|
||||
{ title: 'MiSans Global (模拟)', link: 'mock-font-1' },
|
||||
{ title: 'OPPO Sans (模拟)', link: 'mock-font-2' },
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (command.includes('api.zhuti.intl.xiaomi.com')) {
|
||||
return slow(
|
||||
JSON.stringify({
|
||||
apiData: { extraInfo: { themeDetail: { downloadUrl: 'mock/download/path' } } },
|
||||
}),
|
||||
);
|
||||
}
|
||||
// 下载: 后台启动脚本 (立即返回)
|
||||
if (command.includes('nohup sh') && command.includes('mi-font-download.sh')) {
|
||||
return fake('');
|
||||
}
|
||||
// 下载: 轮询日志文件 (模拟完整日志 + 结束标记)
|
||||
if (command.includes('mi-download.log')) {
|
||||
return slow(
|
||||
[
|
||||
'[*] 获取「MiSans Global (模拟)」下载链接...',
|
||||
'[*] 下载: https://f17.market.xiaomi.com/issue/mock/download/path/MiSans%20Global%20(模拟).mtz',
|
||||
'[✓] 下载完成: /storage/emulated/0/Download/xttdown/MiSans_Global_模拟_.mtz (23.3M)',
|
||||
'[*] 解压 mtz 并提取字体...',
|
||||
'[✓] 提取字体:',
|
||||
' /storage/emulated/0/Download/xttdown/extracted/MiSans_Global_模拟_/Roboto-Regular.ttf',
|
||||
' /storage/emulated/0/Download/xttdown/extracted/MiSans_Global_模拟_/MiSans-DemiBold.ttf',
|
||||
'__DONE__',
|
||||
].join('\n'),
|
||||
);
|
||||
}
|
||||
|
||||
if (command.includes('ro.product.model')) return slow('Pixel 8 Pro (模拟设备)');
|
||||
return slow(`(mock 未定义: ${command})`);
|
||||
}
|
||||
|
||||
export async function exec(command: string): Promise<ExecResult> {
|
||||
if (import.meta.env.DEV) return mockExec(command);
|
||||
// KernelSU-Next 等分支的 ksu API 可能与 KernelSU 不一致, 缺失时优雅降级
|
||||
if (typeof ksuExec !== 'function') {
|
||||
return { errno: 1, stdout: '', stderr: 'kernelsu exec API 不可用' };
|
||||
}
|
||||
return ksuExec(command);
|
||||
}
|
||||
|
||||
export function toast(msg: string): void {
|
||||
if (import.meta.env.DEV) console.log('[toast]', msg);
|
||||
else if (typeof ksuToast === 'function') ksuToast(msg);
|
||||
}
|
||||
|
||||
// 模块信息 (module.prop 风格文本), dev 模式返回模拟数据
|
||||
export function moduleInfo(): string {
|
||||
if (import.meta.env.DEV) {
|
||||
return [
|
||||
'id=FontMM',
|
||||
'name=FontMM',
|
||||
'version=26.8.0-beta.1(260800001)',
|
||||
'versionCode=26080001',
|
||||
'author=Yule',
|
||||
'description=ColorOS 16 字体模块模板',
|
||||
].join('\n');
|
||||
}
|
||||
if (typeof ksuModuleInfo === 'function') return ksuModuleInfo();
|
||||
return '';
|
||||
}
|
||||
|
||||
// 全屏: 让 WebView 内容延伸到状态栏 / 底部导航栏(小白条) 下方
|
||||
export function fullScreen(enabled: boolean): void {
|
||||
if (import.meta.env.DEV) return;
|
||||
// 直接调用全局 ksu (绕过 npm 包封装), KernelSU-Next 分支缺失/命名不同时忽略
|
||||
try {
|
||||
const ksuApi = (window as any).ksu as Record<string, unknown> | undefined;
|
||||
if (ksuApi && typeof ksuApi.fullScreen === 'function') {
|
||||
(ksuApi.fullScreen as (v: boolean) => void)(enabled);
|
||||
}
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
|
||||
// edge-to-edge: 启用安全区 insets (配合 insets.css 的 --window-inset-* 变量)
|
||||
export function enableEdgeToEdge(enabled: boolean): void {
|
||||
if (import.meta.env.DEV) return;
|
||||
// 关键: 不能检查 npm 包的 import 绑定 (它始终存在, 真正的 TypeError 在包内部
|
||||
// 调用 ksu.enableEdgeToEdge 时抛出, 会中断整个脚本)。必须直接检查全局 ksu 对象。
|
||||
// KernelSU: enableEdgeToEdge; KernelSU-Next: enableInsets (命名不同)
|
||||
try {
|
||||
const ksuApi = (window as any).ksu as Record<string, unknown> | undefined;
|
||||
if (!ksuApi) return;
|
||||
const fn = (ksuApi.enableEdgeToEdge ?? ksuApi.enableInsets) as
|
||||
| ((v: boolean) => void)
|
||||
| undefined;
|
||||
if (typeof fn === 'function') fn(enabled);
|
||||
} catch {
|
||||
// 忽略
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 主页: 设备 / 模块信息 ----------------
|
||||
|
||||
export interface SystemInfo {
|
||||
/** ro.build.version.release, 如 "16.0" */
|
||||
androidVersion: string;
|
||||
/** ro.build.version.sdk, 如 "36" */
|
||||
sdk: string;
|
||||
/** ro.product.model, 如 "PHZ110" */
|
||||
deviceModel: string;
|
||||
/** ro.product.cpu.abi, 如 "arm64-v8a" */
|
||||
abi: string;
|
||||
/** FONTS/ 中实际存在的用户字体文件数 (0-4) */
|
||||
fontCount: number;
|
||||
}
|
||||
|
||||
// 模块 FONT 目录 (与 main.ts 的 FONTS_DIR 保持一致)
|
||||
const MODULE_FONTS_DIR = '/data/adb/modules/FontMM/FONTS';
|
||||
|
||||
export async function getSystemInfo(): Promise<SystemInfo> {
|
||||
if (import.meta.env.DEV) {
|
||||
return {
|
||||
androidVersion: '16.0',
|
||||
sdk: '36',
|
||||
deviceModel: 'Pixel 8 Pro (模拟设备)',
|
||||
abi: 'arm64-v8a',
|
||||
fontCount: 2,
|
||||
};
|
||||
}
|
||||
const info: SystemInfo = { androidVersion: '', sdk: '', deviceModel: '', abi: '', fontCount: 0 };
|
||||
try {
|
||||
const props = [
|
||||
'ro.build.version.release',
|
||||
'ro.build.version.sdk',
|
||||
'ro.product.model',
|
||||
'ro.product.cpu.abi',
|
||||
];
|
||||
const { errno, stdout } = await exec(
|
||||
`${props.map((p) => `getprop ${p}`).join('; ')}; ls -1 '${MODULE_FONTS_DIR}'/*.ttf 2>/dev/null`,
|
||||
);
|
||||
if (errno === 0) {
|
||||
const lines = stdout.split('\n');
|
||||
[info.androidVersion, info.sdk, info.deviceModel, info.abi] = lines
|
||||
.slice(0, 4)
|
||||
.map((l) => l.trim());
|
||||
// 剩余行是 FONTS/ 中实际存在的字体文件名
|
||||
info.fontCount = lines.slice(4).filter((l) => l.trim() && l.endsWith('.ttf')).length;
|
||||
}
|
||||
} catch {
|
||||
// 读取失败时保持空值, 由 UI 显示占位
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
// 用 am start 在 WebUI 之外打开链接/应用 (避免在 WebView 内打开)
|
||||
export async function amStart(uri: string, pkg?: string): Promise<void> {
|
||||
const cmd = `am start -a android.intent.action.VIEW -d '${uri}'${pkg ? ` -p ${pkg}` : ''}`;
|
||||
if (import.meta.env.DEV) {
|
||||
console.log('[am start]', cmd);
|
||||
return;
|
||||
}
|
||||
await exec(cmd);
|
||||
}
|
||||
+790
@@ -0,0 +1,790 @@
|
||||
import '@material/web/button/outlined-button.js';
|
||||
import '@material/web/button/text-button.js';
|
||||
import '@material/web/iconbutton/icon-button.js';
|
||||
import '@material/web/icon/icon.js';
|
||||
import '@material/web/textfield/outlined-text-field.js';
|
||||
import '@material/web/dialog/dialog.js';
|
||||
import '@material/web/slider/slider.js';
|
||||
import '@material/web/labs/card/elevated-card.js';
|
||||
import '@material/web/labs/card/filled-card.js';
|
||||
import '@material/web/labs/navigationbar/navigation-bar.js';
|
||||
import '@material/web/labs/navigationtab/navigation-tab.js';
|
||||
import 'material-symbols/outlined.css';
|
||||
|
||||
import './theme.scss';
|
||||
import './style.scss';
|
||||
|
||||
import { amStart, exec, enableEdgeToEdge, getSystemInfo, moduleInfo, toast } from './ksu';
|
||||
import { FontFilePicker } from './fontPicker';
|
||||
import { MiFontTool } from './tools';
|
||||
import type { FontSlot } from './types';
|
||||
import * as opentype from 'opentype.js';
|
||||
|
||||
// edge-to-edge: 启用安全区 insets, 内容延伸至状态栏/底部小白条区域,
|
||||
// insets.css 的 --window-inset-* 变量随之生效, 底栏据此避让
|
||||
enableEdgeToEdge(true);
|
||||
|
||||
const FONTS_DIR = '/data/adb/modules/FontMM/FONTS';
|
||||
|
||||
const slots: Record<'hans' | 'hant' | 'en' | 'mono' | 'emoji', FontSlot> = {
|
||||
hans: {
|
||||
key: 'hans',
|
||||
title: '中文简体',
|
||||
path: null,
|
||||
fileName: '',
|
||||
},
|
||||
hant: {
|
||||
key: 'hant',
|
||||
title: '中文繁体',
|
||||
path: null,
|
||||
fileName: '',
|
||||
},
|
||||
en: {
|
||||
key: 'en',
|
||||
title: '英文 & 数字',
|
||||
path: null,
|
||||
fileName: '',
|
||||
},
|
||||
mono: {
|
||||
key: 'mono',
|
||||
title: '等宽字体',
|
||||
path: null,
|
||||
fileName: '',
|
||||
},
|
||||
emoji: {
|
||||
key: 'emoji',
|
||||
title: 'Emoji 表情',
|
||||
path: null,
|
||||
fileName: '',
|
||||
},
|
||||
};
|
||||
|
||||
const slotsEl = document.getElementById('slots')!;
|
||||
const applyBtn = document.getElementById('apply-btn') as HTMLButtonElement;
|
||||
const logDialog = document.getElementById('log-dialog') as any;
|
||||
const logContent = document.getElementById('log-content')!;
|
||||
|
||||
document.getElementById('log-close')?.addEventListener('click', () => {
|
||||
logDialog.open = false;
|
||||
});
|
||||
|
||||
let pickingKey: keyof typeof slots = 'hans';
|
||||
let applying = false;
|
||||
|
||||
const picker = new FontFilePicker((path, name) => {
|
||||
const slot = slots[pickingKey];
|
||||
slot.path = path;
|
||||
slot.fileName = name;
|
||||
renderSlots();
|
||||
void refreshSlotInfo(slot);
|
||||
});
|
||||
|
||||
// ---------- 字体名称解析 (opentype.js) ----------
|
||||
// 从字体名称表提取 family name, 优先中文字体名
|
||||
function extractFamilyName(font: any): string | null {
|
||||
const pick = (table: any): string | null => {
|
||||
if (!table) return null;
|
||||
const family = table.fontFamily ?? table.fullName;
|
||||
if (!family || typeof family !== 'object') return null;
|
||||
for (const lang of ['zh-CN', 'zh-Hans', 'zh', 'zh-TW', 'zh-Hant', 'en', 'en-US']) {
|
||||
if (typeof family[lang] === 'string' && family[lang]) return family[lang];
|
||||
}
|
||||
const first = Object.values(family).find((v) => typeof v === 'string' && v);
|
||||
return first ? String(first) : null;
|
||||
};
|
||||
return pick(font.names?.windows) ?? pick(font.names?.macintosh);
|
||||
}
|
||||
|
||||
// 读取 fonts-test/ 下字体文件的名称与大小 (WebView 仅能访问 webroot 内文件)
|
||||
async function readFontInfo(
|
||||
file: string,
|
||||
): Promise<{ name?: string; sizeText?: string; isVariable?: boolean }> {
|
||||
// dev 假数据: 模拟各槽位字体的名称/大小/可变标识
|
||||
if (import.meta.env.DEV) {
|
||||
const MOCK_FONT_INFO: Record<string, { name: string; size: string; variable: boolean }> = {
|
||||
'hans.ttf': { name: 'HarmonyOS Sans SC', size: '13.5 MB', variable: true },
|
||||
'hant.ttf': { name: '源樣明體', size: '21.2 MB', variable: false },
|
||||
'en.ttf': { name: 'Inter Variable', size: '0.8 MB', variable: true },
|
||||
'mono.ttf': { name: 'JetBrains Mono', size: '1.2 MB', variable: false },
|
||||
'emoji.ttf': { name: 'Noto Color Emoji', size: '9.8 MB', variable: false },
|
||||
};
|
||||
const mock = MOCK_FONT_INFO[file];
|
||||
return mock ? { name: mock.name, sizeText: mock.size, isVariable: mock.variable } : {};
|
||||
}
|
||||
try {
|
||||
const res = await fetch(`fonts-test/${file}`);
|
||||
if (!res.ok) return {};
|
||||
const buf = await res.arrayBuffer();
|
||||
const font = opentype.parse(buf);
|
||||
const name = extractFamilyName(font);
|
||||
const sizeText = `${(buf.byteLength / 1024 / 1024).toFixed(1)} MB`;
|
||||
return { name: name ?? undefined, sizeText, isVariable: Boolean(font.tables?.fvar) };
|
||||
} catch {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
// 选择新字体后: 复制到 fonts-test 供解析, 更新卡片显示的名称/大小
|
||||
async function refreshSlotInfo(slot: FontSlot) {
|
||||
if (!slot.path) return;
|
||||
try {
|
||||
await exec(`cp -f '${slot.path}' '${TEST_FONT_DIR}/${slot.key}.ttf'`);
|
||||
const info = await readFontInfo(`${slot.key}.ttf`);
|
||||
if (info.name) slot.fileName = info.name;
|
||||
if (info.sizeText) slot.sizeText = info.sizeText;
|
||||
// 无条件同步: 防止换字体后旧的可变标记残留
|
||||
slot.isVariable = Boolean(info.isVariable);
|
||||
renderSlots();
|
||||
} catch {
|
||||
// 忽略解析失败, 保持选择器返回的文件名
|
||||
}
|
||||
}
|
||||
|
||||
// 打开 WebUI 时: 复制 FONT/ 到 fonts-test, 读取已有字体的名称/大小填充卡片
|
||||
async function loadExistingFonts() {
|
||||
const available = await ensureFontsCopy();
|
||||
for (const key of ['hans', 'hant', 'en', 'mono', 'emoji'] as const) {
|
||||
const file = `${key}.ttf`;
|
||||
if (!available.includes(file)) continue;
|
||||
const slot = slots[key];
|
||||
const info = await readFontInfo(file);
|
||||
slot.path = `${FONTS_DIR}/${file}`;
|
||||
slot.fileName = info.name ?? file;
|
||||
if (info.sizeText) slot.sizeText = info.sizeText;
|
||||
slot.isVariable = Boolean(info.isVariable);
|
||||
}
|
||||
renderSlots();
|
||||
}
|
||||
|
||||
// 未选择时的占位文案: 回退可视化 (WYSIWYG)
|
||||
function slotPlaceholder(slot: FontSlot): string {
|
||||
if (slot.path) return slot.fileName;
|
||||
if (slot.key === 'hans') return '未选择字体文件';
|
||||
if (slots.hans.path) {
|
||||
if (slot.key === 'mono') return '未选择,保持系统等宽字体';
|
||||
if (slot.key === 'emoji') return '未选择,保持系统 Emoji';
|
||||
return `默认使用:${slots.hans.fileName}`;
|
||||
}
|
||||
return '未选择字体文件';
|
||||
}
|
||||
|
||||
function renderSlots() {
|
||||
slotsEl.innerHTML = Object.values(slots)
|
||||
.map((slot) => {
|
||||
// 选了其他槽位但未选简体时, 简体卡片提示"必选"
|
||||
const required =
|
||||
slot.key === 'hans' &&
|
||||
!slot.path &&
|
||||
Object.values(slots).some((s) => s.key !== 'hans' && s.path);
|
||||
const nameText = required ? '未选择字体,此项为必选项' : slotPlaceholder(slot);
|
||||
// 扩展名大写 (TTF/OTF...), 从源文件路径动态提取, 不硬编码
|
||||
const ext = slot.path ? (slot.path.split('.').pop() ?? '').toUpperCase() : '';
|
||||
return `
|
||||
<md-filled-card class="slot-card ${slot.key === 'hans' ? 'slot-hans' : ''} ${slot.path ? 'selected' : ''}" data-key="${slot.key}">
|
||||
<div class="slot-header">
|
||||
<div class="slot-title-group">
|
||||
<span class="slot-title">${slot.title}</span>
|
||||
</div>
|
||||
<md-icon class="slot-arrow">chevron_right</md-icon>
|
||||
</div>
|
||||
|
||||
<div class="slot-file">
|
||||
${
|
||||
slot.path
|
||||
? `<md-icon-button class="slot-clear" data-key="${slot.key}" aria-label="取消选择">
|
||||
<md-icon>close</md-icon>
|
||||
</md-icon-button>`
|
||||
: ''
|
||||
}
|
||||
<div class="slot-file-text">
|
||||
<div class="slot-name ${!slot.path ? 'placeholder' : ''} ${required ? 'required' : ''}">${nameText}</div>
|
||||
${
|
||||
slot.path
|
||||
? `<div class="slot-meta"><span class="slot-meta-badge">${slot.sizeText || '…'}</span>${ext ? `<span class="slot-meta-badge">${ext}</span>` : ''}${slot.isVariable ? '<span class="slot-meta-badge slot-meta-badge--variable">可变字体</span>' : ''}</div>`
|
||||
: ''
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</md-filled-card>
|
||||
`;
|
||||
})
|
||||
.join('');
|
||||
|
||||
// 绑定事件: 整卡点击选择字体
|
||||
slotsEl.querySelectorAll<HTMLElement>('.slot-card').forEach((card) => {
|
||||
card.addEventListener('click', () => {
|
||||
pickingKey = card.dataset.key as keyof typeof slots;
|
||||
picker.show();
|
||||
});
|
||||
});
|
||||
slotsEl.querySelectorAll<HTMLElement>('.slot-clear').forEach((btn) => {
|
||||
btn.addEventListener('click', (e) => {
|
||||
e.stopPropagation(); // 阻止冒泡触发卡片选择
|
||||
const slot = slots[btn.dataset.key as keyof typeof slots];
|
||||
slot.path = null;
|
||||
slot.fileName = '';
|
||||
renderSlots();
|
||||
});
|
||||
});
|
||||
|
||||
if (applyBtn) {
|
||||
// 未选择简体字体时直接隐藏按钮 (不做半透明禁用)
|
||||
applyBtn.style.display = !slots.hans.path ? 'none' : '';
|
||||
applyBtn.disabled = applying;
|
||||
}
|
||||
}
|
||||
|
||||
async function copyFont(src: string, dest: string) {
|
||||
const { errno, stderr } = await exec(`cp -f '${src}' '${dest}'`);
|
||||
if (errno !== 0) throw new Error(`复制失败: ${stderr}`);
|
||||
}
|
||||
|
||||
async function apply() {
|
||||
if (!slots.hans.path) return;
|
||||
applying = true;
|
||||
renderSlots();
|
||||
try {
|
||||
// 启动加载的字体 path 即 FONT/ 内的文件, 无需再复制
|
||||
if (slots.hans.path !== `${FONTS_DIR}/hans.ttf`) {
|
||||
await copyFont(slots.hans.path, `${FONTS_DIR}/hans.ttf`);
|
||||
}
|
||||
|
||||
if (slots.hant.path) {
|
||||
if (slots.hant.path !== `${FONTS_DIR}/hant.ttf`) {
|
||||
await copyFont(slots.hant.path, `${FONTS_DIR}/hant.ttf`);
|
||||
}
|
||||
} else {
|
||||
await exec(`rm -f '${FONTS_DIR}/hant.ttf'`);
|
||||
}
|
||||
|
||||
if (slots.en.path) {
|
||||
if (slots.en.path !== `${FONTS_DIR}/en.ttf`) {
|
||||
await copyFont(slots.en.path, `${FONTS_DIR}/en.ttf`);
|
||||
}
|
||||
} else {
|
||||
await exec(`rm -f '${FONTS_DIR}/en.ttf'`);
|
||||
}
|
||||
|
||||
if (slots.mono.path) {
|
||||
if (slots.mono.path !== `${FONTS_DIR}/mono.ttf`) {
|
||||
await copyFont(slots.mono.path, `${FONTS_DIR}/mono.ttf`);
|
||||
}
|
||||
} else {
|
||||
await exec(`rm -f '${FONTS_DIR}/mono.ttf'`);
|
||||
}
|
||||
|
||||
if (slots.emoji.path) {
|
||||
if (slots.emoji.path !== `${FONTS_DIR}/emoji.ttf`) {
|
||||
await copyFont(slots.emoji.path, `${FONTS_DIR}/emoji.ttf`);
|
||||
}
|
||||
} else {
|
||||
await exec(`rm -f '${FONTS_DIR}/emoji.ttf'`);
|
||||
}
|
||||
|
||||
const { errno, stdout, stderr } = await exec('sh /data/adb/modules/FontMM/apply.sh');
|
||||
if (errno !== 0) throw new Error(stderr || 'apply.sh 执行失败');
|
||||
|
||||
if (logContent && logDialog) {
|
||||
logContent.textContent = stdout;
|
||||
logDialog.open = true;
|
||||
}
|
||||
toast('字体已应用,重启后生效');
|
||||
// 字体已变化: 下次进入测试页时重新加载
|
||||
testLoaded = false;
|
||||
} catch (e) {
|
||||
toast(`应用失败: ${String(e)}`);
|
||||
} finally {
|
||||
applying = false;
|
||||
renderSlots();
|
||||
}
|
||||
}
|
||||
|
||||
applyBtn?.addEventListener('click', apply);
|
||||
renderSlots();
|
||||
|
||||
// ---------------- 导航与视图切换 ----------------
|
||||
const homeView = document.getElementById('home-view')!;
|
||||
const configView = document.getElementById('config-view')!;
|
||||
const testView = document.getElementById('test-view')!;
|
||||
const toolsView = document.getElementById('tools-view')!;
|
||||
|
||||
const views = [homeView, configView, testView, toolsView];
|
||||
const navBar = document.getElementById('nav-bar') as any;
|
||||
// 悬浮应用按钮 (与配置页绑定, 仅配置页显示)
|
||||
const applyFab = document.getElementById('apply-btn') as HTMLElement;
|
||||
// 重启按钮 (仅主页显示, 其他页隐藏)
|
||||
const rebootBtn = document.getElementById('reboot-btn');
|
||||
// 滑动视图轨道
|
||||
const viewTrack = document.getElementById('view-track')!;
|
||||
let currentIndex = 0;
|
||||
|
||||
// 顶栏滚动标题: 各页标题元素与相对偏移 (标题中心移出视口顶部时固定在顶栏)
|
||||
const topBarTitle = document.getElementById('top-bar-title')!;
|
||||
const pageTitleEls = Array.from(document.querySelectorAll<HTMLElement>('.home-title'));
|
||||
const titleOffsets = views.map((view, i) => {
|
||||
const el = pageTitleEls[i];
|
||||
if (!el) return 0;
|
||||
return el.getBoundingClientRect().top - view.getBoundingClientRect().top + view.scrollTop;
|
||||
});
|
||||
|
||||
// 视口 pager: 轨道高度 = 视口 - 顶栏 (显式计算, 避免依赖 vh/dvh/flex 解析)
|
||||
function updateTrackHeight() {
|
||||
const topBar = document.querySelector<HTMLElement>('.top-app-bar');
|
||||
const h = window.innerHeight - (topBar?.offsetHeight ?? 64);
|
||||
viewTrack.style.height = `${Math.max(0, h)}px`;
|
||||
}
|
||||
updateTrackHeight();
|
||||
window.addEventListener('resize', updateTrackHeight);
|
||||
window.addEventListener('orientationchange', () => setTimeout(updateTrackHeight, 100));
|
||||
|
||||
function showView(index: number) {
|
||||
const target = Math.max(0, Math.min(views.length - 1, index));
|
||||
currentIndex = target;
|
||||
views.forEach((v, i) => v.classList.toggle('active', i === target));
|
||||
// 轨道滑动切换动画
|
||||
viewTrack.style.transform = `translateX(${-target * 100}%)`;
|
||||
// 悬浮应用按钮仅配置页显示, 且未选简体字体时不展示
|
||||
applyFab.style.display = target === 1 && slots.hans.path ? '' : 'none';
|
||||
// 重启按钮仅主页显示 (visibility 保持顶栏布局不跳动)
|
||||
if (rebootBtn) rebootBtn.style.visibility = target === 0 ? 'visible' : 'hidden';
|
||||
// 同步底部导航高亮
|
||||
if (navBar) navBar.activeIndex = target;
|
||||
// 每页独立滚动, 切换后回到该页顶部
|
||||
views[target].scrollTop = 0;
|
||||
// 顶栏标题: 切换页时更新文字, 并回到未滚动状态 (标题在内容区显示)
|
||||
topBarTitle.textContent = pageTitleEls[target]?.textContent ?? '';
|
||||
document.body.classList.remove('title-scrolled');
|
||||
if (target === 0) loadHome();
|
||||
if (target === 2) loadTestFonts();
|
||||
}
|
||||
|
||||
// 手势滑动切换 (跟手拖拽 + 边界限制)
|
||||
let touchStartX = 0;
|
||||
let touchStartY = 0;
|
||||
let touchDragging = false;
|
||||
// touchmove 节流: 每帧最多写入一次 transform, 避免慢滑时高频样式操作压垮主线程
|
||||
let rafPending = false;
|
||||
let lastDragDx = 0;
|
||||
|
||||
viewTrack.addEventListener(
|
||||
'touchstart',
|
||||
(e) => {
|
||||
// 滑条等可横向拖动组件内的触摸不触发页面切换 (composedPath 穿透 shadow DOM)
|
||||
if (e.composedPath().some((el) => el instanceof Element && el.tagName === 'MD-SLIDER')) {
|
||||
return;
|
||||
}
|
||||
touchStartX = e.touches[0].clientX;
|
||||
touchStartY = e.touches[0].clientY;
|
||||
touchDragging = true;
|
||||
},
|
||||
{ passive: true },
|
||||
);
|
||||
|
||||
viewTrack.addEventListener(
|
||||
'touchmove',
|
||||
(e) => {
|
||||
if (!touchDragging) return;
|
||||
const dx = e.touches[0].clientX - touchStartX;
|
||||
const dy = e.touches[0].clientY - touchStartY;
|
||||
// 仅横向意图时跟手拖动 (避免干扰页面纵向滚动)
|
||||
if (Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > 8) {
|
||||
e.preventDefault();
|
||||
viewTrack.style.transition = 'none';
|
||||
lastDragDx = dx;
|
||||
if (rafPending) return;
|
||||
rafPending = true;
|
||||
requestAnimationFrame(() => {
|
||||
rafPending = false;
|
||||
// touchend/touchcancel 后丢弃残留的拖拽更新, 避免覆盖切换动画
|
||||
if (!touchDragging) return;
|
||||
// 边界阻尼: 首页右拖 / 末页左拖 阻力减半, 增强边界手感
|
||||
let effDx = lastDragDx;
|
||||
if (
|
||||
(currentIndex === 0 && lastDragDx > 0) ||
|
||||
(currentIndex === views.length - 1 && lastDragDx < 0)
|
||||
) {
|
||||
effDx = lastDragDx / 3;
|
||||
}
|
||||
viewTrack.style.transform = `translateX(calc(${-currentIndex * 100}% + ${effDx}px))`;
|
||||
});
|
||||
}
|
||||
},
|
||||
{ passive: false },
|
||||
);
|
||||
|
||||
viewTrack.addEventListener(
|
||||
'touchend',
|
||||
(e) => {
|
||||
touchDragging = false;
|
||||
viewTrack.style.transition = '';
|
||||
const dx = e.changedTouches[0].clientX - touchStartX;
|
||||
const canPrev = currentIndex > 0;
|
||||
const canNext = currentIndex < views.length - 1;
|
||||
if (Math.abs(dx) > 60 && ((dx < 0 && canNext) || (dx > 0 && canPrev))) {
|
||||
showView(currentIndex + (dx < 0 ? 1 : -1));
|
||||
} else {
|
||||
// 未达阈值回弹: 仅恢复轨道位置, 不调用 showView (避免重置页面滚动位置)
|
||||
viewTrack.style.transform = `translateX(${-currentIndex * 100}%)`;
|
||||
}
|
||||
},
|
||||
{ passive: true },
|
||||
);
|
||||
|
||||
// 触摸被系统打断 (来电/手势等): 复位拖拽状态并回弹
|
||||
viewTrack.addEventListener('touchcancel', () => {
|
||||
touchDragging = false;
|
||||
viewTrack.style.transition = '';
|
||||
viewTrack.style.transform = `translateX(${-currentIndex * 100}%)`;
|
||||
});
|
||||
|
||||
// 悬浮按钮滚动隐藏: 向下滚动移出视口, 向上滚动出现 (每页独立滚动)
|
||||
views.forEach((view, i) => {
|
||||
let lastY = 0;
|
||||
view.addEventListener(
|
||||
'scroll',
|
||||
() => {
|
||||
const y = view.scrollTop;
|
||||
if (y > lastY + 4) applyFab.classList.add('fab-hidden');
|
||||
else if (y < lastY - 4) applyFab.classList.remove('fab-hidden');
|
||||
lastY = y;
|
||||
// 顶栏标题: 当前页标题中心移出视口顶部时固定在顶栏
|
||||
if (view === views[currentIndex] && pageTitleEls[i]) {
|
||||
const titleCenter = titleOffsets[i] + pageTitleEls[i].offsetHeight / 2;
|
||||
document.body.classList.toggle('title-scrolled', y > titleCenter);
|
||||
}
|
||||
},
|
||||
{ passive: true },
|
||||
);
|
||||
});
|
||||
|
||||
navBar?.addEventListener('navigation-bar-activated', (e: { detail: { activeIndex: number } }) => {
|
||||
showView(e.detail.activeIndex);
|
||||
});
|
||||
|
||||
// 初始加载主页
|
||||
void loadHome();
|
||||
|
||||
// ---------------- 主页交互 ----------------
|
||||
let donateOpen = false;
|
||||
const donateExpand = document.getElementById('donate-expand')!;
|
||||
const donateArrow = document.getElementById('donate-arrow')!;
|
||||
|
||||
document.getElementById('donate-entry')?.addEventListener('click', () => {
|
||||
donateOpen = !donateOpen;
|
||||
donateExpand.hidden = !donateOpen;
|
||||
donateArrow.classList.toggle('expanded', donateOpen);
|
||||
});
|
||||
|
||||
// 支付宝捐献: 必须在 WebUI 外打开 (am start), 否则 alipays 协议无法唤起
|
||||
void document.getElementById('donate-alipay')?.addEventListener('click', () => {
|
||||
void amStart(DONATE_ALIPAY_URI, ALIPAY_PKG);
|
||||
});
|
||||
|
||||
// 开发者主页: 用系统默认浏览器打开 (am start, 避免在 WebView 内打开)
|
||||
void document.getElementById('dev-entry')?.addEventListener('click', () => {
|
||||
void amStart(DEV_PROFILE_URL);
|
||||
});
|
||||
|
||||
// ---------------- 工具 ----------------
|
||||
const miFontTool = new MiFontTool();
|
||||
document.getElementById('mi-font-tool')?.addEventListener('click', () => miFontTool.open());
|
||||
|
||||
// ---------------- 测试文本编辑 ----------------
|
||||
// 点击可编辑测试卡片 (简体/繁体/英文) 修改测试文本
|
||||
let editTargetId: string | null = null;
|
||||
const editDialog = document.getElementById('edit-text-dialog') as any;
|
||||
const editInput = document.getElementById('edit-text-input') as any;
|
||||
|
||||
document.querySelectorAll<HTMLElement>('.test-card-editable').forEach((card) => {
|
||||
card.addEventListener('click', () => {
|
||||
const targetId = card.dataset.editTarget;
|
||||
if (!targetId) return;
|
||||
const target = document.getElementById(targetId);
|
||||
if (!target) return;
|
||||
editTargetId = targetId;
|
||||
editInput.value = target.textContent ?? '';
|
||||
if (editDialog) editDialog.open = true;
|
||||
});
|
||||
});
|
||||
|
||||
document.getElementById('edit-text-cancel')?.addEventListener('click', () => {
|
||||
if (editDialog) editDialog.open = false;
|
||||
});
|
||||
document.getElementById('edit-text-save')?.addEventListener('click', () => {
|
||||
if (editDialog) editDialog.open = false;
|
||||
if (!editTargetId) return;
|
||||
const target = document.getElementById(editTargetId);
|
||||
if (target) target.textContent = editInput.value;
|
||||
});
|
||||
|
||||
// ---------------- 重启设备 (二次确认) ----------------
|
||||
const rebootDialog = document.getElementById('reboot-dialog') as any;
|
||||
document.getElementById('reboot-btn')?.addEventListener('click', () => {
|
||||
if (rebootDialog) rebootDialog.open = true;
|
||||
});
|
||||
document.getElementById('reboot-cancel')?.addEventListener('click', () => {
|
||||
if (rebootDialog) rebootDialog.open = false;
|
||||
});
|
||||
document.getElementById('reboot-confirm')?.addEventListener('click', () => {
|
||||
if (rebootDialog) rebootDialog.open = false;
|
||||
// dev 模式由 mockExec 模拟输出; 真机立即重启
|
||||
void exec('sync; reboot');
|
||||
});
|
||||
|
||||
// ---------------- 主页 ----------------
|
||||
interface ModuleProp {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
// 解析 module.prop 风格文本 (key=value 每行一个)
|
||||
function parseProp(text: string): ModuleProp {
|
||||
const out: ModuleProp = {};
|
||||
for (const line of text.split('\n')) {
|
||||
const idx = line.indexOf('=');
|
||||
if (idx > 0) {
|
||||
const key = line.slice(0, idx).trim();
|
||||
if (key) out[key] = line.slice(idx + 1).trim();
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// ---------------- 主页 ----------------
|
||||
// 捐献 (支付宝) 与开发者主页 (浏览器) 链接
|
||||
const DONATE_ALIPAY_URI =
|
||||
'alipays://platformapi/startapp?saId=10000007&qrcode=https://qr.alipay.com/2m615805eflrafv8ipc2p15';
|
||||
const ALIPAY_PKG = 'com.eg.android.AlipayGphone';
|
||||
const DEV_PROFILE_URL = 'https://github.com/YuleBest';
|
||||
|
||||
// 渲染主页: 模块状态 + 设备信息
|
||||
async function loadHome(): Promise<void> {
|
||||
// 模块信息 (module.prop)
|
||||
let prop: ModuleProp = {};
|
||||
try {
|
||||
prop = { ...prop, ...parseProp(moduleInfo()) };
|
||||
} catch {
|
||||
// dev 或 API 不可用时忽略, 走下方兜底
|
||||
}
|
||||
try {
|
||||
const { errno, stdout } = await exec('cat /data/adb/modules/FontMM/module.prop');
|
||||
if (errno === 0) prop = { ...prop, ...parseProp(stdout) };
|
||||
} catch {
|
||||
// 忽略读取失败
|
||||
}
|
||||
|
||||
// 挂载状态与设备信息
|
||||
const sys = await getSystemInfo();
|
||||
const mounted = sys.fontCount > 0;
|
||||
|
||||
const set = (id: string, value: string) => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.textContent = value;
|
||||
};
|
||||
set('home-status', mounted ? '已挂载字体' : '未挂载字体');
|
||||
set('home-version', prop.version || '未知');
|
||||
set('home-android-version', sys.androidVersion || '未知');
|
||||
set('home-device-model', sys.deviceModel || '未知');
|
||||
set('home-abi', sys.abi || '未知');
|
||||
set('home-font-count', `${sys.fontCount} 个`);
|
||||
|
||||
// 元模块: /data/adb/metamodule 是符号链接, cat 可直接读取其 module.prop 的 name
|
||||
try {
|
||||
const { errno, stdout } = await exec('cat /data/adb/metamodule/module.prop');
|
||||
if (errno === 0 && stdout.trim()) {
|
||||
set('home-metamodule', parseProp(stdout).name || '未知');
|
||||
} else {
|
||||
set('home-metamodule', '未安装');
|
||||
}
|
||||
} catch {
|
||||
set('home-metamodule', '未安装');
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 字体测试页 ----------------
|
||||
const WEBROOT_DIR = '/data/adb/modules/FontMM/webroot';
|
||||
const TEST_FONT_DIR = `${WEBROOT_DIR}/fonts-test`;
|
||||
|
||||
const testStatusText = document.getElementById('test-status-text')!;
|
||||
const testContent = document.getElementById('test-content')!;
|
||||
|
||||
type TestSlot = 'hans' | 'hant' | 'en';
|
||||
|
||||
const TEST_FONTS: { slot: TestSlot; file: string; family: string }[] = [
|
||||
{ slot: 'hans', file: 'hans.ttf', family: 'FontMM-Hans' },
|
||||
{ slot: 'hant', file: 'hant.ttf', family: 'FontMM-Hant' },
|
||||
{ slot: 'en', file: 'en.ttf', family: 'FontMM-En' },
|
||||
];
|
||||
|
||||
async function registerFont(family: string, file: string): Promise<boolean> {
|
||||
try {
|
||||
// 声明完整字重范围: 否则 FontFace 默认只覆盖 weight 400,
|
||||
// CSS font-weight 100-900 将无法匹配到该字体 (真机表现: 100-400 无变化)
|
||||
const font = new FontFace(family, `url('fonts-test/${file}')`, { weight: '100 900' });
|
||||
await font.load();
|
||||
document.fonts.add(font);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 复制 FONT/ 到 webroot/fonts-test, 供页面加载与名称解析
|
||||
// (WebView 无法直接访问模块外部目录, 符号链接在真机也不可靠, 直接复制)
|
||||
async function ensureFontsCopy(): Promise<string[]> {
|
||||
const copyCmd = [
|
||||
`rm -rf '${TEST_FONT_DIR}'`,
|
||||
`mkdir -p '${TEST_FONT_DIR}'`,
|
||||
`cp -f '${FONTS_DIR}'/*.ttf '${TEST_FONT_DIR}'/ 2>/dev/null`,
|
||||
].join('\n');
|
||||
try {
|
||||
const { errno } = await exec(copyCmd);
|
||||
if (errno !== 0) return [];
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
return listFontsDir();
|
||||
}
|
||||
|
||||
// 列出 fonts-test/ 下的字体文件 (每行一个完整路径)
|
||||
async function listFontsDir(): Promise<string[]> {
|
||||
try {
|
||||
const { errno, stdout } = await exec(`find '${TEST_FONT_DIR}' -maxdepth 1 -mindepth 1 -type f`);
|
||||
if (errno !== 0) return [];
|
||||
return stdout
|
||||
.split('\n')
|
||||
.map((s) => s.trim())
|
||||
.filter(Boolean)
|
||||
.map((p) => p.slice(p.lastIndexOf('/') + 1));
|
||||
} catch {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// 测试页字体只加载一次 (进入时), 应用新字体后重置, 避免每次进入重复加载
|
||||
let testLoaded = false;
|
||||
|
||||
async function loadTestFonts(): Promise<void> {
|
||||
if (testLoaded) return;
|
||||
testContent.hidden = true;
|
||||
testStatusText.textContent = '正在加载字体...';
|
||||
|
||||
// 字体已在 WebUI 打开时复制到 fonts-test, 此处直接读取
|
||||
const available = await listFontsDir();
|
||||
|
||||
// 注册字体, 记录每个槽位是否加载成功
|
||||
const loaded = new Map<TestSlot, boolean>();
|
||||
for (const tf of TEST_FONTS) {
|
||||
loaded.set(
|
||||
tf.slot,
|
||||
available.includes(tf.file) ? await registerFont(tf.family, tf.file) : false,
|
||||
);
|
||||
}
|
||||
|
||||
// fallback 逻辑: hant/en 缺失回退 hans
|
||||
const hans = loaded.get('hans') ? 'FontMM-Hans' : 'sans-serif';
|
||||
const hant = loaded.get('hant') ? 'FontMM-Hant' : hans;
|
||||
const en = loaded.get('en') ? 'FontMM-En' : hans;
|
||||
|
||||
// 显示字体名称 (解析出的 family name; 未解析到时为文件名)
|
||||
const slotLabel = (key: TestSlot): string => slots[key].fileName;
|
||||
const hasFont = (key: TestSlot): boolean => available.includes(`${key}.ttf`);
|
||||
const hansLabel = hasFont('hans') ? slotLabel('hans') : null;
|
||||
|
||||
const setTag = (id: string, text: string) => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.textContent = text;
|
||||
};
|
||||
setTag('hans-tag', hasFont('hans') ? slotLabel('hans') : '未设置, 使用系统字体');
|
||||
setTag(
|
||||
'hant-tag',
|
||||
hasFont('hant') ? slotLabel('hant') : hansLabel ? `回退 ${hansLabel}` : '未设置, 使用系统字体',
|
||||
);
|
||||
setTag(
|
||||
'en-tag',
|
||||
hasFont('en') ? slotLabel('en') : hansLabel ? `回退 ${hansLabel}` : '未设置, 使用系统字体',
|
||||
);
|
||||
setTag('weight-tag', `使用 ${hansLabel ?? '系统字体'}`);
|
||||
setTag('var-tag', `使用 ${hansLabel ?? '系统字体'}`);
|
||||
|
||||
const setFamily = (id: string, family: string, fallback: string) => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.style.fontFamily = `'${family}', ${fallback}`;
|
||||
};
|
||||
setFamily('test-hans', hans, 'sans-serif');
|
||||
setFamily('test-hant', hant, `'${hans}', sans-serif`);
|
||||
setFamily('test-en', en, `'${hans}', sans-serif`);
|
||||
// 字重 / 可变字体测试: 用完整 fallback 链渲染 (Hans → Hant → En 按用户选择顺序,
|
||||
// 浏览器逐字形回退, 所见即所得地体现系统真实 fallback)
|
||||
const fallbackChain = [...new Set([hans, hant, en])].map((f) => `'${f}'`).join(', ');
|
||||
const fullChain = `${fallbackChain}, sans-serif`;
|
||||
document.querySelectorAll<HTMLElement>('.test-w-text').forEach((el) => {
|
||||
el.style.fontFamily = fullChain;
|
||||
});
|
||||
const vp = document.getElementById('test-var-preview');
|
||||
if (vp) vp.style.fontFamily = fullChain;
|
||||
applyWght(400); // 与滑条初始值保持一致
|
||||
|
||||
testStatusText.textContent =
|
||||
available.length === 0
|
||||
? '未找到已设置的字体 (FONTS 为空), 当前使用系统字体预览'
|
||||
: '字体已加载, 下方为预览效果 (按 fallback 逻辑)';
|
||||
testContent.hidden = false;
|
||||
testLoaded = true;
|
||||
}
|
||||
|
||||
// 可变字体滑动条: 滑动中只更新数值显示, 停止 250ms 后才应用字重 (省性能)
|
||||
const wghtSlider = document.getElementById('wght-slider') as any;
|
||||
const wghtValue = document.getElementById('wght-value')!;
|
||||
const varPreview = document.getElementById('test-var-preview') as HTMLElement | null;
|
||||
|
||||
let wghtTimer: number | undefined;
|
||||
function applyWght(weight: number) {
|
||||
if (varPreview) varPreview.style.fontVariationSettings = `'wght' ${weight}`;
|
||||
}
|
||||
|
||||
// 字重档位名称 (与字重测试区一致)
|
||||
const WEIGHT_NAMES: Record<number, string> = {
|
||||
100: '淡体 Thin',
|
||||
200: '特细 ExtraLight',
|
||||
300: '细体 Light',
|
||||
400: '标准 Regular',
|
||||
500: '适中 Medium',
|
||||
600: '次粗 SemiBold',
|
||||
700: '粗体 Bold',
|
||||
800: '特粗 ExtraBold',
|
||||
900: '浓体 Black',
|
||||
};
|
||||
|
||||
function updateVarPreview(weight: number) {
|
||||
if (!varPreview) return;
|
||||
const key = Math.round(weight / 100) * 100;
|
||||
const name = WEIGHT_NAMES[key] ?? String(weight);
|
||||
varPreview.textContent = `${weight} - ${name}`;
|
||||
}
|
||||
|
||||
wghtSlider?.addEventListener('input', (e: Event) => {
|
||||
const value = Number((e.target as any).value);
|
||||
wghtValue.textContent = String(value);
|
||||
updateVarPreview(value);
|
||||
window.clearTimeout(wghtTimer);
|
||||
wghtTimer = window.setTimeout(() => applyWght(value), 250);
|
||||
});
|
||||
// 松手时立即应用最终值, 避免防抖延迟
|
||||
wghtSlider?.addEventListener('change', (e: Event) => {
|
||||
const value = Number((e.target as any).value);
|
||||
wghtValue.textContent = String(value);
|
||||
updateVarPreview(value);
|
||||
applyWght(value);
|
||||
});
|
||||
|
||||
// 字号滑条: 直接应用 (12-40px), 设置 style 开销小无需防抖
|
||||
const sizeSlider = document.getElementById('size-slider') as any;
|
||||
const sizeValue = document.getElementById('size-value')!;
|
||||
sizeSlider?.addEventListener('input', (e: Event) => {
|
||||
const value = Number((e.target as any).value);
|
||||
sizeValue.textContent = String(value);
|
||||
if (varPreview) varPreview.style.fontSize = `${value}px`;
|
||||
});
|
||||
|
||||
// 打开 WebUI 时读取 FONT/ 已有字体并填充卡片 (置于文件末尾, 确保常量均已初始化)
|
||||
void loadExistingFonts();
|
||||
@@ -0,0 +1,889 @@
|
||||
@use './theme.scss';
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
// vh 兜底 + dvh 增强 (dvh 不支持的旧 WebView 回退 vh)
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
// 视口 pager: 顶栏 / 轨道 / 底栏垂直排布, 页面高度固定由布局决定
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
background-color: var(--md-sys-color-background);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system,
|
||||
sans-serif;
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
// ---------------- 1. Top App Bar ----------------
|
||||
.top-app-bar {
|
||||
flex-shrink: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: calc(64px + var(--top-inset, 0px));
|
||||
padding: var(--top-inset, 0px) 24px 0 24px;
|
||||
// 无边框无背景: 顶栏直接融入页面 (与内容区同底色)
|
||||
background-color: transparent;
|
||||
|
||||
.top-app-bar__title {
|
||||
// 默认隐藏: 页面标题在内容区, 滚动移出屏幕后固定在顶栏左侧
|
||||
opacity: 0;
|
||||
transform: translateY(3px);
|
||||
transition:
|
||||
opacity var(--md-duration-standard) var(--md-easing-standard),
|
||||
transform var(--md-duration-standard) var(--md-easing-standard);
|
||||
font-size: var(--md-sys-typescale-title-large-size);
|
||||
font-weight: var(--md-sys-typescale-title-large-weight);
|
||||
line-height: var(--md-sys-typescale-title-large-line-height);
|
||||
letter-spacing: var(--md-sys-typescale-title-large-tracking);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
// 标题滚动到顶栏后: 顶栏出现标题与同底色背景 (遮住下方滚过的内容)
|
||||
transition: background-color var(--md-duration-standard) var(--md-easing-standard);
|
||||
background-color: transparent;
|
||||
|
||||
.top-app-bar__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
// 标题移出屏幕后: 顶栏显示标题与背景
|
||||
body.title-scrolled {
|
||||
.top-app-bar {
|
||||
background-color: var(--md-sys-color-background);
|
||||
}
|
||||
|
||||
.top-app-bar__title {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 2. 视口 pager ----------------
|
||||
// 三页横排轨道: 轨道高度由布局固定 (视口 - 顶栏), 与页面内容多少无关,
|
||||
// 不存在内容少的页面底部出现空白的问题
|
||||
.view-track {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
// 不在此裁剪: transform + overflow:hidden 组合在 Chromium 存在命中测试 bug
|
||||
// (平移后子页内容不绘制)。横向越界由 body 的 overflow:hidden 统一裁剪。
|
||||
transition: transform var(--md-duration-emphasized) var(--md-easing-emphasized);
|
||||
}
|
||||
|
||||
// 每个视图: 占满轨道一屏宽度, 内部独立滚动
|
||||
.view {
|
||||
flex: 0 0 100%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
// 每页独立合成层, 避免轨道整体合成时子滚动容器渲染异常
|
||||
will-change: transform;
|
||||
overflow-y: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
// 大屏 (>600px) 内容居中, 小屏保持全宽
|
||||
padding: 16px max(16px, calc((100% - 600px) / 2 + 16px)) calc(var(--bottom-inset, 0px) + 96px)
|
||||
max(16px, calc((100% - 600px) / 2 + 16px));
|
||||
}
|
||||
|
||||
// 配置页有悬浮应用按钮, 底部需额外避让 FAB
|
||||
.view-config {
|
||||
padding-bottom: calc(var(--bottom-inset, 0px) + 176px);
|
||||
}
|
||||
|
||||
#slots {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
// 显式 stretch: 某些环境下 flex 的 align-items:normal 不会拉伸子项, 导致卡片宽度收缩成梯级
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
// ---------------- 3. 配置页槽位卡片 ----------------
|
||||
// M3 filled card: 无阴影无边框 (设置项列表层级), 选中态用 tonal 容器色
|
||||
md-filled-card.slot-card {
|
||||
display: block;
|
||||
padding: 16px;
|
||||
overflow: hidden;
|
||||
--md-filled-card-container-color: var(--md-sys-color-surface-container-low);
|
||||
--md-filled-card-container-shape: var(--md-shape-corner-large);
|
||||
|
||||
// 已选择状态: tonal 高亮 (primary-container), M3 标准选中反馈
|
||||
&.selected {
|
||||
--md-filled-card-container-color: var(--md-sys-color-primary-container);
|
||||
}
|
||||
|
||||
// 整卡可点击选择
|
||||
cursor: pointer;
|
||||
|
||||
.slot-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
|
||||
.slot-title-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.slot-title {
|
||||
font-size: var(--md-sys-typescale-title-medium-size);
|
||||
font-weight: var(--md-sys-typescale-title-medium-weight);
|
||||
line-height: var(--md-sys-typescale-title-medium-line-height);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
// 右侧导航箭头
|
||||
.slot-arrow {
|
||||
flex-shrink: 0;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
// 取消 Card-in-Card: 文件名区域直接作为卡片内容, 不再嵌套浅色容器
|
||||
.slot-file {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
min-width: 0;
|
||||
|
||||
// 清除按钮位于字体名称左侧
|
||||
.slot-clear {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.slot-file-text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
.slot-name {
|
||||
font-size: var(--md-sys-typescale-title-medium-size);
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
||||
&.placeholder {
|
||||
font-weight: 400;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
opacity: 0.75; // 半透明: 直观表达"回退/继承"状态
|
||||
}
|
||||
|
||||
// 简体必选提醒: 强调色
|
||||
&.required {
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-tertiary);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
// 徽标组: 每个信息 (大小 / 扩展名) 一个独立胶囊徽标
|
||||
.slot-meta {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
margin-top: 4px;
|
||||
|
||||
.slot-meta-badge {
|
||||
display: inline-block;
|
||||
padding: 2px 10px;
|
||||
border-radius: var(--md-shape-corner-full);
|
||||
// highest 避免与选中卡片背景 (high) 同色融合
|
||||
background-color: var(--md-sys-color-surface-container-highest);
|
||||
font-size: var(--md-sys-typescale-label-small-size);
|
||||
font-weight: var(--md-sys-typescale-label-small-weight);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
|
||||
// 可变字体徽标: 实色主题色, 与选中卡片背景 (primary-container) 区分
|
||||
&.slot-meta-badge--variable {
|
||||
background-color: var(--md-sys-color-primary);
|
||||
color: var(--md-sys-color-on-primary);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 4. 悬浮应用按钮 (Extended FAB) ----------------
|
||||
.fab {
|
||||
position: fixed;
|
||||
right: 16px;
|
||||
bottom: calc(var(--bottom-inset, 0px) + 96px); // 位于底部导航栏上方
|
||||
z-index: 9;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
height: 56px;
|
||||
padding: 0 20px;
|
||||
border: none;
|
||||
border-radius: var(--md-shape-corner-large);
|
||||
background-color: var(--md-sys-color-primary-container);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
box-shadow:
|
||||
0 2px 6px rgba(0, 0, 0, 0.25),
|
||||
0 6px 12px rgba(0, 0, 0, 0.2);
|
||||
font-size: var(--md-sys-typescale-label-large-size);
|
||||
font-weight: var(--md-sys-typescale-label-large-weight);
|
||||
cursor: pointer;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
transition:
|
||||
transform var(--md-duration-standard) var(--md-easing-standard),
|
||||
opacity var(--md-duration-standard) var(--md-easing-standard),
|
||||
box-shadow var(--md-duration-standard) var(--md-easing-standard);
|
||||
|
||||
// 向下滚动时移出视口
|
||||
&.fab-hidden {
|
||||
transform: translateY(calc(100% + 24px));
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
// 应用进行中短暂禁用: 保持不透明外观, 仅禁止点击
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
&:not(:disabled):active {
|
||||
box-shadow:
|
||||
0 1px 3px rgba(0, 0, 0, 0.3),
|
||||
0 3px 6px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 5. 底部导航栏 ----------------
|
||||
.bottom-nav {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
z-index: 11;
|
||||
background-color: var(--md-sys-color-surface-container);
|
||||
border-top: 1px solid var(--md-sys-color-outline-variant);
|
||||
padding-bottom: var(--bottom-inset, 0px);
|
||||
|
||||
md-navigation-bar {
|
||||
width: 100%;
|
||||
height: 80px;
|
||||
--md-navigation-bar-container-color: var(--md-sys-color-surface-container);
|
||||
// 去掉底栏阴影, 与页面融为一体
|
||||
--md-navigation-bar-container-elevation: 0;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 6. 对话框 ----------------
|
||||
md-dialog {
|
||||
--md-dialog-container-shape: var(--md-shape-corner-extra-large);
|
||||
}
|
||||
|
||||
// ---------------- 7. 通用信息卡片 (测试页) ----------------
|
||||
.test-card {
|
||||
display: block;
|
||||
padding: 20px;
|
||||
// 无阴影 (elevation 0)
|
||||
--md-elevated-card-container-elevation: 0;
|
||||
--md-elevated-card-container-color: var(--md-sys-color-surface-container-low);
|
||||
--md-elevated-card-container-shape: var(--md-shape-corner-large);
|
||||
}
|
||||
|
||||
// ---------------- 8. 主页视图 ----------------
|
||||
// 模块标题: 大字号 + 下方留白 (呼吸感)
|
||||
.home-title {
|
||||
margin: 4px 4px 28px 4px;
|
||||
font-size: var(--md-sys-typescale-title-large-size);
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.01em;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.home-card {
|
||||
display: block;
|
||||
margin-bottom: 16px;
|
||||
overflow: hidden;
|
||||
--md-elevated-card-container-color: var(--md-sys-color-surface-container-low);
|
||||
--md-elevated-card-container-shape: var(--md-shape-corner-large);
|
||||
--md-elevated-card-container-elevation: 1;
|
||||
}
|
||||
|
||||
// 模块状态卡: 左对钩圆形图标 + 居左标题/副标题, 主题色容器背景
|
||||
// (md-elevated-card 内部 :host 默认 flex-direction: column, 必须显式覆盖为 row)
|
||||
.home-status-card {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 20px;
|
||||
// 与下方入口卡之间留出更大间距
|
||||
margin-bottom: 24px;
|
||||
--md-elevated-card-container-color: var(--md-sys-color-primary-container);
|
||||
|
||||
// 40px 透明占位容器: 与入口卡图标容器同宽, 保证图标/文本横向对齐
|
||||
.home-status-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
flex-shrink: 0;
|
||||
|
||||
md-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: var(--md-shape-corner-full);
|
||||
background-color: var(--md-sys-color-primary);
|
||||
color: var(--md-sys-color-on-primary);
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.home-status-text {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.home-status-title {
|
||||
font-size: var(--md-sys-typescale-title-medium-size);
|
||||
font-weight: var(--md-sys-typescale-title-medium-weight);
|
||||
line-height: var(--md-sys-typescale-title-medium-line-height);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
}
|
||||
|
||||
.home-status-sub {
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-on-primary-container);
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
|
||||
// 入口卡 (请我喝咖啡 / 开发者)
|
||||
.home-entry-card {
|
||||
// 捐献卡与开发者卡之间间距收紧
|
||||
&#donate-card {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.home-entry-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
padding: 16px 20px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.home-entry-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
flex-shrink: 0;
|
||||
color: var(--md-sys-color-primary);
|
||||
|
||||
md-icon {
|
||||
font-size: 24px;
|
||||
}
|
||||
}
|
||||
|
||||
.home-entry-text {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.home-entry-title {
|
||||
font-size: var(--md-sys-typescale-title-medium-size);
|
||||
font-weight: var(--md-sys-typescale-title-medium-weight);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.home-entry-sub {
|
||||
margin-top: 2px;
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.home-entry-arrow {
|
||||
flex-shrink: 0;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
transition: transform var(--md-duration-standard) var(--md-easing-standard);
|
||||
|
||||
&.expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
}
|
||||
|
||||
// 捐献展开子列表
|
||||
.home-entry-expand {
|
||||
animation: home-expand var(--md-duration-emphasized) var(--md-easing-emphasized-decelerate);
|
||||
|
||||
// 捐献说明文字 (缩进与图标/文本对齐)
|
||||
.home-donate-note {
|
||||
padding: 0 20px 10px calc(20px + 40px + 16px);
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.home-donate-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
padding: 12px 20px 18px calc(20px + 40px + 16px);
|
||||
border: none;
|
||||
background: transparent;
|
||||
cursor: pointer;
|
||||
font-family: inherit;
|
||||
|
||||
.home-donate-logo {
|
||||
font-size: var(--md-sys-typescale-label-large-size);
|
||||
font-weight: var(--md-sys-typescale-label-large-weight);
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.home-donate-name {
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes home-expand {
|
||||
from {
|
||||
opacity: 0;
|
||||
transform: translateY(-6px);
|
||||
}
|
||||
|
||||
to {
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
}
|
||||
}
|
||||
|
||||
// 设备信息卡
|
||||
.home-info-card {
|
||||
padding: 20px;
|
||||
|
||||
.home-info-title {
|
||||
margin-bottom: 8px;
|
||||
font-size: var(--md-sys-typescale-title-medium-size);
|
||||
font-weight: var(--md-sys-typescale-title-medium-weight);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
// 双行信息块: 上行小字标题(灰), 下行大字信息
|
||||
.home-info-row {
|
||||
padding: 10px 0;
|
||||
|
||||
.home-info-label {
|
||||
font-size: var(--md-sys-typescale-label-medium-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.home-info-value {
|
||||
margin-top: 2px;
|
||||
font-size: var(--md-sys-typescale-title-medium-size);
|
||||
font-weight: var(--md-sys-typescale-title-medium-weight);
|
||||
line-height: var(--md-sys-typescale-title-medium-line-height);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 测试状态提示 (info 卡片)
|
||||
.test-status-card {
|
||||
display: flex;
|
||||
flex-direction: row; // 覆盖 md-elevated-card 内部默认 column
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 14px 16px;
|
||||
margin-bottom: 16px;
|
||||
--md-elevated-card-container-color: var(--md-sys-color-secondary-container);
|
||||
--md-elevated-card-container-shape: var(--md-shape-corner-large);
|
||||
|
||||
.test-status-icon {
|
||||
display: flex;
|
||||
flex-shrink: 0;
|
||||
color: var(--md-sys-color-on-secondary-container);
|
||||
|
||||
md-icon {
|
||||
font-size: 20px;
|
||||
}
|
||||
}
|
||||
|
||||
.test-status-text {
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
color: var(--md-sys-color-on-secondary-container);
|
||||
}
|
||||
}
|
||||
|
||||
// 可编辑测试文本: 虚线框 + 点击提示 (点击卡片打开编辑对话框)
|
||||
.test-card-editable {
|
||||
cursor: pointer;
|
||||
|
||||
.test-sample,
|
||||
.test-var-preview {
|
||||
outline: 1px dashed var(--md-sys-color-outline-variant);
|
||||
outline-offset: 4px;
|
||||
border-radius: var(--md-shape-corner-small);
|
||||
padding: 8px;
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 9. 字体测试视图 ----------------
|
||||
// 工具页: 返回栏 (工具详情页)
|
||||
.view-topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-bottom: 8px;
|
||||
|
||||
.view-topbar-title {
|
||||
font-size: var(--md-sys-typescale-title-medium-size);
|
||||
font-weight: var(--md-sys-typescale-title-medium-weight);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
}
|
||||
|
||||
// 工具页: 小米主题字体下载
|
||||
.tool-page {
|
||||
.mi-search-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.mi-result {
|
||||
min-height: 120px;
|
||||
|
||||
.mi-status {
|
||||
padding: 24px 8px;
|
||||
text-align: center;
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
|
||||
&.mi-status-error {
|
||||
color: var(--md-sys-color-error);
|
||||
}
|
||||
|
||||
&.mi-status-done {
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.mi-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.mi-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--md-shape-corner-medium);
|
||||
background-color: var(--md-sys-color-surface-container-low);
|
||||
|
||||
.mi-item-pic {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
flex-shrink: 0;
|
||||
border-radius: var(--md-shape-corner-small);
|
||||
object-fit: cover;
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
}
|
||||
|
||||
.mi-item-title {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
word-break: break-all;
|
||||
}
|
||||
}
|
||||
|
||||
.mi-pager {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 16px;
|
||||
margin-top: 16px;
|
||||
|
||||
.mi-page {
|
||||
font-size: var(--md-sys-typescale-label-medium-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
}
|
||||
|
||||
// 下载日志 (等宽字体)
|
||||
.mi-log {
|
||||
margin: 0;
|
||||
padding: 12px;
|
||||
border-radius: var(--md-shape-corner-medium);
|
||||
background-color: var(--md-sys-color-surface-container-low);
|
||||
font-family: 'Roboto Mono', ui-monospace, monospace;
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
line-height: 1.6;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
// 下载进度条 (M3 风格)
|
||||
.mi-progress {
|
||||
padding: 24px 8px;
|
||||
|
||||
.mi-progress-track {
|
||||
width: 100%;
|
||||
height: 4px;
|
||||
border-radius: var(--md-shape-corner-full);
|
||||
background-color: var(--md-sys-color-surface-container-high);
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.mi-progress-bar {
|
||||
height: 100%;
|
||||
border-radius: var(--md-shape-corner-full);
|
||||
background-color: var(--md-sys-color-primary);
|
||||
transition: width var(--md-duration-standard) var(--md-easing-standard);
|
||||
}
|
||||
|
||||
.mi-progress-text {
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
.view-test {
|
||||
gap: 16px;
|
||||
|
||||
&.active {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.test-status {
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.test-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.test-section-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 12px;
|
||||
font-size: var(--md-sys-typescale-title-small-size);
|
||||
font-weight: var(--md-sys-typescale-title-small-weight);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.test-tag {
|
||||
padding: 1px 8px;
|
||||
border-radius: var(--md-shape-corner-extra-small);
|
||||
background: var(--md-sys-color-secondary-container);
|
||||
color: var(--md-sys-color-on-secondary-container);
|
||||
font-size: var(--md-sys-typescale-label-small-size);
|
||||
font-weight: var(--md-sys-typescale-label-small-weight);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.test-sample {
|
||||
font-size: var(--md-sys-typescale-body-large-size);
|
||||
line-height: 1.7;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
|
||||
.test-var-note {
|
||||
margin-bottom: 10px;
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-outline);
|
||||
}
|
||||
|
||||
.test-w-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 6px 0;
|
||||
|
||||
.test-w-text {
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
}
|
||||
|
||||
.test-wght-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 14px;
|
||||
|
||||
.test-wght-label {
|
||||
flex-shrink: 0;
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
md-slider {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.test-wght-value {
|
||||
flex-shrink: 0;
|
||||
min-width: 3ch;
|
||||
text-align: right;
|
||||
font-size: var(--md-sys-typescale-label-large-size);
|
||||
font-weight: var(--md-sys-typescale-label-large-weight);
|
||||
font-variant-numeric: tabular-nums;
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
}
|
||||
|
||||
.test-var-preview {
|
||||
font-size: var(--md-sys-typescale-body-large-size);
|
||||
line-height: 1.7;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 10. 文件选择器 Dialog ----------------
|
||||
.font-picker-dialog {
|
||||
--md-dialog-container-shape: var(--md-shape-corner-extra-large);
|
||||
--md-dialog-container-color: var(--md-sys-color-surface);
|
||||
max-width: 560px;
|
||||
width: 90vw;
|
||||
|
||||
&::part(headline) {
|
||||
padding: 20px 24px 12px 24px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.picker-header {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
text-align: left;
|
||||
|
||||
.picker-title-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
width: 100%;
|
||||
|
||||
.picker-back {
|
||||
margin-left: -8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.picker-path-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
text-align: left;
|
||||
min-width: 0;
|
||||
flex: 1;
|
||||
|
||||
.picker-subtitle {
|
||||
font-size: var(--md-sys-typescale-label-medium-size);
|
||||
color: var(--md-sys-color-primary);
|
||||
font-weight: var(--md-sys-typescale-label-medium-weight);
|
||||
}
|
||||
|
||||
.picker-path-text {
|
||||
width: 100%;
|
||||
font-size: var(--md-sys-typescale-title-medium-size);
|
||||
font-weight: 700;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
// 长路径换行完整显示, 不截断成省略号
|
||||
white-space: normal;
|
||||
word-break: break-all;
|
||||
line-height: 1.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.picker-content {
|
||||
padding: 8px 0;
|
||||
max-height: 50vh;
|
||||
overflow-y: auto;
|
||||
|
||||
.picker-list {
|
||||
background: transparent;
|
||||
padding: 0;
|
||||
|
||||
.picker-item {
|
||||
border-radius: var(--md-shape-corner-medium);
|
||||
margin-bottom: 4px;
|
||||
cursor: pointer;
|
||||
|
||||
.item-icon {
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
&.is-file .item-icon {
|
||||
color: var(--md-sys-color-tertiary);
|
||||
}
|
||||
|
||||
.item-name {
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
font-weight: 500;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.picker-empty,
|
||||
.picker-loading,
|
||||
.picker-error {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 32px 16px;
|
||||
gap: 8px;
|
||||
color: var(--md-sys-color-outline);
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
@import url('https://mui.kernelsu.org/internal/insets.css');
|
||||
@import url('https://mui.kernelsu.org/internal/colors.css');
|
||||
|
||||
:root {
|
||||
--top-inset: var(--window-inset-top, 0px);
|
||||
--bottom-inset: var(--window-inset-bottom, 0px);
|
||||
|
||||
--md-focus-ring-color: transparent;
|
||||
|
||||
// ============ MD3 形状 tokens ============
|
||||
--md-shape-corner-none: 0px;
|
||||
--md-shape-corner-extra-small: 4px;
|
||||
--md-shape-corner-small: 8px;
|
||||
--md-shape-corner-medium: 16px;
|
||||
--md-shape-corner-large: 20px;
|
||||
--md-shape-corner-extra-large: 32px;
|
||||
--md-shape-corner-full: 9999px;
|
||||
|
||||
// ============ MD3 动效 tokens ============
|
||||
--md-duration-standard: 300ms;
|
||||
--md-duration-standard-decelerate: 250ms;
|
||||
--md-duration-standard-accelerate: 200ms;
|
||||
--md-duration-emphasized: 500ms;
|
||||
--md-easing-standard: cubic-bezier(0.2, 0, 0, 1);
|
||||
--md-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
|
||||
--md-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
|
||||
--md-easing-emphasized-accelerate: cubic-bezier(0.3, 0, 0.8, 0.15);
|
||||
|
||||
// ============ MD3 字阶 tokens ============
|
||||
--md-sys-typescale-title-large-size: 1.375rem; // 22sp
|
||||
--md-sys-typescale-title-large-weight: 400;
|
||||
--md-sys-typescale-title-large-line-height: 1.75rem; // 28sp
|
||||
--md-sys-typescale-title-large-tracking: 0em;
|
||||
|
||||
--md-sys-typescale-title-medium-size: 1rem; // 16sp
|
||||
--md-sys-typescale-title-medium-weight: 500;
|
||||
--md-sys-typescale-title-medium-line-height: 1.5rem; // 24sp
|
||||
--md-sys-typescale-title-medium-tracking: 0.0094em;
|
||||
|
||||
--md-sys-typescale-title-small-size: 0.875rem; // 14sp
|
||||
--md-sys-typescale-title-small-weight: 500;
|
||||
--md-sys-typescale-title-small-line-height: 1.25rem; // 20sp
|
||||
--md-sys-typescale-title-small-tracking: 0.0063em;
|
||||
|
||||
--md-sys-typescale-body-large-size: 1rem; // 16sp
|
||||
--md-sys-typescale-body-large-weight: 400;
|
||||
--md-sys-typescale-body-large-line-height: 1.5rem; // 24sp
|
||||
--md-sys-typescale-body-large-tracking: 0.0313em;
|
||||
|
||||
--md-sys-typescale-body-medium-size: 0.875rem; // 14sp
|
||||
--md-sys-typescale-body-medium-weight: 400;
|
||||
--md-sys-typescale-body-medium-line-height: 1.25rem; // 20sp
|
||||
--md-sys-typescale-body-medium-tracking: 0.0156em;
|
||||
|
||||
--md-sys-typescale-body-small-size: 0.75rem; // 12sp
|
||||
--md-sys-typescale-body-small-weight: 400;
|
||||
--md-sys-typescale-body-small-line-height: 1rem; // 16sp
|
||||
--md-sys-typescale-body-small-tracking: 0.025em;
|
||||
|
||||
--md-sys-typescale-label-large-size: 0.875rem; // 14sp
|
||||
--md-sys-typescale-label-large-weight: 500;
|
||||
--md-sys-typescale-label-large-line-height: 1.25rem; // 20sp
|
||||
--md-sys-typescale-label-large-tracking: 0.0063em;
|
||||
|
||||
--md-sys-typescale-label-medium-size: 0.75rem; // 12sp
|
||||
--md-sys-typescale-label-medium-weight: 500;
|
||||
--md-sys-typescale-label-medium-line-height: 1rem; // 16sp
|
||||
--md-sys-typescale-label-medium-tracking: 0.0313em;
|
||||
|
||||
--md-sys-typescale-label-small-size: 0.6875rem; // 11sp
|
||||
--md-sys-typescale-label-small-weight: 500;
|
||||
--md-sys-typescale-label-small-line-height: 1rem; // 16sp
|
||||
--md-sys-typescale-label-small-tracking: 0.0313em;
|
||||
|
||||
// ============ MD3 颜色 tokens - Light ============
|
||||
--md-sys-color-primary: var(--primary, #6750a4);
|
||||
--md-sys-color-on-primary: var(--onPrimary, #ffffff);
|
||||
--md-sys-color-primary-container: var(--primaryContainer, #eaddff);
|
||||
--md-sys-color-on-primary-container: var(--onPrimaryContainer, #21005d);
|
||||
|
||||
--md-sys-color-secondary: var(--secondary, #625b71);
|
||||
--md-sys-color-on-secondary: var(--onSecondary, #ffffff);
|
||||
--md-sys-color-secondary-container: var(--secondaryContainer, #e8def8);
|
||||
--md-sys-color-on-secondary-container: var(--onSecondaryContainer, #1d192b);
|
||||
|
||||
--md-sys-color-tertiary: var(--tertiary, #7d5260);
|
||||
--md-sys-color-on-tertiary: var(--onTertiary, #ffffff);
|
||||
--md-sys-color-tertiary-container: var(--tertiaryContainer, #ffd8e4);
|
||||
--md-sys-color-on-tertiary-container: var(--onTertiaryContainer, #31111d);
|
||||
|
||||
--md-sys-color-error: #b3261e;
|
||||
--md-sys-color-on-error: #ffffff;
|
||||
--md-sys-color-error-container: #f9dedc;
|
||||
--md-sys-color-on-error-container: #410e0b;
|
||||
|
||||
--md-sys-color-background: var(--background, #fef7ff);
|
||||
--md-sys-color-on-background: var(--onBackground, #1d1b20);
|
||||
|
||||
--md-sys-color-surface: var(--surface, #fef7ff);
|
||||
--md-sys-color-on-surface: var(--onSurface, #1d1b20);
|
||||
--md-sys-color-surface-variant: var(--surfaceVariant, #e7e0ec);
|
||||
--md-sys-color-on-surface-variant: var(--onSurfaceVariant, #49454f);
|
||||
|
||||
--md-sys-color-surface-dim: #ded8e1;
|
||||
--md-sys-color-surface-bright: #fef7ff;
|
||||
--md-sys-color-surface-container-lowest: #ffffff;
|
||||
--md-sys-color-surface-container-low: var(--surfaceContainerLow, #f7f2fa);
|
||||
--md-sys-color-surface-container: var(--surfaceContainer, #f3edf7);
|
||||
--md-sys-color-surface-container-high: var(--surfaceContainerHigh, #ece6f0);
|
||||
--md-sys-color-surface-container-highest: #e6e0e9;
|
||||
|
||||
--md-sys-color-inverse-surface: #322f35;
|
||||
--md-sys-color-inverse-on-surface: #f5eff7;
|
||||
--md-sys-color-inverse-primary: #d0bcff;
|
||||
|
||||
--md-sys-color-outline: var(--outline, #79747e);
|
||||
--md-sys-color-outline-variant: var(--outlineVariant, #cac4d0);
|
||||
--md-sys-color-shadow: #000000;
|
||||
--md-sys-color-scrim: #000000;
|
||||
}
|
||||
|
||||
// ============ MD3 深色颜色 tokens ============
|
||||
// 跟随 KernelSU 注入的壁纸动态色 (Material You 取色)
|
||||
@mixin dark-tokens {
|
||||
--md-sys-color-primary: var(--primary, #d0bcff);
|
||||
--md-sys-color-on-primary: var(--onPrimary, #381e72);
|
||||
--md-sys-color-primary-container: var(--primaryContainer, #4f378b);
|
||||
--md-sys-color-on-primary-container: var(--onPrimaryContainer, #eaddff);
|
||||
|
||||
--md-sys-color-secondary: var(--secondary, #ccc2dc);
|
||||
--md-sys-color-on-secondary: var(--onSecondary, #332d41);
|
||||
--md-sys-color-secondary-container: var(--secondaryContainer, #4a4458);
|
||||
--md-sys-color-on-secondary-container: var(--onSecondaryContainer, #e8def8);
|
||||
|
||||
--md-sys-color-tertiary: var(--tertiary, #efb8c8);
|
||||
--md-sys-color-on-tertiary: var(--onTertiary, #492532);
|
||||
--md-sys-color-tertiary-container: var(--tertiaryContainer, #633b48);
|
||||
--md-sys-color-on-tertiary-container: var(--onTertiaryContainer, #ffd8e4);
|
||||
|
||||
--md-sys-color-error: #f2b8b5;
|
||||
--md-sys-color-on-error: #601410;
|
||||
--md-sys-color-error-container: #8c1d18;
|
||||
--md-sys-color-on-error-container: #f9dedc;
|
||||
|
||||
--md-sys-color-background: var(--background, #141218);
|
||||
--md-sys-color-on-background: var(--onBackground, #e6e0e9);
|
||||
|
||||
--md-sys-color-surface: var(--surface, #141218);
|
||||
--md-sys-color-on-surface: var(--onSurface, #e6e0e9);
|
||||
--md-sys-color-surface-variant: var(--surfaceVariant, #49454f);
|
||||
--md-sys-color-on-surface-variant: var(--onSurfaceVariant, #cac4d0);
|
||||
|
||||
--md-sys-color-surface-dim: #141218;
|
||||
--md-sys-color-surface-bright: #3b383e;
|
||||
--md-sys-color-surface-container-lowest: #0f0d13;
|
||||
--md-sys-color-surface-container-low: var(--surfaceContainerLow, #1d1b20);
|
||||
--md-sys-color-surface-container: var(--surfaceContainer, #211f26);
|
||||
--md-sys-color-surface-container-high: var(--surfaceContainerHigh, #2b2930);
|
||||
--md-sys-color-surface-container-highest: #36343b;
|
||||
|
||||
--md-sys-color-inverse-surface: #e6e0e9;
|
||||
--md-sys-color-inverse-on-surface: #322f35;
|
||||
--md-sys-color-inverse-primary: #6750a4;
|
||||
|
||||
--md-sys-color-outline: var(--outline, #938f99);
|
||||
--md-sys-color-outline-variant: var(--outlineVariant, #49454f);
|
||||
--md-sys-color-shadow: #000000;
|
||||
--md-sys-color-scrim: #000000;
|
||||
}
|
||||
|
||||
// 跟随系统深浅色
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
@include dark-tokens;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
import '@material/web/button/filled-button.js';
|
||||
import { exec } from './ksu';
|
||||
|
||||
// ---------------- 工具: 下载国际版小米主题字体 (v1.0.0) ----------------
|
||||
// 跨域请求与下载/解压全部由 root shell 完成: 前端调用模块内置脚本
|
||||
// mi-font-download.sh, 脚本输出完整日志, 前端只负责展示。
|
||||
|
||||
const SEARCH_API = 'https://thm.market.intl.xiaomi.com/thm/search/npage?category=Font&keywords=';
|
||||
// 搜索结果的图片路径前缀 (pic 字段为相对路径, 拼接此域名 + 处理参数)
|
||||
// 格式: thumbnail/{format}/{尺寸参数}/{pic}, 如 thumbnail/webp/w120q70/ThemeMarket/xxx
|
||||
const PIC_BASE = 'https://t17.market.mi-img.com/thumbnail/webp/w120q70/';
|
||||
// 模块内置下载脚本 (真机路径)
|
||||
const DL_SCRIPT = '/data/adb/modules/FontMM/tools/mi-font-download.sh';
|
||||
|
||||
interface MiFontItem {
|
||||
title: string;
|
||||
id: string;
|
||||
pic: string;
|
||||
}
|
||||
|
||||
// HTML 转义, 防止 API 返回的标题注入
|
||||
function escapeHtml(text: string): string {
|
||||
return text
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
export class MiFontTool {
|
||||
private page!: HTMLElement;
|
||||
private list!: HTMLElement;
|
||||
private keywordInput!: HTMLInputElement;
|
||||
private resultEl!: HTMLElement;
|
||||
|
||||
private keyword = '';
|
||||
private pageNo = 0;
|
||||
private items: MiFontItem[] = [];
|
||||
private downloading = false;
|
||||
|
||||
constructor() {
|
||||
this.initPage();
|
||||
this.bindEvents();
|
||||
}
|
||||
|
||||
private initPage(): void {
|
||||
this.page = document.getElementById('mi-font-page')!;
|
||||
this.list = document.getElementById('tools-list')!;
|
||||
this.keywordInput = document.getElementById('mi-keyword') as HTMLInputElement;
|
||||
this.resultEl = document.getElementById('mi-result')!;
|
||||
document.getElementById('mi-font-back')?.addEventListener('click', () => this.back());
|
||||
}
|
||||
|
||||
private bindEvents(): void {
|
||||
document.getElementById('mi-search-btn')?.addEventListener('click', () => this.startSearch());
|
||||
// 回车触发搜索
|
||||
this.keywordInput?.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Enter') this.startSearch();
|
||||
});
|
||||
}
|
||||
|
||||
/** 从工具列表进入工具详情页 */
|
||||
public open(): void {
|
||||
this.list.hidden = true;
|
||||
this.page.hidden = false;
|
||||
// 回到工具页顶部
|
||||
this.page.scrollIntoView();
|
||||
this.keywordInput?.focus?.();
|
||||
}
|
||||
|
||||
/** 返回工具列表 */
|
||||
public back(): void {
|
||||
this.page.hidden = true;
|
||||
this.list.hidden = false;
|
||||
}
|
||||
|
||||
private startSearch(): void {
|
||||
if (this.downloading) return; // 下载中禁止新搜索
|
||||
this.keyword = this.keywordInput.value.trim();
|
||||
if (!this.keyword) {
|
||||
this.renderError('请输入字体关键词');
|
||||
return;
|
||||
}
|
||||
this.pageNo = 0;
|
||||
void this.search(this.pageNo);
|
||||
}
|
||||
|
||||
private async search(page: number): Promise<void> {
|
||||
this.renderLoading('正在搜索...');
|
||||
const url = `${SEARCH_API}${encodeURIComponent(this.keyword)}&page=${page}`;
|
||||
try {
|
||||
const { errno, stdout } = await exec(`curl -s '${url}'`);
|
||||
if (errno !== 0) {
|
||||
this.renderError(`搜索请求失败 (errno=${errno})`);
|
||||
return;
|
||||
}
|
||||
const data = JSON.parse(stdout) as any;
|
||||
const cards = data?.apiData?.cards ?? [];
|
||||
this.items = cards.flatMap((c: any) =>
|
||||
(c?.items ?? []).flatMap((it: any) =>
|
||||
(it?.schema?.clicks ?? []).map((cl: any) => ({
|
||||
title: String(cl?.title ?? '未知字体'),
|
||||
id: String(cl?.link ?? ''),
|
||||
pic: String(cl?.pic ?? ''),
|
||||
})),
|
||||
),
|
||||
);
|
||||
if (this.items.length === 0) {
|
||||
this.renderError('未找到相关字体,换个关键词试试');
|
||||
return;
|
||||
}
|
||||
this.renderList();
|
||||
} catch (e) {
|
||||
this.renderError(`解析搜索结果失败: ${String(e)}`);
|
||||
}
|
||||
}
|
||||
|
||||
private async download(item: MiFontItem): Promise<void> {
|
||||
if (this.downloading) return;
|
||||
this.downloading = true;
|
||||
const logFile = '/data/adb/modules/FontMM/webroot/mi-download.log';
|
||||
const encodedTitle = encodeURIComponent(item.title);
|
||||
this.renderLog(`开始下载「${item.title}」...\n`);
|
||||
|
||||
// 后台运行脚本 (exec 立即返回, 不阻塞 UI), 日志重定向到 webroot 下的文件
|
||||
await exec(
|
||||
`rm -f '${logFile}' && nohup sh '${DL_SCRIPT}' '${item.title}' '${item.id}' '${encodedTitle}' > '${logFile}' 2>&1 &`,
|
||||
);
|
||||
|
||||
// 轮询日志文件直到出现结束标记 __DONE__ (最多 5 分钟)
|
||||
let lastLog = '';
|
||||
for (let i = 0; i < 300; i++) {
|
||||
await new Promise((r) => setTimeout(r, 1000));
|
||||
const { stdout } = await exec(`cat '${logFile}' 2>/dev/null || true`);
|
||||
if (stdout && stdout !== lastLog) {
|
||||
lastLog = stdout;
|
||||
this.renderLog(stdout);
|
||||
}
|
||||
if (stdout.includes('__DONE__')) break;
|
||||
}
|
||||
|
||||
this.downloading = false;
|
||||
if (!lastLog.includes('__DONE__')) {
|
||||
this.renderLog(`${lastLog || ''}\n[x] 下载超时或日志文件缺失`);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------- 渲染 ----------
|
||||
|
||||
private renderLoading(text: string): void {
|
||||
this.resultEl.innerHTML = `<div class="mi-status">${escapeHtml(text)}</div>`;
|
||||
}
|
||||
|
||||
private renderError(text: string): void {
|
||||
this.resultEl.innerHTML = `<div class="mi-status mi-status-error">${escapeHtml(text)}</div>`;
|
||||
}
|
||||
|
||||
// 日志展示 (等宽字体, 保留换行)
|
||||
private renderLog(text: string): void {
|
||||
this.resultEl.innerHTML = `<pre class="mi-log">${escapeHtml(text)}</pre>`;
|
||||
}
|
||||
|
||||
private renderList(): void {
|
||||
this.resultEl.innerHTML = `
|
||||
<div class="mi-list">
|
||||
${this.items
|
||||
.map(
|
||||
(item, i) => `
|
||||
<div class="mi-item">
|
||||
<img class="mi-item-pic" src="${PIC_BASE}${escapeHtml(item.pic)}" alt="" onerror="this.style.display='none'">
|
||||
<span class="mi-item-title">${escapeHtml(item.title)}</span>
|
||||
<md-filled-button class="mi-item-dl" data-index="${i}">下载</md-filled-button>
|
||||
</div>`,
|
||||
)
|
||||
.join('')}
|
||||
</div>
|
||||
<div class="mi-pager">
|
||||
<md-text-button id="mi-prev" ${this.pageNo === 0 ? 'disabled' : ''}>上一页</md-text-button>
|
||||
<span class="mi-page">第 ${this.pageNo + 1} 页</span>
|
||||
<md-text-button id="mi-next">下一页</md-text-button>
|
||||
</div>
|
||||
`;
|
||||
this.resultEl.querySelectorAll<HTMLElement>('.mi-item-dl').forEach((btn) => {
|
||||
btn.addEventListener('click', () => {
|
||||
const idx = Number(btn.dataset.index);
|
||||
const item = this.items[idx];
|
||||
if (item) void this.download(item);
|
||||
});
|
||||
});
|
||||
document.getElementById('mi-prev')?.addEventListener('click', () => {
|
||||
if (this.pageNo > 0) {
|
||||
this.pageNo--;
|
||||
void this.search(this.pageNo);
|
||||
}
|
||||
});
|
||||
document.getElementById('mi-next')?.addEventListener('click', () => {
|
||||
this.pageNo++;
|
||||
void this.search(this.pageNo);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
export interface FontSlot {
|
||||
key: 'hans' | 'hant' | 'en' | 'mono' | 'emoji';
|
||||
title: string;
|
||||
path: string | null;
|
||||
fileName: string;
|
||||
/** 字体大小展示文本 (如 "12.5 MB"), 异步获取 */
|
||||
sizeText?: string;
|
||||
/** 是否为可变字体 (fvar 表存在), 异步获取 */
|
||||
isVariable?: boolean;
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare module 'opentype.js' {
|
||||
/** 解析字体二进制, 返回字体对象 (名称表: names.windows/macintosh) */
|
||||
export function parse(buffer: ArrayBuffer): any;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"strict": true,
|
||||
"jsx": "preserve",
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"]
|
||||
},
|
||||
"include": ["src/**/*.ts", "src/**/*.vue"]
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import { defineConfig } from 'vite';
|
||||
|
||||
export default defineConfig({
|
||||
// WebView 从本地加载 webroot, 资源必须相对路径
|
||||
base: './',
|
||||
build: {
|
||||
// 构建产物直接进模块的 webroot
|
||||
outDir: '../src/webroot',
|
||||
// outDir 在项目根之外, 必须显式开启清空
|
||||
emptyOutDir: true,
|
||||
},
|
||||
});
|
||||
@@ -1,73 +0,0 @@
|
||||
#!/bin/bash
|
||||
# FontMM - ColorOS 16 反馈脚本
|
||||
# By Yule
|
||||
SCRIPT_DIR="$(dirname $(readlink -f $0))"
|
||||
|
||||
# while [ "$(stty size | cut -d' ' -f2)" -le 80 ]; do
|
||||
# clear
|
||||
# current_cols=$(stty size | cut -d' ' -f2)
|
||||
# echo "当前列数: $current_cols"
|
||||
# echo "----------------------------------------"
|
||||
# echo "检测到窗口过窄,请缩小屏幕..."
|
||||
# echo "(列数需 > 80 才能继续运行)"
|
||||
# echo "----------------------------------------"
|
||||
# sleep 1
|
||||
# done
|
||||
clear
|
||||
|
||||
WELCOME() {
|
||||
echo -e "======================================"
|
||||
echo -e " FontMM - ColorOS 16 反馈脚本"
|
||||
echo -e " Author: 于乐 Yule"
|
||||
echo -e " 您的反馈会令这个项目更好"
|
||||
echo -e "======================================"
|
||||
echo ""
|
||||
}
|
||||
WELCOME
|
||||
|
||||
echo "手机型号:$(getprop ro.product.brand) | $(getprop ro.product.model) | $(getprop ro.vendor.oplus.market.enname)"
|
||||
echo "系统版本:$(getprop ro.build.display.full_id)"
|
||||
echo "安卓版本: $(getprop ro.build.version.release)"
|
||||
echo "SELINUX 状态:$(getenforce)"
|
||||
echo
|
||||
|
||||
echo -n "当前Root管理器:"
|
||||
if [ -d "/data/adb/magisk" ]; then
|
||||
echo "Magisk (/data/adb/magisk)"
|
||||
elif [ -d "/data/adb/ksu" ]; then
|
||||
echo "KernelSU (/data/adb/ksu)"
|
||||
elif [ -d "/data/adb/apatch" ]; then
|
||||
echo "APatch (/data/adb/apatch)"
|
||||
elif [ -f "/data/adb/ksu/bin/ksud" ]; then
|
||||
echo "KernelSU (/data/adb/ksu/bin/ksud)"
|
||||
else
|
||||
echo "未检测到 Root 环境"
|
||||
fi
|
||||
|
||||
echo -n "- 元模块:$(cat /data/adb/metamodule/module.prop | grep name)"
|
||||
|
||||
echo
|
||||
echo
|
||||
echo "FontMM 文件列表:"
|
||||
ls -R $SCRIPT_DIR
|
||||
|
||||
echo
|
||||
echo "已安装模块列表:"
|
||||
ls /data/adb/modules/
|
||||
|
||||
echo
|
||||
echo "系统 fonts 列表 (筛选):"
|
||||
ls -s -k /system/fonts/ | grep Sys
|
||||
|
||||
echo
|
||||
echo "模块 fonts 列表 (筛选):"
|
||||
mod_id_line="$(cat "$SCRIPT_DIR/module.prop" | grep id)"
|
||||
mod_id="${mod_id_line#*=}"
|
||||
ls -s -k "/data/adb/modules/$mod_id/system/fonts/" | grep Sys
|
||||
|
||||
echo
|
||||
echo "系统 fonts.xml SHA256:$(sha256sum "/system/etc/fonts.xml" | cut -f1 -d" ")"
|
||||
echo "模块 fonts.xml SHA256:$(sha256sum "/data/adb/modules/$mod_id/system/etc/fonts.xml" | cut -f1 -d" ")"
|
||||
|
||||
echo
|
||||
echo "[请缩小屏幕截图以上信息给开发者,感谢您的支持!]"
|
||||
@@ -1,144 +0,0 @@
|
||||
#!/bin/bash
|
||||
# FontMM - ColorOS 16 打包脚本
|
||||
# By Yule
|
||||
|
||||
# --- 配置 ---
|
||||
COMP_LEVEL="9"
|
||||
SCRIPT_DIR="$(dirname $(readlink -f $0))"
|
||||
TEMP_DIR="$SCRIPT_DIR/template"
|
||||
TTF_DIR="$SCRIPT_DIR/ttf"
|
||||
BUILD_DIR="$SCRIPT_DIR/.build"
|
||||
MODULE_FILE="$SCRIPT_DIR/MODULE.zip"
|
||||
|
||||
# --- 颜色定义 ---
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[0;33m'
|
||||
BLUE='\033[0;34m'
|
||||
PURPLE='\033[0;35m'
|
||||
CYAN='\033[0;36m'
|
||||
NC='\033[0m'
|
||||
BOLD='\033[1m'
|
||||
|
||||
# --- 计时开始 ---
|
||||
START_TIME=$(date +%s.%N)
|
||||
|
||||
# --- 辅助函数 ---
|
||||
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
||||
log_succ() { echo -e "${GREEN}[OK]${NC} $1"; }
|
||||
log_warn() { echo -e "${YELLOW}[WAIT]${NC} $1"; }
|
||||
log_err() { echo -e "${RED}[ERROR]${NC} $1"; }
|
||||
|
||||
CHECK_ENVIRONMENT() {
|
||||
echo -e "${CYAN}>>${NC} 检查运行环境..."
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
log_err "请授权 Root 权限后运行"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v zip >/dev/null 2>&1; then
|
||||
log_err "未找到 zip 工具,请运行 pkg install zip"
|
||||
exit 1
|
||||
fi
|
||||
log_succ "环境就绪"
|
||||
}
|
||||
|
||||
WELCOME() {
|
||||
clear
|
||||
echo -e "${PURPLE}${BOLD}======================================"
|
||||
echo -e " FontMM - ColorOS 16 打包脚本"
|
||||
echo -e " Author: 于乐 Yule"
|
||||
echo -e "======================================"${NC}
|
||||
echo ""
|
||||
}
|
||||
|
||||
SETUP_BUILD_ENV() {
|
||||
log_warn "清理并准备构建目录..."
|
||||
rm -rf "$BUILD_DIR"
|
||||
rm -f "$MODULE_FILE"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
cp "$TEMP_DIR/template.zip" "$BUILD_DIR/" >/dev/null
|
||||
log_succ "构建环境已初始化"
|
||||
}
|
||||
|
||||
SHOW_MODULE_INFO() {
|
||||
local PROP_FILE="$SCRIPT_DIR/module.prop"
|
||||
|
||||
if [ ! -f "$PROP_FILE" ]; then
|
||||
log_err "未找到 module.prop,跳过信息展示"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo
|
||||
echo -e "${YELLOW}${BOLD}------------- 模块信息预览 ------------${NC}"
|
||||
|
||||
# 逐行读取 module.prop
|
||||
while IFS= read -r line || [ -n "$line" ]; do
|
||||
# 跳过空行和注释
|
||||
[[ -z "$line" || "$line" =~ ^# ]] && continue
|
||||
|
||||
# 以第一个等号为界分割 Key 和 Value
|
||||
local key="${line%%=*}"
|
||||
local value="${line#*=}"
|
||||
|
||||
# 渲染输出:Key 用灰色,Value 用高亮青色
|
||||
# %-12s 是为了让等号左边对齐,看起来更整齐
|
||||
printf "\033[0;90m%-12s\033[0m = \033[1;36m%s\033[0m\n" "$key" "$value"
|
||||
|
||||
done < "$PROP_FILE"
|
||||
|
||||
echo -e "${YELLOW}${BOLD}----------------------------------------${NC}"
|
||||
echo
|
||||
}
|
||||
|
||||
PACKER() {
|
||||
local TARGET_ZIP="$BUILD_DIR/template.zip"
|
||||
|
||||
# 字体检查
|
||||
if [ ! -f "$TTF_DIR/ch.ttf" ]; then
|
||||
echo ""
|
||||
log_err "致命错误: 缺少核心字体 ch.ttf"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log_warn "正在同步字体文件..."
|
||||
mkdir -p "$BUILD_DIR/ttf"
|
||||
cp "$TTF_DIR/ch.ttf" "$BUILD_DIR/ttf/"
|
||||
[ -f "$TTF_DIR/tc.ttf" ] && cp "$TTF_DIR/tc.ttf" "$BUILD_DIR/ttf/"
|
||||
[ -f "$TTF_DIR/en.ttf" ] && cp "$TTF_DIR/en.ttf" "$BUILD_DIR/ttf/"
|
||||
|
||||
log_warn "正在封包 (Level: $COMP_LEVEL)..."
|
||||
(
|
||||
cd "$BUILD_DIR" || exit
|
||||
zip -"${COMP_LEVEL}"urq "template.zip" "ttf"
|
||||
zip -"${COMP_LEVEL}"ujq "template.zip" "$SCRIPT_DIR/module.prop"
|
||||
)
|
||||
|
||||
rm -rf "$BUILD_DIR/ttf"
|
||||
mv "$TARGET_ZIP" "$SCRIPT_DIR/MODULE.zip"
|
||||
log_succ "资源已成功注入压缩包"
|
||||
}
|
||||
|
||||
CALC_TIME() {
|
||||
local END_TIME=$(date +%s.%N)
|
||||
# 计算差值并保留两位小数
|
||||
local DURATION=$(echo "$END_TIME - $START_TIME" | bc 2>/dev/null || echo "0")
|
||||
|
||||
echo ""
|
||||
echo -e "${PURPLE}--------------------------------------${NC}"
|
||||
echo -e "${GREEN}${BOLD}打包完成!${NC}"
|
||||
echo -e "${CYAN}累计耗时: ${NC}${DURATION}s"
|
||||
echo -e "${CYAN}输出路径: ${NC}${BOLD}$SCRIPT_DIR/MODULE.zip${NC}"
|
||||
echo -e "${PURPLE}--------------------------------------${NC}"
|
||||
}
|
||||
|
||||
MAIN() {
|
||||
WELCOME
|
||||
CHECK_ENVIRONMENT
|
||||
SETUP_BUILD_ENV
|
||||
SHOW_MODULE_INFO
|
||||
PACKER
|
||||
CALC_TIME
|
||||
}
|
||||
|
||||
MAIN
|
||||
Reference in new issue
Block a user