Files
FontMM/功能/TTC文件拆分.sh
T
YuleBest d8a70b93ad feat(ttc_splitter): 新增 TTC 拆分功能
TTC 是一种字体集合格式,它将多个相关的 TTF(TrueType)字体打包进同一个文件
2026-02-04 13:43:18 +08:00

41 lines
825 B
Bash

#!/bin/bash
# FontMM
# TTC 文件拆分
# By Yule
# shellcheck disable=SC2154
# 配置
SCRIPT_DIR="$(dirname "$(dirname "$(readlink -f "$0")")")"
WORK_DIR="$SCRIPT_DIR/WORK"
export PATH="$PATH:$SCRIPT_DIR/功能/bin"
clear
# 环境检查
if ! command -v yq >/dev/null 2>&1; then
echo -e "${re}[错误] 缺少 yq,请安装后重试${res}"
exit 1
fi
mkdir -p "$WORK_DIR/ttc_separated"
echo -en "- 输入一个 TTC 文件完整路径:"
read -r ttc_file
if [ ! -f "$ttc_file" ]; then
echo "! $ttc_file 文件不存在"
exit 1
fi
if ! file "$ttc_file" | grep -q "TrueType font collection"; then
echo "! 这不是一个 TTC 文件"
exit 2
fi
if ttc_splitter "$ttc_file" -o "$WORK_DIR/ttc_separated"; then
echo "~ 拆分成功"
exit 0
else
echo "! 有文件拆分失败"
exit 3
fi