為什麼要學這個?
透過 FontForge 開啟,並另存專案為資料夾格式(.sfdir),除了手動去操作之外,也可以使用腳本來做。如果透過指令來做會更有效率的話,當然要使用指令來做。
實作步驟
使用前,需要先安裝FontForge,透過執行FontForge的腳本(Script)可以在指令行的模式下,合併2個字體檔案。
FontForge執行檔下載:
https://fontforge.org/en-US/
Max腳本檔案,轉成FontForge (all font format to .sfdir)下載:
https://github.com/max32002/MaxFontScripts/blob/master/save_as.py
Max腳本檔案,轉成字體檔 (all font format to .ttf/.otf/.svg/.woff/.woff2)下載:
https://github.com/max32002/MaxFontScripts/blob/master/generate.py
使用範例
把 source.ttf 轉換為 target.sfdir
fontforge save_as.py --input source.ttf --output target.sfdir
![](https://codereview.max-everyday.com/wp-content/uploads/2020/08/Screen-Shot-2020-08-03-at-00.23.53-1024x1024.png?v=1596385479)
MaxCodeReview 影片
Youtube:https://youtu.be/9-0WHjjfOgU