向量檔匯入字體檔

為什麼要學這個?

比起在FontForge 手動操作,改用指令自動完成,更有效率。


前置作業

使用前,需要先安裝FontForge,把要處理的字體先存成.sfdir 的資料夾格式。

FontForge執行檔下載:
https://fontforge.org/en-US/

Max腳本檔案下載:
https://github.com/max32002/MaxFontScripts/blob/master/import_svg.py


使用方法

import_svg.py --input your-project.sfdir --svg_path . --filename_pattern="%s.svg"

參數說明:

  • input: Font Forge 的 .sfdir 資料夾路徑。
  • filename_pattern: 檔名的規則
  • filename_source: 在檔名規則裡的變數來源,預設值是 char 。這個參數只接受4個值:[‘char’, ‘unicode_hex’, ‘unicode_int’],分別是字元,unicode 16進位值,unicode 10進位值.

附註:目前的作業系統們(Windows/Linux/Mac)對於新增不久的unicode 區段,是無法使用該區塊的文字編碼在檔案名稱中。


相關文章:

增加空白文字到字體檔
https://codereview.max-everyday.com/new-glyph/

以描摹方式建立或更新字型
https://codereview.max-everyday.com/create-new-font-by-draw/

dumping SVG outlines into a FontForge file
https://stackoverflow.max-everyday.com/2021/06/dumping-svg-outlines-into-a-fontforge-file/

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *