mirror of
https://github.com/YuleBest/FontMM.git
synced 2026-12-04 05:44:50 +08:00
Compare commits
46
Commits
No files matched your search
@@ -1 +0,0 @@
|
||||
template/*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
@@ -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,7 @@
|
||||
node_modules/
|
||||
web/node_modules/
|
||||
dist/
|
||||
src/webroot/
|
||||
reasonix.toml
|
||||
.reasonix/
|
||||
.agent/
|
||||
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.
|
||||
@@ -0,0 +1,224 @@
|
||||
# FontMM
|
||||
|
||||
FontMM 是一个用于在 Android 设备上一键更换系统字体的 **Magisk / KernelSU 模块**,内置 WebUI 字体管理界面,目前适配 **ColorOS 16**。
|
||||
|
||||
只需在 WebUI 中挑选一个 `.ttf` 字体文件,点一下「应用字体」,重启即可生效 —— 不需要在电脑上手动解压、改名、打包模块。
|
||||
|
||||
> 当前分支为 v26 全新架构(WebUI + 统一 `apply.sh` 安装逻辑),旧版 v1.x 的「解压模板 → 放入 ttf → 运行打包脚本」流程已被取代。
|
||||
|
||||
## 特性
|
||||
|
||||
- 🖥️ **内置 WebUI**:Material Design 3 风格的管理界面,在 KernelSU 管理器(或支持 WebUI 的 Root 管理器)中直接打开
|
||||
- 🎯 **三槽位字体**:中文简体 / 中文繁体 / 英文与数字分别独立设置
|
||||
- 🔄 **智能回退**:繁体、英文未设置时自动回退到简体,不会出现「缺字」或「没换成功」的情况
|
||||
- 📁 **可视化文件选择器**:浏览设备目录、一键过滤非 `.ttf` 文件
|
||||
- 🛡️ **安装自检**:刷入时自动校验 ColorOS 版本、KernelSU 元模块、FontLoader 版本
|
||||
- ♻️ **更新模式**:覆盖安装/更新模块时自动继承旧版模块中已设置的字体
|
||||
- 📦 **统一安装逻辑**:WebUI 换字体与刷机安装共用同一个 `apply.sh`,行为完全一致
|
||||
|
||||
## 支持环境
|
||||
|
||||
| 项目 | 要求 |
|
||||
| --- | --- |
|
||||
| 系统 | 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`(支持可变字体) |
|
||||
|
||||
> 非 ColorOS 系统、ColorOS 版本低于 16 的设备会在安装时被 `customize.sh` 直接拒绝。
|
||||
|
||||
## 快速开始(用户)
|
||||
|
||||
### 1. 安装模块
|
||||
|
||||
1. 在 [Releases](https://github.com/YuleBest/FontMM/releases) 下载最新版 `FontMM_v*.zip`
|
||||
2. 在 KernelSU / Magisk 管理器中刷入该 zip(无需解压)
|
||||
3. 安装脚本会自动完成系统检查,并给出「成功 / 失败原因」
|
||||
|
||||
### 2. 通过 WebUI 更换字体
|
||||
|
||||
1. 打开 KernelSU 管理器,进入 FontMM 模块,点击「**打开 WebUI**」(或类似入口)
|
||||
2. 在三个槽位中分别选择字体:
|
||||
- **中文简体** —— 必选
|
||||
- **中文繁体** —— 可选,未选择时自动使用简体
|
||||
- **英文 & 数字** —— 可选,未选择时自动使用简体
|
||||
3. 点击底部「**应用字体**」,等待执行完成
|
||||
4. 弹窗中会展示完整应用日志(每个系统字体文件的安装结果)
|
||||
5. **重启设备**后生效
|
||||
|
||||
### 3. 手动放置字体(可选)
|
||||
|
||||
不想用 WebUI 时,也可以直接操作文件:
|
||||
|
||||
1. 把字体放入 `/data/adb/modules/FontMM/FONTS/`,命名规则:
|
||||
- `hans.ttf` —— 中文简体(必选)
|
||||
- `hant.ttf` —— 中文繁体(可选)
|
||||
- `en.ttf` —— 英文与数字(可选)
|
||||
2. 在 Root 管理器中点击本模块的「**执行**」(Action),或执行 `sh /data/adb/modules/FontMM/apply.sh`
|
||||
3. 重启设备
|
||||
|
||||
## 字体映射
|
||||
|
||||
模块把 3 个用户字体槽位映射到 ColorOS 的 8 个系统字体文件:
|
||||
|
||||
| 槽位 | 用户文件 | 覆盖的系统字体文件 |
|
||||
| --- | --- | --- |
|
||||
| 中文简体 | `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` |
|
||||
|
||||
**回退规则**:`hant.ttf` / `en.ttf` 缺失时,对应槽位自动使用 `hans.ttf`;`hans.ttf` 缺失时 `apply.sh` 直接报错退出(WebUI 也会禁用「应用」按钮)。`mono.ttf` 未设置时**不覆盖**系统等宽字体(`DroidSansMono.ttf` 保持系统原生)。
|
||||
|
||||
## 工作原理
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ KernelSU 管理器 │
|
||||
│ ┌──────────────────────────────┐ │
|
||||
│ │ WebUI (web/ 构建产物) │ ksu.exec / toast │
|
||||
│ └──────────────┬───────────────┘ │
|
||||
└───────────────────┼──────────────────────────────────────┘
|
||||
│ sh /data/adb/modules/FontMM/apply.sh
|
||||
▼
|
||||
┌───────────────────────┐ cp -f ┌──────────────────────┐
|
||||
│ FONTS/ 用户字体 │ ──────────► │ system/fonts/ │
|
||||
│ hans.ttf │ │ 8 个 SysFont 文件 │
|
||||
│ hant.ttf (可选) │ └──────────────────────┘
|
||||
│ en.ttf (可选) │
|
||||
└───────────────────────┘
|
||||
```
|
||||
|
||||
1. **安装阶段**(`customize.sh`):系统检查(ColorOS 版本、KernelSU 元模块、FontLoader)→ 更新模式检测与旧字体继承 → 调用 `apply.sh` 完成首次字体安装。
|
||||
2. **换字体阶段**(WebUI):选择文件 → 复制到 `FONTS/` → 调用同一个 `apply.sh`,保证两条路径行为一致。
|
||||
3. **`apply.sh` 核心逻辑**:按上表的映射关系,把 `FONTS/` 中的字体 `cp` 到 `system/fonts/` 的对应文件,缺繁体/英文时回退简体。
|
||||
4. **字体生效**:ColorOS 通过 `/system/etc/fonts.xml`、`fonts_base.xml`、`fonts_ule.xml`、`font_fallback.xml`(及 `/system/system_ext/etc/` 下的对应文件)引用 `SysFont*` / `SysSans*` 字体族 —— 模块内嵌了从 ColorOS 16 提取的这些配置,替换字体文件即可全局生效。
|
||||
|
||||
## 项目结构
|
||||
|
||||
```
|
||||
FontMM/
|
||||
├── src/ # Magisk 模块源(打包时 zip 根 = 模块根)
|
||||
│ ├── module.prop # 模块元信息(id/version/updateJson)
|
||||
│ ├── customize.sh # 安装脚本:系统检查 + 更新模式 + 调用 apply.sh
|
||||
│ ├── apply.sh # 字体应用脚本(安装 & WebUI 共用)
|
||||
│ ├── FONTS/ # 用户字体目录(hans.ttf 默认字体)
|
||||
│ ├── META-INF/ # Magisk 安装入口(update-binary / updater-script)
|
||||
│ ├── system/
|
||||
│ │ ├── fonts/ # 8 个字体槽位(0 字节占位,安装时被填充)
|
||||
│ │ └── 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 # 字体文件选择器(.ttf 过滤、目录导航)
|
||||
│ ├── ksu.ts # kernelsu exec/toast 封装(DEV 模式内置 mock)
|
||||
│ ├── theme.scss # Material Design 3 主题变量
|
||||
│ └── style.scss # 全局样式
|
||||
├── dev/ # 开发脚本
|
||||
│ ├── cd.sh # 打包模块 zip(preplace / template 两版)→ dist/
|
||||
│ ├── ci.sh # shellcheck + shfmt 检查(在 Termux 中运行)
|
||||
│ ├── webzip.sh # 仅打包 WebUI 产物 → dist/webroot.zip
|
||||
│ └── 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 检查需要)
|
||||
- Android 设备(Termux)或任意可运行 `ash` 的环境(验证 shell 脚本)
|
||||
|
||||
### 安装依赖
|
||||
|
||||
```bash
|
||||
pnpm install # 根 workspace(会联动安装 web/)
|
||||
```
|
||||
|
||||
### 本地预览 WebUI
|
||||
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
启动 Vite dev server,浏览器打开后即可预览。`dev` 模式下 `ksu.ts` 使用内置 **mock 文件系统**(`/sdcard`、`/sdcard/Fonts` 等假目录与字体),文件选择、槽位切换、应用字体全流程均可脱离真机调试。
|
||||
|
||||
### 构建与打包
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
|
||||
依次执行:
|
||||
|
||||
1. `vite build` —— 把 WebUI 构建到 `src/webroot/`(相对路径 `base: './'`,适配本地 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/` 下不含字体文件。
|
||||
|
||||
产物示例:`dist/FontMM_v26.8.0(260800001)_preplace.zip`(注意版本号带括号,shell 中使用请加引号)。
|
||||
|
||||
### 代码检查
|
||||
|
||||
```bash
|
||||
pnpm lint # 前端 oxlint 检查 (web/src)
|
||||
pnpm fmt # 前端 oxfmt 格式化
|
||||
pnpm fmt:check # 前端 oxfmt 格式检查 (CI 用)
|
||||
bash dev/ci.sh # src/ 下所有 .sh 的 shellcheck + shfmt 检查
|
||||
```
|
||||
|
||||
- 前端 lint/format 由 [oxlint](https://oxc.rs/) 与 [oxfmt](https://oxc.rs/) 提供,配置在 `web/.oxlintrc.json`(`correctness` 类别 + typescript/unicorn/oxc 插件)与 `web/.oxfmtrc.json`(`singleQuote: true`,与代码风格一致)
|
||||
- `dev/ci.sh` 对 `src/` 下所有 `.sh` 依次执行 `shellcheck` 校验与 `shfmt` 格式检查(`-i 4`)。脚本预设了 Termux 的 PATH/`LD_LIBRARY_PATH`,可在 Android 的 Termux 中直接运行
|
||||
|
||||
### 占位字体机制
|
||||
|
||||
`src/system/fonts/` 下的 8 个字体文件是 **0 字节占位文件**,避免把大字体文件提交进仓库;模块安装或应用字体时由 `apply.sh` 用 `FONTS/` 里的真实字体覆盖。
|
||||
|
||||
- 开发时可用 `dev/empty_font.sh` 重新生成这些占位文件(字体清单与 `apply.sh` 保持一致)
|
||||
- `src/FONTS/hans.ttf` 是内置默认简体字体(随模块发布),未继承到旧字体时的兜底
|
||||
|
||||
### 版本号
|
||||
|
||||
版本号只维护在 `src/module.prop` 中:
|
||||
|
||||
```
|
||||
version=26.8.0(260800001)
|
||||
versionCode=26080001
|
||||
```
|
||||
|
||||
`dev/cd.sh` 会解析 `version` 字段作为 zip 文件名(`_preplace` / `_template` 两个后缀),无需手动改别处。
|
||||
|
||||
## 常见问题
|
||||
|
||||
**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:检查对应槽位是否真的选了文件;未选择时按设计会回退到简体。
|
||||
|
||||
**Q:更新模块会丢失我设置好的字体吗?**
|
||||
A:不会。`customize.sh` 检测到已安装的 FontMM 时会进入更新模式,从旧模块的 `FONTS/` 目录继承 `hans.ttf` / `hant.ttf` / `en.ttf`。
|
||||
|
||||
**Q:`system/fonts/` 里的字体文件为什么是 0 字节?**
|
||||
A:那是占位文件,安装或应用字体时会被真实字体覆盖,详见「占位字体机制」。
|
||||
|
||||
**Q:zip 文件名里的括号在终端里打不开?**
|
||||
A:版本号形如 `26.8.0(260800001)`,在 shell 中请用引号包裹:`unzip "FontMM_v26.8.0(260800001)_preplace.zip"`。
|
||||
|
||||
## 致谢
|
||||
|
||||
- 字体映射与配置文件参考 ColorOS 16 系统字体体系(`SysFont` / `SysSans` 字体族)
|
||||
- WebUI 基于 [Material Web](https://github.com/material-components/material-web)(Material Design 3)与 [kernelsu](https://www.npmjs.com/package/kernelsu) SDK 构建
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
1. 修改 module.prop
|
||||
|
||||
2. 在 ttf 里面放入你的字体
|
||||
|
||||
ch.ttf -- 中文(简体)
|
||||
tc.ttf -- 中文(繁体)
|
||||
en.ttf -- 英文
|
||||
|
||||
你也可以只放入一个 ch.ttf
|
||||
这样的话,中文(繁体)和英文都会使用 ch.ttf
|
||||
|
||||
3. 运行 打包.sh
|
||||
@@ -0,0 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 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
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/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(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
|
||||
|
||||
PRE_OUT="$DIST_DIR/FontMM_v${VERSION}_preplace.zip"
|
||||
TPL_OUT="$DIST_DIR/FontMM_v${VERSION}_template.zip"
|
||||
|
||||
mkdir -p "$DIST_DIR"
|
||||
rm -f "$PRE_OUT" "$TPL_OUT" # 先删旧的, 防止 zip 增量更新残留已删除的文件
|
||||
|
||||
# 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,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,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,66 @@
|
||||
#!/system/bin/sh
|
||||
# shellcheck shell=ash
|
||||
# FontMM apply.sh — 应用字体: 把 FONTS/ 里的字体安装到 system/fonts
|
||||
# 用法: apply.sh [模块目录] 默认 /data/adb/modules/FontMM
|
||||
# 回退逻辑: hant/en 缺失时回退到 hans; mono 缺失时不覆盖系统等宽字体
|
||||
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
|
||||
install_from "$FONTS_DIR/mono.ttf" 'DroidSansMono.ttf'
|
||||
else
|
||||
echo "[-] 未设置等宽字体, 不覆盖系统 DroidSansMono.ttf"
|
||||
rm -f "$SYS_FONT_DIR/DroidSansMono.ttf"
|
||||
fi
|
||||
|
||||
echo "[*] 全部完成, 重启后生效"
|
||||
@@ -0,0 +1,187 @@
|
||||
#!/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; 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
|
||||
|
||||
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.1(260800001)
|
||||
versionCode=26080001
|
||||
author=Yule
|
||||
description=ColorOS 16 字体模块模板
|
||||
updateJson=https://raw.githubusercontent.com/YuleBest/FontMM/main/update.json
|
||||
@@ -0,0 +1,577 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<familyset>
|
||||
<family name="sans-serif">
|
||||
<font supportedAxes="wght,ital">
|
||||
Roboto-Regular.ttf
|
||||
<axis tag="wdth" stylevalue="100.0"/>
|
||||
</font>
|
||||
</family>
|
||||
<family name="sans-serif-smallcaps">
|
||||
<font weight="400" style="normal">CarroisGothicSC-Regular.ttf</font>
|
||||
</family>
|
||||
<family name="casual">
|
||||
<font weight="400" style="normal" postScriptName="ComingSoon-Regular">ComingSoon.ttf</font>
|
||||
</family>
|
||||
<family name="serif-monospace">
|
||||
<font weight="400" style="normal" postScriptName="CutiveMono-Regular">CutiveMono.ttf</font>
|
||||
</family>
|
||||
<family name="cursive">
|
||||
<font supportedAxes="wght">DancingScript-Regular.ttf</font>
|
||||
</family>
|
||||
<family name="monospace">
|
||||
<font weight="400" style="normal">DroidSansMono.ttf</font>
|
||||
</family>
|
||||
<family name="sans-serif-condensed">
|
||||
<font supportedAxes="wght,ital">
|
||||
Roboto-Regular.ttf
|
||||
<axis tag="wdth" stylevalue="75.0"/>
|
||||
</font>
|
||||
</family>
|
||||
<family name="roboto">
|
||||
<font supportedAxes="wght,ital">
|
||||
Roboto-Regular.ttf
|
||||
<axis tag="wdth" stylevalue="100.0"/>
|
||||
</font>
|
||||
</family>
|
||||
<family name="roboto-flex">
|
||||
<font supportedAxes="wght">
|
||||
RobotoFlex-Regular.ttf
|
||||
<axis tag="wdth" stylevalue="100.0"/>
|
||||
</font>
|
||||
</family>
|
||||
<family name="source-sans-pro">
|
||||
<font weight="400" style="normal">SourceSansPro-Regular.ttf</font>
|
||||
<font weight="400" style="italic">SourceSansPro-Italic.ttf</font>
|
||||
<font weight="600" style="normal">SourceSansPro-SemiBold.ttf</font>
|
||||
<font weight="600" style="italic">SourceSansPro-SemiBoldItalic.ttf</font>
|
||||
<font weight="700" style="normal">SourceSansPro-Bold.ttf</font>
|
||||
<font weight="700" style="italic">SourceSansPro-BoldItalic.ttf</font>
|
||||
</family>
|
||||
<family name="serif">
|
||||
<font weight="400" style="normal" postScriptName="NotoSerif">NotoSerif-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSerif-Bold.ttf</font>
|
||||
<font weight="400" style="italic">NotoSerif-Italic.ttf</font>
|
||||
<font weight="700" style="italic">NotoSerif-BoldItalic.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Arab" variant="elegant">
|
||||
<font weight="400" style="normal" postScriptName="NotoNaskhArabic">NotoNaskhArabic-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoNaskhArabic-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Arab" variant="compact">
|
||||
<font weight="400" style="normal" postScriptName="NotoNaskhArabicUI">NotoNaskhArabicUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoNaskhArabicUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Ethi">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansEthiopic-Regular">NotoSansEthiopic-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifEthiopic-Regular">NotoSerifEthiopic-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Hebr">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansHebrew">NotoSansHebrew-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansHebrew-Bold.ttf</font>
|
||||
<font weight="400" style="normal" fallbackFor="serif">NotoSerifHebrew-Regular.ttf</font>
|
||||
<font weight="700" style="normal" fallbackFor="serif">NotoSerifHebrew-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Thai" variant="elegant">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansThai">NotoSansThai-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansThai-Bold.ttf</font>
|
||||
<font weight="400" style="normal" fallbackFor="serif">NotoSerifThai-Regular.ttf</font>
|
||||
<font weight="700" style="normal" fallbackFor="serif">NotoSerifThai-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Thai" variant="compact">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansThaiUI">NotoSansThaiUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansThaiUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Armn">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansArmenian-Regular">NotoSansArmenian-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifArmenian-Regular">NotoSerifArmenian-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Geor,und-Geok">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansGeorgian-Regular">NotoSansGeorgian-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifGeorgian-Regular">NotoSerifGeorgian-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Deva" variant="elegant">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansDevanagari-Regular">NotoSansDevanagari-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifDevanagari-Regular">NotoSerifDevanagari-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Deva" variant="compact">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansDevanagariUI-Regular">NotoSansDevanagariUI-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Gujr" variant="elegant">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansGujarati">NotoSansGujarati-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansGujarati-Bold.ttf</font>
|
||||
<font style="normal" supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifGujarati-Regular">NotoSerifGujarati-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Gujr" variant="compact">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansGujaratiUI">NotoSansGujaratiUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansGujaratiUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Guru" variant="elegant">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansGurmukhi-Regular">NotoSansGurmukhi-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifGurmukhi-Regular">NotoSerifGurmukhi-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Guru" variant="compact">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansGurmukhiUI-Regular">NotoSansGurmukhiUI-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Taml" variant="elegant">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansTamil-Regular">NotoSansTamil-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifTamil-Regular">NotoSerifTamil-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Taml" variant="compact">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansTamilUI-Regular">NotoSansTamilUI-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Mlym" variant="elegant">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansMalayalam-Regular">NotoSansMalayalam-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifMalayalam-Regular">NotoSerifMalayalam-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Mlym" variant="compact">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansMalayalamUI-Regular">NotoSansMalayalamUI-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Beng" variant="elegant">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansBengali-Regular">NotoSansBengali-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifBengali-Regular">NotoSerifBengali-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Beng" variant="compact">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansBengaliUI-Regular">NotoSansBengaliUI-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Telu" variant="elegant">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansTelugu-Regular">NotoSansTelugu-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifTelugu-Regular">NotoSerifTelugu-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Telu" variant="compact">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansTeluguUI-Regular">NotoSansTeluguUI-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Knda" variant="elegant">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansKannada-Regular">NotoSansKannada-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifKannada-Regular">NotoSerifKannada-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Knda" variant="compact">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansKannadaUI-Regular">NotoSansKannadaUI-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Orya" variant="elegant">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOriya">NotoSansOriya-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansOriya-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Orya" variant="compact">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOriyaUI">NotoSansOriyaUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansOriyaUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Sinh" variant="elegant">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansSinhala-Regular">NotoSansSinhala-VF.ttf</font>
|
||||
<font supportedAxes="wght" fallbackFor="serif" postScriptName="NotoSerifSinhala-Regular">NotoSerifSinhala-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Sinh" variant="compact">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansSinhalaUI-Regular">NotoSansSinhalaUI-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Khmr" variant="elegant">
|
||||
<font weight="400" style="normal" supportedAxes="wght" postScriptName="NotoSansKhmer-Regular">
|
||||
NotoSansKhmer-VF.ttf
|
||||
<axis tag="wdth" stylevalue="100.0"/>
|
||||
</font>
|
||||
<font weight="400" style="normal" fallbackFor="serif">NotoSerifKhmer-Regular.otf</font>
|
||||
<font weight="700" style="normal" fallbackFor="serif">NotoSerifKhmer-Bold.otf</font>
|
||||
</family>
|
||||
<family lang="und-Khmr" variant="compact">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansKhmerUI">NotoSansKhmerUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansKhmerUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Laoo" variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansLao-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansLao-Bold.ttf</font>
|
||||
<font weight="400" style="normal" fallbackFor="serif">NotoSerifLao-Regular.ttf</font>
|
||||
<font weight="700" style="normal" fallbackFor="serif">NotoSerifLao-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Laoo" variant="compact">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansLaoUI">NotoSansLaoUI-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansLaoUI-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Mymr" variant="elegant">
|
||||
<font weight="400" style="normal">NotoSansMyanmar-Regular.otf</font>
|
||||
<font weight="500" style="normal">NotoSansMyanmar-Medium.otf</font>
|
||||
<font weight="700" style="normal">NotoSansMyanmar-Bold.otf</font>
|
||||
<font weight="400" style="normal" fallbackFor="serif">NotoSerifMyanmar-Regular.otf</font>
|
||||
<font weight="700" style="normal" fallbackFor="serif">NotoSerifMyanmar-Bold.otf</font>
|
||||
</family>
|
||||
<family lang="und-Mymr" variant="compact">
|
||||
<font weight="400" style="normal">NotoSansMyanmarUI-Regular.otf</font>
|
||||
<font weight="500" style="normal">NotoSansMyanmarUI-Medium.otf</font>
|
||||
<font weight="700" style="normal">NotoSansMyanmarUI-Bold.otf</font>
|
||||
</family>
|
||||
<family lang="und-Thaa">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansThaana">NotoSansThaana-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansThaana-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Cham">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansCham">NotoSansCham-Regular.ttf</font>
|
||||
<font weight="700" style="normal">NotoSansCham-Bold.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Ahom">
|
||||
<font weight="400" style="normal">NotoSansAhom-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Adlm">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansAdlam-Regular">NotoSansAdlam-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Avst">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansAvestan">NotoSansAvestan-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Bali">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansBalinese">NotoSansBalinese-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Bamu">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansBamum">NotoSansBamum-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Batk">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansBatak">NotoSansBatak-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Brah">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansBrahmi">NotoSansBrahmi-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Bugi">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansBuginese">NotoSansBuginese-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Buhd">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansBuhid">NotoSansBuhid-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Cans">
|
||||
<font weight="400" style="normal">NotoSansCanadianAboriginal-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Cari">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansCarian">NotoSansCarian-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Cakm">
|
||||
<font weight="400" style="normal">NotoSansChakma-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Cher">
|
||||
<font weight="400" style="normal">NotoSansCherokee-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Copt">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansCoptic">NotoSansCoptic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Xsux">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansCuneiform">NotoSansCuneiform-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Cprt">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansCypriot">NotoSansCypriot-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Dsrt">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansDeseret">NotoSansDeseret-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Egyp">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansEgyptianHieroglyphs">NotoSansEgyptianHieroglyphs-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Elba">
|
||||
<font weight="400" style="normal">NotoSansElbasan-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Glag">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansGlagolitic">NotoSansGlagolitic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Goth">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansGothic">NotoSansGothic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Hano">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansHanunoo">NotoSansHanunoo-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Armi">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansImperialAramaic">NotoSansImperialAramaic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Phli">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansInscriptionalPahlavi">NotoSansInscriptionalPahlavi-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Prti">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansInscriptionalParthian">NotoSansInscriptionalParthian-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Java">
|
||||
<font weight="400" style="normal">NotoSansJavanese-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Kthi">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansKaithi">NotoSansKaithi-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Kali">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansKayahLi">NotoSansKayahLi-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Khar">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansKharoshthi">NotoSansKharoshthi-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Lepc">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansLepcha">NotoSansLepcha-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Limb">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansLimbu">NotoSansLimbu-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Linb">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansLinearB">NotoSansLinearB-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Lisu">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansLisu">NotoSansLisu-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Lyci">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansLycian">NotoSansLycian-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Lydi">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansLydian">NotoSansLydian-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Mand">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansMandaic">NotoSansMandaic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Mtei">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansMeeteiMayek">NotoSansMeeteiMayek-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Talu">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansNewTaiLue">NotoSansNewTaiLue-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Nkoo">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansNKo">NotoSansNKo-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Ogam">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOgham">NotoSansOgham-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Olck">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOlChiki">NotoSansOlChiki-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Ital">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOldItalic">NotoSansOldItalic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Xpeo">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOldPersian">NotoSansOldPersian-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Sarb">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOldSouthArabian">NotoSansOldSouthArabian-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Orkh">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOldTurkic">NotoSansOldTurkic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Osge">
|
||||
<font weight="400" style="normal">NotoSansOsage-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Osma">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansOsmanya">NotoSansOsmanya-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Phnx">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansPhoenician">NotoSansPhoenician-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Rjng">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansRejang">NotoSansRejang-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Runr">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansRunic">NotoSansRunic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Samr">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansSamaritan">NotoSansSamaritan-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Saur">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansSaurashtra">NotoSansSaurashtra-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Shaw">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansShavian">NotoSansShavian-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Sund">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansSundanese">NotoSansSundanese-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Sylo">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansSylotiNagri">NotoSansSylotiNagri-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Syre">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansSyriacEstrangela">NotoSansSyriacEstrangela-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Syrn">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansSyriacEastern">NotoSansSyriacEastern-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Syrj">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansSyriacWestern">NotoSansSyriacWestern-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Tglg">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansTagalog">NotoSansTagalog-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Tagb">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansTagbanwa">NotoSansTagbanwa-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Lana">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansTaiTham">NotoSansTaiTham-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Tavt">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansTaiViet">NotoSansTaiViet-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Tibt">
|
||||
<font supportedAxes="wght" postScriptName="NotoSerifTibetan-Regular">NotoSerifTibetan-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Tfng">
|
||||
<font weight="400" style="normal">NotoSansTifinagh-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Ugar">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansUgaritic">NotoSansUgaritic-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Vaii">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansVai">NotoSansVai-Regular.ttf</font>
|
||||
</family>
|
||||
<family>
|
||||
<font weight="400" style="normal">NotoSansSymbols-Regular-Subsetted.ttf</font>
|
||||
</family>
|
||||
<family lang="zh-Hans">
|
||||
<font weight="400" style="normal" index="2" supportedAxes="wght" postScriptName="NotoSansCJKJP-Regular">NotoSansCJK-Regular.ttc</font>
|
||||
<font weight="400" style="normal" index="2" fallbackFor="serif" postScriptName="NotoSerifCJKjp-Regular">NotoSerifCJK-Regular.ttc</font>
|
||||
</family>
|
||||
<family lang="zh-Hant,zh-Bopo">
|
||||
<font weight="400" style="normal" index="3" supportedAxes="wght" postScriptName="NotoSansCJKJP-Regular">NotoSansCJK-Regular.ttc</font>
|
||||
<font weight="400" style="normal" index="3" fallbackFor="serif" postScriptName="NotoSerifCJKjp-Regular">NotoSerifCJK-Regular.ttc</font>
|
||||
</family>
|
||||
<family lang="ja">
|
||||
<font weight="400" style="normal" index="0" supportedAxes="wght" postScriptName="NotoSansCJKJP-Regular">NotoSansCJK-Regular.ttc</font>
|
||||
<font weight="400" style="normal" index="0" fallbackFor="serif" postScriptName="NotoSerifCJKjp-Regular">NotoSerifCJK-Regular.ttc</font>
|
||||
</family>
|
||||
<family lang="ja">
|
||||
<font supportedAxes="wght" postScriptName="NotoSerifHentaigana-ExtraLight">
|
||||
NotoSerifHentaigana.ttf
|
||||
<axis tag="wght" stylevalue="400.0"/>
|
||||
</font>
|
||||
</family>
|
||||
<family lang="ko">
|
||||
<font weight="400" style="normal" index="1" supportedAxes="wght" postScriptName="NotoSansCJKJP-Regular">NotoSansCJK-Regular.ttc</font>
|
||||
<font weight="400" style="normal" index="1" fallbackFor="serif" postScriptName="NotoSerifCJKjp-Regular">NotoSerifCJK-Regular.ttc</font>
|
||||
</family>
|
||||
<family lang="und-Zsye">
|
||||
<font weight="400" style="normal">NotoColorEmoji.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Zsye">
|
||||
<font weight="400" style="normal">NotoColorEmojiFlags.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Zsym">
|
||||
<font weight="400" style="normal">NotoSansSymbols-Regular-Subsetted2.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Tale">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansTaiLe">NotoSansTaiLe-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Yiii">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansYi">NotoSansYi-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Mong">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansMongolian">NotoSansMongolian-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Phag">
|
||||
<font weight="400" style="normal" postScriptName="NotoSansPhagsPa">NotoSansPhagsPa-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Hluw">
|
||||
<font weight="400" style="normal">NotoSansAnatolianHieroglyphs-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Bass">
|
||||
<font weight="400" style="normal">NotoSansBassaVah-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Bhks">
|
||||
<font weight="400" style="normal">NotoSansBhaiksuki-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Hatr">
|
||||
<font weight="400" style="normal">NotoSansHatran-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Lina">
|
||||
<font weight="400" style="normal">NotoSansLinearA-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Mani">
|
||||
<font weight="400" style="normal">NotoSansManichaean-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Marc">
|
||||
<font weight="400" style="normal">NotoSansMarchen-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Merc">
|
||||
<font weight="400" style="normal">NotoSansMeroitic-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Plrd">
|
||||
<font weight="400" style="normal">NotoSansMiao-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Mroo">
|
||||
<font weight="400" style="normal">NotoSansMro-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Mult">
|
||||
<font weight="400" style="normal">NotoSansMultani-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Nbat">
|
||||
<font weight="400" style="normal">NotoSansNabataean-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Newa">
|
||||
<font weight="400" style="normal">NotoSansNewa-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Narb">
|
||||
<font weight="400" style="normal">NotoSansOldNorthArabian-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Perm">
|
||||
<font weight="400" style="normal">NotoSansOldPermic-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Hmng">
|
||||
<font weight="400" style="normal">NotoSansPahawhHmong-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Palm">
|
||||
<font weight="400" style="normal">NotoSansPalmyrene-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Pauc">
|
||||
<font weight="400" style="normal">NotoSansPauCinHau-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Shrd">
|
||||
<font weight="400" style="normal">NotoSansSharada-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Sora">
|
||||
<font weight="400" style="normal">NotoSansSoraSompeng-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Gong">
|
||||
<font weight="400" style="normal">NotoSansGunjalaGondi-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Rohg">
|
||||
<font weight="400" style="normal">NotoSansHanifiRohingya-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Khoj">
|
||||
<font weight="400" style="normal">NotoSansKhojki-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Gonm">
|
||||
<font weight="400" style="normal">NotoSansMasaramGondi-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Wcho">
|
||||
<font weight="400" style="normal">NotoSansWancho-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Wara">
|
||||
<font weight="400" style="normal">NotoSansWarangCiti-Regular.otf</font>
|
||||
</family>
|
||||
<family lang="und-Gran">
|
||||
<font weight="400" style="normal">NotoSansGrantha-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Modi">
|
||||
<font weight="400" style="normal">NotoSansModi-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Dogr">
|
||||
<font weight="400" style="normal">NotoSerifDogra-Regular.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Medf">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansMedefaidrin-Regular">NotoSansMedefaidrin-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Soyo">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansSoyombo-Regular">NotoSansSoyombo-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Takr">
|
||||
<font supportedAxes="wght" postScriptName="NotoSansTakri-Regular">NotoSansTakri-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Hmnp">
|
||||
<font supportedAxes="wght" postScriptName="NotoSerifHmongNyiakeng-Regular">NotoSerifNyiakengPuachueHmong-VF.ttf</font>
|
||||
</family>
|
||||
<family lang="und-Yezi">
|
||||
<font supportedAxes="wght" postScriptName="NotoSerifYezidi-Regular">NotoSerifYezidi-VF.ttf</font>
|
||||
</family>
|
||||
<alias name="arial" to="sans-serif"/>
|
||||
<alias name="helvetica" to="sans-serif"/>
|
||||
<alias name="tahoma" to="sans-serif"/>
|
||||
<alias name="verdana" to="sans-serif"/>
|
||||
<alias name="sans-serif-black" to="sans-serif" weight="900"/>
|
||||
<alias name="sans-serif-light" to="sans-serif" weight="300"/>
|
||||
<alias name="sans-serif-medium" to="sans-serif" weight="500"/>
|
||||
<alias name="sans-serif-thin" to="sans-serif" weight="100"/>
|
||||
<alias name="sans-serif-condensed-light" to="sans-serif-condensed" weight="300"/>
|
||||
<alias name="sans-serif-condensed-medium" to="sans-serif-condensed" weight="500"/>
|
||||
<alias name="ITC Stone Serif" to="serif"/>
|
||||
<alias name="baskerville" to="serif"/>
|
||||
<alias name="fantasy" to="serif"/>
|
||||
<alias name="georgia" to="serif"/>
|
||||
<alias name="goudy" to="serif"/>
|
||||
<alias name="palatino" to="serif"/>
|
||||
<alias name="times new roman" to="serif"/>
|
||||
<alias name="times" to="serif"/>
|
||||
<alias name="serif-bold" to="serif" weight="700"/>
|
||||
<alias name="monaco" to="monospace"/>
|
||||
<alias name="sans-serif-monospace" to="monospace"/>
|
||||
<alias name="courier new" to="serif-monospace"/>
|
||||
<alias name="courier" to="serif-monospace"/>
|
||||
<alias name="source-sans-pro-semi-bold" to="source-sans-pro" weight="600"/>
|
||||
</familyset>
|
||||
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
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.
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f54da868866e46a56c39820d34f6f3c4f3d7b0922fe09d3ae938c9bd41e75f41
|
||||
size 112703062
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"versionCode": 26080001,
|
||||
"version": "v26.8.0-beta.1",
|
||||
"zipUrl": "https://github.com/YuleBest/FontMM/releases/download/v26.8.0-beta.1/FontMM_v26.8.0-beta.1(260800001)_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
|
||||
}
|
||||
}
|
||||
+219
@@ -0,0 +1,219 @@
|
||||
<!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">FontMM</span>
|
||||
<div class="top-app-bar__actions">
|
||||
<md-icon-button id="about-btn" aria-label="关于">
|
||||
<md-icon>info</md-icon>
|
||||
</md-icon-button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- 首页视图 -->
|
||||
<main id="home-view" class="view view-home active">
|
||||
<div id="slots"></div>
|
||||
</main>
|
||||
|
||||
<!-- 字体测试视图 -->
|
||||
<div id="test-view" class="view view-test">
|
||||
<div id="test-status" class="test-status">正在加载字体...</div>
|
||||
|
||||
<div id="test-content" class="test-content" hidden>
|
||||
<md-elevated-card class="test-card">
|
||||
<div class="test-section-title">
|
||||
中文简体 <span class="test-tag" id="hans-tag"></span>
|
||||
</div>
|
||||
<div class="test-sample test-sample-hans" id="test-hans">
|
||||
简体中文测试:永和九年,岁在癸丑,暮春之初,会于会稽山阴之兰亭。
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<md-elevated-card class="test-card">
|
||||
<div class="test-section-title">
|
||||
中文繁体 <span class="test-tag" id="hant-tag"></span>
|
||||
</div>
|
||||
<div class="test-sample" id="test-hant">
|
||||
繁體中文測試:永和九年,歲在癸丑,暮春之初,會於會稽山陰之蘭亭。
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<md-elevated-card class="test-card">
|
||||
<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="about-view" class="view view-about">
|
||||
<div class="view-topbar">
|
||||
<md-icon-button id="about-back" aria-label="返回">
|
||||
<md-icon>arrow_back</md-icon>
|
||||
</md-icon-button>
|
||||
<span class="view-topbar-title">关于</span>
|
||||
</div>
|
||||
|
||||
<md-elevated-card class="about-card">
|
||||
<div class="about-logo">FontMM</div>
|
||||
<div class="about-desc" id="about-desc">-</div>
|
||||
|
||||
<div class="about-list">
|
||||
<div class="about-row">
|
||||
<span class="about-row-label">版本</span>
|
||||
<span class="about-row-value" id="about-version">-</span>
|
||||
</div>
|
||||
<div class="about-row">
|
||||
<span class="about-row-label">versionCode</span>
|
||||
<span class="about-row-value" id="about-version-code">-</span>
|
||||
</div>
|
||||
<div class="about-row">
|
||||
<span class="about-row-label">作者</span>
|
||||
<span class="about-row-value" id="about-author">-</span>
|
||||
</div>
|
||||
<div class="about-row">
|
||||
<span class="about-row-label">模块 ID</span>
|
||||
<span class="about-row-value" id="about-id">-</span>
|
||||
</div>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<md-elevated-card class="about-card">
|
||||
<div class="about-section-title">开源</div>
|
||||
<p class="about-section-text">
|
||||
本项目在 GitHub 开源,遵循 MIT 许可证,欢迎 Star / Issue / PR。
|
||||
</p>
|
||||
<div class="about-link">
|
||||
<md-icon>code</md-icon>
|
||||
<span>YuleBest/FontMM</span>
|
||||
<a href="https://github.com/YuleBest/FontMM" target="_blank" rel="noopener noreferrer"
|
||||
>打开</a
|
||||
>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
|
||||
<md-elevated-card class="about-card">
|
||||
<div class="about-section-title">致谢</div>
|
||||
<p class="about-section-text">
|
||||
界面基于 Material Design 3(Material Web)构建,运行于 KernelSU WebUI; 开发工具链使用
|
||||
Oxc(oxlint / oxfmt)。感谢所有开源贡献者。
|
||||
</p>
|
||||
</md-elevated-card>
|
||||
|
||||
<div class="about-footer">FontMM · MIT License · ColorOS 16 字体模块</div>
|
||||
</div>
|
||||
|
||||
<!-- 悬浮应用按钮 (仅首页, 向下滚动时隐藏) -->
|
||||
<button id="apply-btn" class="fab" disabled aria-label="应用字体">
|
||||
<md-icon>check_circle</md-icon>
|
||||
<span>应用</span>
|
||||
</button>
|
||||
|
||||
<!-- 日志弹窗 -->
|
||||
<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">text_fields</md-icon>
|
||||
<md-icon slot="inactive-icon">text_fields</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,187 @@
|
||||
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 列出目录与文件: 每行一个完整路径, 目录/文件分两次查询
|
||||
// (兼容 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`),
|
||||
exec(`find "${path}" -maxdepth 1 -mindepth 1 -type f`),
|
||||
]);
|
||||
|
||||
if (dirRes.errno !== 0 || fileRes.errno !== 0) {
|
||||
return { items: [], failed: true };
|
||||
}
|
||||
|
||||
const dirs = this.splitLines(dirRes.stdout).map((p) => this.basename(p));
|
||||
const files = this.splitLines(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 };
|
||||
}
|
||||
|
||||
private splitLines(output: string): string[] {
|
||||
return output
|
||||
.split('\n')
|
||||
.map((line) => line.trim())
|
||||
.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();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
import {
|
||||
exec as ksuExec,
|
||||
toast as ksuToast,
|
||||
moduleInfo as ksuModuleInfo,
|
||||
fullScreen as ksuFullScreen,
|
||||
enableEdgeToEdge as ksuEnableEdgeToEdge,
|
||||
} 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'],
|
||||
files: ['a.pdf'],
|
||||
},
|
||||
'/storage/emulated/0/Fonts': {
|
||||
dirs: [],
|
||||
fonts: ['OPPOSans.ttf', 'SourceHanSansCN.ttf'],
|
||||
files: [],
|
||||
},
|
||||
'/storage/emulated/0/Documents': { dirs: [], fonts: [], files: [] },
|
||||
'/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), 返回假目录/文件, 每行一个完整路径
|
||||
if (command.startsWith('find ')) {
|
||||
const m = command.match(/^find ['"]([^'"]*)['"] -maxdepth 1 -mindepth 1 -type ([df])$/);
|
||||
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('\n'));
|
||||
}
|
||||
|
||||
// 字体测试: 模拟 FONT 字体已放入 webroot/fonts-test, 返回可用字体列表
|
||||
if (command.includes('fonts-test')) {
|
||||
return slow('hans.ttf\nhant.ttf\nen.ttf\nmono.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[*] 全部完成, 重启后生效 (模拟)');
|
||||
}
|
||||
|
||||
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);
|
||||
return ksuExec(command);
|
||||
}
|
||||
|
||||
export function toast(msg: string): void {
|
||||
if (import.meta.env.DEV) console.log('[toast]', msg);
|
||||
else ksuToast(msg);
|
||||
}
|
||||
|
||||
// 模块信息 (module.prop 风格文本), dev 模式返回模拟数据
|
||||
export function moduleInfo(): string {
|
||||
if (import.meta.env.DEV) {
|
||||
return [
|
||||
'id=FontMM',
|
||||
'name=FontMM',
|
||||
'version=26.8.0(260800001)',
|
||||
'versionCode=26080001',
|
||||
'author=Yule',
|
||||
'description=ColorOS 16 字体模块模板',
|
||||
].join('\n');
|
||||
}
|
||||
return ksuModuleInfo();
|
||||
}
|
||||
|
||||
// 全屏: 让 WebView 内容延伸到状态栏 / 底部导航栏(小白条) 下方
|
||||
export function fullScreen(enabled: boolean): void {
|
||||
if (import.meta.env.DEV) return;
|
||||
ksuFullScreen(enabled);
|
||||
}
|
||||
|
||||
// edge-to-edge: 启用安全区 insets (配合 insets.css 的 --window-inset-* 变量)
|
||||
export function enableEdgeToEdge(enabled: boolean): void {
|
||||
if (import.meta.env.DEV) return;
|
||||
ksuEnableEdgeToEdge(enabled);
|
||||
}
|
||||
+539
@@ -0,0 +1,539 @@
|
||||
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/dialog/dialog.js';
|
||||
import '@material/web/slider/slider.js';
|
||||
import '@material/web/labs/card/elevated-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 { exec, enableEdgeToEdge, moduleInfo, toast } from './ksu';
|
||||
import { FontFilePicker } from './fontPicker';
|
||||
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', 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: '',
|
||||
},
|
||||
};
|
||||
|
||||
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 }> {
|
||||
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 };
|
||||
} 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;
|
||||
renderSlots();
|
||||
} catch {
|
||||
// 忽略解析失败, 保持选择器返回的文件名
|
||||
}
|
||||
}
|
||||
|
||||
// 打开 WebUI 时: 复制 FONT/ 到 fonts-test, 读取已有字体的名称/大小填充卡片
|
||||
async function loadExistingFonts() {
|
||||
const available = await ensureFontsCopy();
|
||||
for (const key of ['hans', 'hant', 'en', 'mono'] 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;
|
||||
}
|
||||
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 '未选择,保持系统等宽字体';
|
||||
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);
|
||||
return `
|
||||
<md-elevated-card class="slot-card ${slot.key === 'hans' ? 'slot-hans' : ''} ${slot.path ? 'selected' : ''}">
|
||||
<div class="slot-header">
|
||||
<div class="slot-title-group">
|
||||
<span class="slot-title">${slot.title}</span>
|
||||
</div>
|
||||
<div class="slot-actions">
|
||||
<md-outlined-button class="slot-pick" data-key="${slot.key}">
|
||||
<md-icon slot="icon">folder_open</md-icon>
|
||||
${slot.path ? '更换' : '选择'}
|
||||
</md-outlined-button>
|
||||
</div>
|
||||
</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">${slot.sizeText || '…'} · 字体文件</div>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</md-elevated-card>
|
||||
`;
|
||||
})
|
||||
.join('');
|
||||
|
||||
// 绑定事件
|
||||
slotsEl.querySelectorAll<HTMLElement>('.slot-pick').forEach((btn) => {
|
||||
btn.addEventListener('click', () => {
|
||||
pickingKey = btn.dataset.key as keyof typeof slots;
|
||||
picker.show();
|
||||
});
|
||||
});
|
||||
slotsEl.querySelectorAll<HTMLElement>('.slot-clear').forEach((btn) => {
|
||||
btn.addEventListener('click', () => {
|
||||
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'`);
|
||||
}
|
||||
|
||||
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('字体已应用,重启后生效');
|
||||
} catch (e) {
|
||||
toast(`应用失败: ${String(e)}`);
|
||||
} finally {
|
||||
applying = false;
|
||||
renderSlots();
|
||||
}
|
||||
}
|
||||
|
||||
applyBtn?.addEventListener('click', apply);
|
||||
renderSlots();
|
||||
|
||||
// ---------------- 导航与视图切换 ----------------
|
||||
const homeView = document.getElementById('home-view')!;
|
||||
const testView = document.getElementById('test-view')!;
|
||||
const aboutView = document.getElementById('about-view')!;
|
||||
|
||||
const views = [homeView, testView, aboutView];
|
||||
const navBar = document.getElementById('nav-bar') as any;
|
||||
// 悬浮应用按钮 (与首页绑定, 仅首页显示)
|
||||
const applyFab = document.getElementById('apply-btn') as HTMLElement;
|
||||
|
||||
function showView(index: number) {
|
||||
views.forEach((v, i) => v.classList.toggle('active', i === index));
|
||||
// 悬浮应用按钮仅首页显示, 且未选简体字体时不展示
|
||||
applyFab.style.display = index === 0 && slots.hans.path ? '' : 'none';
|
||||
// 关于页隐藏顶栏 (自身带返回栏)
|
||||
document.body.classList.toggle('no-top-bar', index === 2);
|
||||
// 同步底部导航高亮 (仅首页/字体测试两个 tab)
|
||||
if (index < 2 && navBar) navBar.activeIndex = index;
|
||||
if (index === 1) loadTestFonts();
|
||||
if (index === 2) loadAbout();
|
||||
}
|
||||
|
||||
// 悬浮按钮滚动隐藏: 向下滚动移出视口, 向上滚动出现
|
||||
let lastScrollY = window.scrollY;
|
||||
window.addEventListener(
|
||||
'scroll',
|
||||
() => {
|
||||
const y = window.scrollY;
|
||||
if (y > lastScrollY + 4) applyFab.classList.add('fab-hidden');
|
||||
else if (y < lastScrollY - 4) applyFab.classList.remove('fab-hidden');
|
||||
lastScrollY = y;
|
||||
},
|
||||
{ passive: true },
|
||||
);
|
||||
|
||||
navBar?.addEventListener('navigation-bar-activated', (e: { detail: { activeIndex: number } }) => {
|
||||
showView(e.detail.activeIndex);
|
||||
});
|
||||
|
||||
// 关于入口: 顶栏按钮进入, 关于页返回栏回首页
|
||||
document.getElementById('about-btn')?.addEventListener('click', () => showView(2));
|
||||
document.getElementById('about-back')?.addEventListener('click', () => showView(0));
|
||||
|
||||
// ---------------- 关于页 ----------------
|
||||
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;
|
||||
}
|
||||
|
||||
async function loadAbout() {
|
||||
let prop: ModuleProp = {};
|
||||
|
||||
// 1) 优先从 kernelsu WebUI API 获取模块信息
|
||||
try {
|
||||
prop = { ...prop, ...parseProp(moduleInfo()) };
|
||||
} catch {
|
||||
// dev 或 API 不可用时忽略, 走下方兜底
|
||||
}
|
||||
|
||||
// 2) 兜底: 通过 kernelsu exec 读取模块的 module.prop
|
||||
try {
|
||||
const { errno, stdout } = await exec('cat /data/adb/modules/FontMM/module.prop');
|
||||
if (errno === 0) prop = { ...prop, ...parseProp(stdout) };
|
||||
} catch {
|
||||
// 忽略读取失败
|
||||
}
|
||||
|
||||
const set = (id: string, value: string) => {
|
||||
const el = document.getElementById(id);
|
||||
if (el) el.textContent = value;
|
||||
};
|
||||
set('about-version', prop.version || '未知');
|
||||
set('about-version-code', prop.versionCode || '未知');
|
||||
set('about-author', prop.author || '未知');
|
||||
set('about-id', prop.id || 'FontMM');
|
||||
set('about-desc', prop.description || 'ColorOS 16 字体模块');
|
||||
}
|
||||
|
||||
// ---------------- 字体测试页 ----------------
|
||||
const WEBROOT_DIR = '/data/adb/modules/FontMM/webroot';
|
||||
const TEST_FONT_DIR = `${WEBROOT_DIR}/fonts-test`;
|
||||
|
||||
const testStatus = document.getElementById('test-status')!;
|
||||
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 [];
|
||||
}
|
||||
}
|
||||
|
||||
async function loadTestFonts(): Promise<void> {
|
||||
testStatus.hidden = false;
|
||||
testContent.hidden = true;
|
||||
testStatus.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); // 与滑条初始值保持一致
|
||||
|
||||
testStatus.textContent =
|
||||
available.length === 0
|
||||
? '未找到已设置的字体 (FONTS 为空), 当前使用系统字体预览'
|
||||
: '字体已加载, 下方为预览效果 (按 fallback 逻辑)';
|
||||
testContent.hidden = false;
|
||||
}
|
||||
|
||||
// 可变字体滑动条: 滑动中只更新数值显示, 停止 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,571 @@
|
||||
@use './theme.scss';
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
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 {
|
||||
// 随页面滚动 (非 fixed)
|
||||
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 {
|
||||
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);
|
||||
}
|
||||
|
||||
.top-app-bar__actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
// 关于页隐藏顶栏 (自身带返回栏), 内容区相应缩减顶部留白
|
||||
body.no-top-bar {
|
||||
.top-app-bar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.view-about {
|
||||
padding-top: calc(var(--top-inset, 0px) + 16px);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 2. 视图容器 ----------------
|
||||
.view {
|
||||
display: none;
|
||||
|
||||
&.active {
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
|
||||
.view-home,
|
||||
.view-test,
|
||||
.view-about {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
// 顶栏已在文档流中占位, 顶部仅留少量呼吸间距;
|
||||
// 底部预留导航栏 + 吸底 CTA, 确保最后一张卡片能完整滑出不被遮挡
|
||||
padding: 16px 16px calc(var(--bottom-inset, 0px) + 176px) 16px;
|
||||
}
|
||||
|
||||
#slots {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
// ---------------- 3. 首页槽位卡片 ----------------
|
||||
md-elevated-card.slot-card {
|
||||
display: block;
|
||||
padding: 16px;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
transition:
|
||||
border-color var(--md-duration-standard) var(--md-easing-standard),
|
||||
border-width var(--md-duration-standard) var(--md-easing-standard);
|
||||
--md-elevated-card-container-color: var(--md-sys-color-surface-container-low);
|
||||
--md-elevated-card-container-shape: var(--md-shape-corner-medium);
|
||||
--md-elevated-card-container-elevation: 1;
|
||||
|
||||
// 已选择状态: 仅通过边框高亮区分 (不再使用 Badge / 图标)
|
||||
&.selected {
|
||||
border-color: var(--md-sys-color-primary);
|
||||
border-width: 1.5px;
|
||||
}
|
||||
|
||||
// 中文简体为必选: 边框恒用强调色 (tertiary)
|
||||
&.slot-hans {
|
||||
border-color: var(--md-sys-color-tertiary);
|
||||
border-width: 1.5px;
|
||||
}
|
||||
|
||||
.slot-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
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-actions {
|
||||
flex-shrink: 0;
|
||||
|
||||
md-outlined-button {
|
||||
--md-outlined-button-container-shape: var(--md-shape-corner-small);
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 取消 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 {
|
||||
margin-top: 2px;
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-outline);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 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. 通用信息卡片 (关于 / 测试共用) ----------------
|
||||
.about-card,
|
||||
.test-card {
|
||||
display: block;
|
||||
padding: 20px;
|
||||
border: 1px solid var(--md-sys-color-outline-variant);
|
||||
--md-elevated-card-container-color: var(--md-sys-color-surface-container-low);
|
||||
--md-elevated-card-container-shape: var(--md-shape-corner-medium);
|
||||
}
|
||||
|
||||
// ---------------- 8. 关于视图 ----------------
|
||||
.view-topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
|
||||
.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);
|
||||
}
|
||||
}
|
||||
|
||||
.view-about {
|
||||
gap: 16px;
|
||||
|
||||
&.active {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.about-logo {
|
||||
font-size: var(--md-sys-typescale-title-large-size);
|
||||
font-weight: 700;
|
||||
letter-spacing: -0.02em;
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.about-desc {
|
||||
margin-top: 4px;
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.about-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
margin-top: 16px;
|
||||
|
||||
.about-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
|
||||
.about-row-label {
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.about-row-value {
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
font-weight: 600;
|
||||
color: var(--md-sys-color-on-surface);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.about-section-title {
|
||||
margin-bottom: 8px;
|
||||
font-size: var(--md-sys-typescale-title-small-size);
|
||||
font-weight: var(--md-sys-typescale-title-small-weight);
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
.about-section-text {
|
||||
margin: 0 0 12px 0;
|
||||
font-size: var(--md-sys-typescale-body-small-size);
|
||||
line-height: 1.6;
|
||||
color: var(--md-sys-color-on-surface-variant);
|
||||
}
|
||||
|
||||
.about-link {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
padding: 10px 12px;
|
||||
border-radius: var(--md-shape-corner-medium);
|
||||
background: var(--md-sys-color-surface-container-low);
|
||||
font-size: var(--md-sys-typescale-body-medium-size);
|
||||
color: var(--md-sys-color-on-surface);
|
||||
|
||||
md-icon {
|
||||
color: var(--md-sys-color-primary);
|
||||
}
|
||||
|
||||
a {
|
||||
margin-left: auto;
|
||||
color: var(--md-sys-color-primary);
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
}
|
||||
}
|
||||
|
||||
.about-footer {
|
||||
margin-top: 4px;
|
||||
text-align: center;
|
||||
font-size: var(--md-sys-typescale-label-small-size);
|
||||
color: var(--md-sys-color-outline);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------- 9. 字体测试视图 ----------------
|
||||
.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;
|
||||
border-bottom: 1px dashed var(--md-sys-color-outline-variant);
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.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: nowrap;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.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: 12px;
|
||||
--md-shape-corner-large: 16px;
|
||||
--md-shape-corner-extra-large: 28px;
|
||||
--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,8 @@
|
||||
export interface FontSlot {
|
||||
key: 'hans' | 'hant' | 'en' | 'mono';
|
||||
title: string;
|
||||
path: string | null;
|
||||
fileName: string;
|
||||
/** 字体大小展示文本 (如 "12.5 MB"), 异步获取 */
|
||||
sizeText?: string;
|
||||
}
|
||||
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,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