File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 python-version : ' 3.x'
2727
2828 - name : Install fonttools
29- run : pip install fonttools brotli
29+ run : |
30+ pip install fonttools brotli
31+ # 验证安装
32+ python -m fontTools.subset --version || {
33+ echo "❌ fonttools 安装失败"
34+ exit 1
35+ }
36+ echo "✅ fonttools 安装成功"
3037
3138 - name : Install dependencies
3239 run : bun install
Original file line number Diff line number Diff line change @@ -87,7 +87,8 @@ function checkPyftsubset() {
8787 * 使用 pyftsubset 生成字体子集
8888 */
8989function generateFontSubset ( characters ) {
90- if ( ! checkPyftsubset ( ) ) {
90+ const pyftsubsetCmd = checkPyftsubset ( )
91+ if ( ! pyftsubsetCmd ) {
9192 console . error ( '❌ 错误: 未找到 pyftsubset 工具' )
9293 console . error ( '请安装: pip install fonttools brotli' )
9394 console . error ( '或使用: npm install -g pyftsubset' )
@@ -99,14 +100,15 @@ function generateFontSubset(characters) {
99100 const text = charArray . join ( '' )
100101
101102 console . log ( `📝 提取到 ${ charArray . length } 个唯一字符` )
103+ console . log ( `🔧 使用命令: ${ pyftsubsetCmd } ` )
102104
103105 // 确保输出目录存在
104106 if ( ! fs . existsSync ( fontsOutputDir ) ) {
105107 fs . mkdirSync ( fontsOutputDir , { recursive : true } )
106108 }
107109
108110 // 生成字体子集
109- const command = `pyftsubset "${ sourceFontPath } " \
111+ const command = `${ pyftsubsetCmd } "${ sourceFontPath } " \
110112 --text="${ text } " \
111113 --flavor=woff2 \
112114 --output-file="${ outputFontPath } " \
You can’t perform that action at this time.
0 commit comments