Created
June 2, 2011 20:41
-
-
Save nkmrgk/1005269 to your computer and use it in GitHub Desktop.
Ricty generator for Windows
This file contains hidden or 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
Print("Generate modified Inconsolata") | |
# open | |
Print("Open ./Inconsolata.otf") | |
Open("Inconsolata.otf") | |
# scale | |
ScaleToEm(860, 140) | |
# remove ambiguous | |
Select(0u00a2); Clear() # cent | |
Select(0u00a3); Clear() # pound | |
Select(0u00a4); Clear() # currency | |
Select(0u00a5); Clear() # yen | |
Select(0u00a7); Clear() # section | |
Select(0u00a8); Clear() # dieresis | |
Select(0u00ac); Clear() # not | |
Select(0u00ad); Clear() # soft hyphen | |
Select(0u00b0); Clear() # degree | |
Select(0u00b1); Clear() # plus-minus | |
Select(0u00b4); Clear() # acute | |
Select(0u00b6); Clear() # pilcrow | |
Select(0u00d7); Clear() # multiply | |
Select(0u00f7); Clear() # divide | |
Select(0u2018); Clear() # left ' | |
Select(0u2019); Clear() # right ' | |
Select(0u201c); Clear() # left " | |
Select(0u201d); Clear() # right " | |
Select(0u2020); Clear() # dagger | |
Select(0u2021); Clear() # double dagger | |
Select(0u2026); Clear() # ... | |
Select(0u2122); Clear() # TM | |
Select(0u2191); Clear() # uparrow | |
Select(0u2193); Clear() # downarrow | |
Select(0u2212); Clear() # minus | |
Select(0u2423); Clear() # open box | |
# save regular | |
Save("Modified-Inconsolata-Regular.sfd") | |
Print("Generated Modified-Inconsolata-Regular.sfd") | |
# bold-face regular | |
Print("While bold-facing Inconsolata, wait a bit, maybe a bit...") | |
SelectWorthOutputting() | |
ClearInstrs(); UnlinkReference() | |
ExpandStroke(30, 0, 0, 0, 1) | |
Select(0u003e); Copy() # > | |
Select(0u003c); Paste(); HFlip() # < | |
RemoveOverlap(); RoundToInt() | |
# save bold | |
Save("Modified-Inconsolata-Bold.sfd") | |
Print("Generated Modified-Inconsolata-Bold.sfd") | |
Close() | |
Quit() |
This file contains hidden or 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
Print("Generate modified Migu 1M") | |
# parameters | |
input_list = ["Migu-1M-regular.ttf", "Migu-1M-bold.ttf"] | |
output_list = ["Modified-Migu-1M-regular.sfd", "Modified-Migu-1M-bold.sfd"] | |
i = 0; | |
Print("Open " + input_list[i]) | |
Open(input_list[i]) | |
Print("While scaling " + input_list[i]:t + ", wait a little...") | |
ScaleToEm(860, 140) | |
SelectWorthOutputting() | |
SetWidth(-1, 1); Scale(91, 91, 0, 0); SetWidth(110, 2); SetWidth(1, 1) | |
Move(23, 0); SetWidth(-23, 1) | |
RemoveOverlap(); RoundToInt() | |
Save(output_list[i]) | |
Print("Generated " + output_list[i]) | |
Close() | |
i += 1; | |
Print("Open " + input_list[i]) | |
Open(input_list[i]) | |
Print("While scaling " + input_list[i]:t + ", wait a little...") | |
ScaleToEm(860, 140) | |
SelectWorthOutputting() | |
SetWidth(-1, 1); Scale(91, 91, 0, 0); SetWidth(110, 2); SetWidth(1, 1) | |
Move(23, 0); SetWidth(-23, 1) | |
RemoveOverlap(); RoundToInt() | |
Save(output_list[i]) | |
Print("Generated " + output_list[i]) | |
Close() | |
Quit() |
This file contains hidden or 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
@echo OFF | |
set FF=%~dp0 | |
set PATH=%FF%\bin;%FF%\bin\Xming-6.9.0.31;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\system32\Wbem | |
set DISPLAY=127.0.0.1:9.0 | |
set XLOCALEDIR=%FF%\bin\Xming-6.9.0.31\locale | |
set AUTOTRACE=potrace | |
set HOME=%FF% | |
if EXIST "%FF%\bin\Xming-6.9.0.31\fonts\TTF" ( | |
if NOT EXIST "%FF%\bin\Xming-6.9.0.31\fonts\TTF\msgothic.ttc" ( | |
if EXIST "%SystemRoot%\Fonts\msgothic.ttc" ( | |
copy /Y /B "%SystemRoot%\Fonts\msgothic.ttc" "%FF%\bin\Xming-6.9.0.31\fonts\TTF\msgothic.ttc" | |
) else ( | |
rmdir /S /Q "%FF%\bin\Xming-6.9.0.31\fonts\TTF" | |
) | |
) | |
) | |
start /B "" "%FF%\bin\Xming-6.9.0.31\Xming.exe" :9 -multiwindow -clipboard -ac -silent-dup-error | |
"%FF%\bin\Xming_close.exe" -wait | |
"%FF%\bin\fontforge.exe" -script modified_inconsolata_generator.pe | |
"%FF%\bin\fontforge.exe" -script modified_migu1m_generator.pe | |
"%FF%\bin\fontforge.exe" -script ricty_generator.pe | |
if exist ricty_discord_patch.pe ( | |
"%FF%\bin\fontforge.exe" -script ricty_discord_patch.pe Ricty-Regular.ttf | |
"%FF%\bin\fontforge.exe" -script ricty_discord_patch.pe Ricty-Bold.ttf | |
) | |
"%FF%\bin\Xming_close.exe" -close |
This file contains hidden or 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
Print("Generate Ricty") | |
# parameters | |
inconsolata_list = ["Modified-Inconsolata-Regular.sfd", \ | |
"Modified-Inconsolata-Bold.sfd"] | |
migu1m_list = ["Modified-Migu-1M-regular.sfd", \ | |
"Modified-Migu-1M-bold.sfd"] | |
fontfamily = "Ricty" | |
fontstyle_list = ["Regular", "Bold"] | |
fontweight_list = [400, 700] | |
copyright = "Ricty Generator Author: Yasunori Yusa\n" \ | |
+ "Copyright (c) 2006-2011 Raph Levien\n" \ | |
+ "Copyright (c) 2006-2011 itouhiro\n" \ | |
+ "Copyright (c) 2002-2011 M+ FONTS PROJECT\n" \ | |
+ "Copyright (c) 2003-2011 " \ | |
+ "Information-technology Promotion Agency, Japan (IPA)\n" \ | |
+ "Licenses:\n" \ | |
+ "SIL Open Font License Version 1.1 " \ | |
+ "(http://scripts.sil.org/OFL)\n" \ | |
+ "M+ FONTS LICENSE " \ | |
+ "(http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/#license)\n" \ | |
+ "IPA Font License Agreement v1.0 " \ | |
+ "(http://ipafont.ipa.go.jp/ipa_font_license_v1.html)" | |
version = "3.0.2" | |
# regular and bold loop | |
i = 0; | |
# new file | |
New() | |
# set encoding to Unicode-bmp | |
Reencode("unicode") | |
# set configs | |
SetFontNames(fontfamily + "-" + fontstyle_list[i], \ | |
fontfamily, \ | |
fontfamily + " " + fontstyle_list[i], \ | |
fontstyle_list[i], \ | |
copyright, version) | |
ScaleToEm(860, 140) | |
SetOS2Value("Weight", fontweight_list[i]) # Book or Bold | |
SetOS2Value("Width", 5) # Medium | |
SetOS2Value("FSType", 0) | |
SetOS2Value("VendorID", "PfEd") | |
SetOS2Value("IBMFamily", 2057) # SS Typewriter Gothic | |
SetOS2Value("WinAscent", 800) | |
SetOS2Value("WinDescent", 215) | |
SetOS2Value("TypoAscent", 860) | |
SetOS2Value("TypoDescent", -140) | |
SetOS2Value("TypoLineGap", 0) | |
SetOS2Value("HHeadAscent", 800) | |
SetOS2Value("HHeadDescent", -215) | |
SetOS2Value("HHeadLineGap", 0) | |
SetOS2Value("WinAscentIsOffset", 0) | |
SetOS2Value("WinDescentIsOffset", 0) | |
SetOS2Value("TypoAscentIsOffset", 0) | |
SetOS2Value("TypoDescentIsOffset", 0) | |
SetOS2Value("HHeadAscentIsOffset", 0) | |
SetOS2Value("HHeadDescentIsOffset", 0) | |
SetPanose(3, 9) # Monospaced | |
# merge fonts | |
Print("While merging " + inconsolata_list[i]:t \ | |
+ " and " +migu1m_list[i]:t + ", wait a little more...") | |
MergeFonts(inconsolata_list[i]) | |
MergeFonts(migu1m_list[i]) | |
# edit zenkaku space (from ballot box and heavy greek cross) | |
Select(0u2610); Copy(); Select(0u3000); Paste() | |
Select(0u271a); Copy(); Select(0u3000); PasteInto(); OverlapIntersect() | |
# edit zenkaku comma and period | |
Select(0uff0c); Scale(150, 150, 100, 0); SetWidth(1000) | |
Select(0uff0e); Scale(150, 150, 100, 0); SetWidth(1000) | |
# edit zenkaku colon and semicolon | |
Select(0uff0c); Copy(); Select(0uff1b); Paste() | |
Select(0uff0e); Copy(); Select(0uff1b); PasteWithOffset(0, 400) | |
CenterInWidth() | |
Select(0uff1a); Paste(); PasteWithOffset(0, 400) | |
CenterInWidth() | |
# edit en dash | |
Select(0u2013); Copy() | |
PasteWithOffset(200, 0); PasteWithOffset(-200, 0); OverlapIntersect() | |
# edit em dash and horizontal bar | |
Select(0u2014); Copy() | |
PasteWithOffset(620, 0); PasteWithOffset(-620, 0) | |
Select(0u2010); Copy() | |
Select(0u2014); PasteInto() | |
OverlapIntersect() | |
Copy(); Select(0u2015); Paste() | |
# post proccess | |
SelectWorthOutputting(); RemoveOverlap(); RoundToInt() | |
# generate | |
Generate(fontfamily + "-" + fontstyle_list[i] + ".ttf", "", 0x84) | |
Print("Generated " + fontfamily + "-" + fontstyle_list[i] + ".ttf") | |
Close() | |
i += 1; | |
# new file | |
New() | |
# set encoding to Unicode-bmp | |
Reencode("unicode") | |
# set configs | |
SetFontNames(fontfamily + "-" + fontstyle_list[i], \ | |
fontfamily, \ | |
fontfamily + " " + fontstyle_list[i], \ | |
fontstyle_list[i], \ | |
copyright, version) | |
ScaleToEm(860, 140) | |
SetOS2Value("Weight", fontweight_list[i]) # Book or Bold | |
SetOS2Value("Width", 5) # Medium | |
SetOS2Value("FSType", 0) | |
SetOS2Value("VendorID", "PfEd") | |
SetOS2Value("IBMFamily", 2057) # SS Typewriter Gothic | |
SetOS2Value("WinAscent", 800) | |
SetOS2Value("WinDescent", 215) | |
SetOS2Value("TypoAscent", 860) | |
SetOS2Value("TypoDescent", -140) | |
SetOS2Value("TypoLineGap", 0) | |
SetOS2Value("HHeadAscent", 800) | |
SetOS2Value("HHeadDescent", -215) | |
SetOS2Value("HHeadLineGap", 0) | |
SetOS2Value("WinAscentIsOffset", 0) | |
SetOS2Value("WinDescentIsOffset", 0) | |
SetOS2Value("TypoAscentIsOffset", 0) | |
SetOS2Value("TypoDescentIsOffset", 0) | |
SetOS2Value("HHeadAscentIsOffset", 0) | |
SetOS2Value("HHeadDescentIsOffset", 0) | |
SetPanose(3, 9) # Monospaced | |
# merge fonts | |
Print("While merging " + inconsolata_list[i]:t \ | |
+ " and " +migu1m_list[i]:t + ", wait a little more...") | |
MergeFonts(inconsolata_list[i]) | |
MergeFonts(migu1m_list[i]) | |
# edit zenkaku space (from ballot box and heavy greek cross) | |
Select(0u2610); Copy(); Select(0u3000); Paste() | |
Select(0u271a); Copy(); Select(0u3000); PasteInto(); OverlapIntersect() | |
# edit zenkaku comma and period | |
Select(0uff0c); Scale(150, 150, 100, 0); SetWidth(1000) | |
Select(0uff0e); Scale(150, 150, 100, 0); SetWidth(1000) | |
# edit zenkaku colon and semicolon | |
Select(0uff0c); Copy(); Select(0uff1b); Paste() | |
Select(0uff0e); Copy(); Select(0uff1b); PasteWithOffset(0, 400) | |
CenterInWidth() | |
Select(0uff1a); Paste(); PasteWithOffset(0, 400) | |
CenterInWidth() | |
# edit en dash | |
Select(0u2013); Copy() | |
PasteWithOffset(200, 0); PasteWithOffset(-200, 0); OverlapIntersect() | |
# edit em dash and horizontal bar | |
Select(0u2014); Copy() | |
PasteWithOffset(620, 0); PasteWithOffset(-620, 0) | |
Select(0u2010); Copy() | |
Select(0u2014); PasteInto() | |
OverlapIntersect() | |
Copy(); Select(0u2015); Paste() | |
# post proccess | |
SelectWorthOutputting(); RemoveOverlap(); RoundToInt() | |
# generate | |
Generate(fontfamily + "-" + fontstyle_list[i] + ".ttf", "", 0x84) | |
Print("Generated " + fontfamily + "-" + fontstyle_list[i] + ".ttf") | |
Close() | |
Quit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment