Skip to content

Instantly share code, notes, and snippets.

@synctam
Last active June 2, 2024 06:42
Show Gist options
  • Save synctam/485573ce8a963a63e45f25a4bdfb9917 to your computer and use it in GitHub Desktop.
Save synctam/485573ce8a963a63e45f25a4bdfb9917 to your computer and use it in GitHub Desktop.
FontForge用フォント高調整サンプルスクリプト
#!/usr/bin/fontforge
width=50
Open("mplus-2p-regular");
#---------------------------------------------
Print("RemoveOverlap")
SelectWorthOutputting() # すべてのグリフを選択する
RoundToInt() # 整数に丸める。
RemoveOverlap() # パスの交差を除去する。
RoundToInt() # RemoveOverlap() が新しい点を作るのでもう一度丸める。
#---------------------------------------------
#Print("ExpandStroke")
SelectWorthOutputting()
#ClearInstrs() # ヒント命令を削除
#UnlinkReference() # 参照を解除
#ExpandStroke(width,0,0,0,1) # 輪郭を太らせる
Simplify() # 単純化
Simplify() # 単純化
#---------------------------------------------
SetOS2Value("WinAscentIsOffset" , 0)
SetOS2Value("WinDescentIsOffset" , 0)
SetOS2Value("HHeadAscentIsOffset" , 0)
SetOS2Value("HHeadDescentIsOffset", 0)
SetOS2Value("WinAscent" , 981)
SetOS2Value("WinDescent" , 223)
SetOS2Value("HHeadAscent" , 981)
SetOS2Value("HHeadDescent", -223)
SetOS2Value("HHeadLineGap", 90)
Simplify() # 単純化
Simplify() # 単純化
#---------------------------------------------
Print("CorrectDirection")
SelectWorthOutputting()
CorrectDirection() # アウトラインの向きを修正
Print("Write TTF")
Generate("mplus-2p-regular_001.ttf","",0x84) #
#---------------------------------------------
Close();
Quit(0);
# 1000 330 結構良い。でも、もう少し行間が狭い方が良い。
# 900 330 結構良い。でも、もうちょっとかな
# 800 330
# 981 223 meiryoに合わせてみた
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment