Last active
July 29, 2019 14:51
-
-
Save fdiary/693c045f183aac50aa7320440e7bff33 to your computer and use it in GitHub Desktop.
Fontforge script to generate a vertical font : all glyphs are rotated 90 degrees anticlockwise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/fontforge | |
# | |
# Original source code by nixeneko | |
# https://nixeneko.hatenadiary.org/entry/20100724/1279982449 | |
# | |
# Usage: | |
# fontforge -script generate_vertical_font.pe original_font.ttf | |
Open($1) | |
SelectWorthOutputting() | |
#縦書き字形に変更 | |
ApplySubstitution("*","*","vrt2") | |
ApplySubstitution("*","*","vert") | |
#グリフ幅が全角のものを左へ90度回転 | |
foreach | |
if (GlyphInfo('Width') == $em) | |
Rotate(90, $em/2, $em/2-$descent) | |
endif | |
endloop | |
#極大点の追加、座標値を整数に | |
AddExtrema() | |
RoundToInt() | |
#フォント名の先頭にVertをつける | |
SetFontNames("Vert-"+$fontname, $familyname, "Vert "+$fullname) | |
#カレントディレクトリに出力 | |
Generate("Vert-"+$1:t:r+".ttf") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Revision 2: rotate all glyphs having the same width as the height, instead of hardcoded code ranges.
Revision 3: remove copying U+ff5e (fullwidth tilde) to U+301c (wave dash), that is out of scope of this script.