├── misc ├── print_ricty.c ├── os2version_reviser.sh ├── ricty_ascii_extractor.pe └── ricty_greek_regenerator.pe ├── README.md ├── ricty_discord_patch.pe └── ricty_generator.sh /misc/print_ricty.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | /** 5 | * プログラミング用フォント Ricty で C を書く 6 | * 7 | * - 環境は GNU Emacs 23 on Ubuntu 8 | * - Emacs のカラーテーマは Lethe (一部改変) 9 | * - 予約語、コメント、文字列などはボールドフェース 10 | */ 11 | int main(int argc, char *argv[]) 12 | { 13 | char ascii_letter; /* ASCII 文字 */ 14 | char unicode_letter[3]; /* ユニコード文字 */ 15 | int count = 0; /* 文字カウンタ */ 16 | 17 | /* 印字可能な区画の ASCII 文字 */ 18 | for (ascii_letter = ' '; 19 | ascii_letter <= '~'; 20 | ascii_letter++, count++) 21 | { 22 | if (count >= 40) { printf("\n"); count = 0; } /* 40 文字で改行 */ 23 | printf("%c", ascii_letter); 24 | } 25 | 26 | /* ひらがな全部 */ 27 | for (strcpy(unicode_letter, "ぁ"); 28 | strcmp(unicode_letter, "ん") <= 0; 29 | unicode_letter[2]++, count += 2) 30 | { 31 | if (unicode_letter[2] == -64) 32 | { 33 | unicode_letter[1]++; 34 | unicode_letter[2] = -128; 35 | } 36 | if (count >= 40) { printf("\n"); count = 0; } /* 40 文字で改行 */ 37 | printf("%s", unicode_letter); 38 | } 39 | 40 | /* Ricty で手を入れたグリフ */ 41 | printf(" ,.:;–―\n"); 42 | 43 | return 0; 44 | } 45 | -------------------------------------------------------------------------------- /misc/os2version_reviser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # OS/2 Version Reviser 5 | # 6 | # Author: Yasunori Yusa 7 | # 8 | # This script is for revising OS/2 Version of Ricty. 9 | # If the spaces between fullwidth charcters are unusually large, 10 | # you can use this script and revise it. 11 | # 12 | # How to use: 13 | # % sh os2version_reviser.sh Ricty-*.ttf RictyDiscord-*.ttf 14 | # 15 | 16 | # parameters 17 | fontforge_cmd="fontforge" 18 | os2_version="1" 19 | 20 | # usage 21 | if [ $# -eq 0 ] 22 | then 23 | echo "Usage: os2version_reviser.sh filename.ttf ..." 24 | exit 0 25 | fi 26 | 27 | # make tmp 28 | if [ -w "/tmp" ] 29 | then 30 | tmpdir=`mktemp -d /tmp/os2version_reviser_tmpdir.XXXXXX` 31 | else 32 | tmpdir=`mktemp -d ./os2version_reviser_tmpdir.XXXXXX` 33 | fi 34 | 35 | # remove tmp by trapping 36 | trap "if [ -d $tmpdir ]; then rm -rf $tmpdir; fi" EXIT HUP INT QUIT 37 | 38 | # args loop 39 | for filename in $@ 40 | do 41 | # generate scripts 42 | cat > ${tmpdir}/ttf2sfd.pe << _EOT_ 43 | #!$fontforge_cmd -script 44 | Open("${filename}") 45 | Save("${tmpdir}/tmpsfd.sfd") 46 | _EOT_ 47 | cat > ${tmpdir}/sfd2ttf.pe << _EOT_ 48 | #!$fontforge_cmd -script 49 | Open("${tmpdir}/tmpsfd2.sfd") 50 | Generate("${filename}", "", 0x84) 51 | _EOT_ 52 | # convert file 53 | $fontforge_cmd -script ${tmpdir}/ttf2sfd.pe 2> /dev/null 54 | sed -e "s/^OS2Version: .*$/OS2Version: ${os2_version}/" \ 55 | ${tmpdir}/tmpsfd.sfd > ${tmpdir}/tmpsfd2.sfd 56 | mv -f $filename $filename.bak 57 | $fontforge_cmd -script ${tmpdir}/sfd2ttf.pe 2> /dev/null 58 | done 59 | -------------------------------------------------------------------------------- /misc/ricty_ascii_extractor.pe: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/fontforge -script 2 | 3 | # 4 | # Ricty ASCII Extractor 5 | # 6 | # Author: Yasunori Yusa 7 | # 8 | # This script is for extracting ASCII charactors from Ricty. 9 | # If the window width of Cocoa Emacs is twice larger than you expect, 10 | # you can use this script and write configuration file as following. 11 | # 12 | # (set-face-attribute 'default nil 13 | # :family "Ricty Discord Ascii" 14 | # :height 140) 15 | # (set-fontset-font (frame-parameter nil 'font) 16 | # 'japanese-jisx0208 17 | # '("Ricty Discord" . "iso10646-1")) 18 | # 19 | # How to use: 20 | # % fontforge -script ricty_ascii_extractor.pe RictyDiscord-*.ttf 21 | # 22 | 23 | # check args 24 | if ($argc == 1) 25 | Print("Usage: ricty_ascii_extractor.pe fontfamily-fontstyle.ttf ...") 26 | Quit() 27 | endif 28 | 29 | # begin loop in args 30 | i = 1 31 | while (i < $argc) 32 | 33 | ######################################## 34 | # set vars 35 | ######################################## 36 | 37 | # get args 38 | input_ttf = $argv[i] 39 | input = input_ttf:t:r 40 | if (input_ttf:t:e != "ttf") 41 | Print("Usage: ricty_ascii_extractor.pe fontfamily-fontstyle.ttf") 42 | Quit() 43 | endif 44 | 45 | # get font names 46 | hyphen_idx = Strrstr(input, '-') 47 | if (hyphen_idx == -1) 48 | Print("Usage: ricty_ascii_extractor.pe fontfamily-fontstyle.ttf") 49 | Quit() 50 | endif 51 | inputfamily = Strsub(input, 0, hyphen_idx) 52 | inputstyle = Strsub(input, hyphen_idx+1) 53 | addfamily = "Ascii" 54 | 55 | ######################################## 56 | # open and set configs 57 | ######################################## 58 | 59 | # open 60 | Open(input_ttf) 61 | 62 | # set encoding to Unicode-bmp 63 | Reencode("unicode") 64 | 65 | # set configs 66 | SetFontNames(inputfamily + addfamily + "-" + inputstyle, \ 67 | $familyname + " " + addfamily, \ 68 | $familyname + " " + addfamily + " " + inputstyle, \ 69 | inputstyle) 70 | 71 | # i would like to remove these hard-coding lines... 72 | SetOS2Value("WinAscentIsOffset", 0) 73 | SetOS2Value("WinDescentIsOffset", 0) 74 | SetOS2Value("TypoAscentIsOffset", 0) 75 | SetOS2Value("TypoDescentIsOffset", 0) 76 | SetOS2Value("HHeadAscentIsOffset", 0) 77 | SetOS2Value("HHeadDescentIsOffset", 0) 78 | SetOS2Value("WinAscent", 815) 79 | SetOS2Value("WinDescent", 215) 80 | SetOS2Value("TypoAscent", 860) 81 | SetOS2Value("TypoDescent", -140) 82 | SetOS2Value("TypoLineGap", 0) 83 | SetOS2Value("HHeadAscent", 815) 84 | SetOS2Value("HHeadDescent", -215) 85 | 86 | ######################################## 87 | # remove except ascii glyphs 88 | ######################################## 89 | 90 | # set ascii glyphs list 91 | ascii_list = [ \ 92 | 0u0020, 0u0021, 0u0022, 0u0023, 0u0024, \ 93 | 0u0025, 0u0026, 0u0027, 0u0028, 0u0029, \ 94 | 0u002A, 0u002B, 0u002C, 0u002D, 0u002E, 0u002F, \ 95 | 0u0030, 0u0031, 0u0032, 0u0033, 0u0034, \ 96 | 0u0035, 0u0036, 0u0037, 0u0038, 0u0039, \ 97 | 0u003A, 0u003B, 0u003C, 0u003D, 0u003E, 0u003F, \ 98 | 0u0040, 0u0041, 0u0042, 0u0043, 0u0044, \ 99 | 0u0045, 0u0046, 0u0047, 0u0048, 0u0049, \ 100 | 0u004A, 0u004B, 0u004C, 0u004D, 0u004E, 0u004F, \ 101 | 0u0050, 0u0051, 0u0052, 0u0053, 0u0054, \ 102 | 0u0055, 0u0056, 0u0057, 0u0058, 0u0059, \ 103 | 0u005A, 0u005B, 0u005C, 0u005D, 0u005E, 0u005F, \ 104 | 0u0060, 0u0061, 0u0062, 0u0063, 0u0064, \ 105 | 0u0065, 0u0066, 0u0067, 0u0068, 0u0069, \ 106 | 0u006A, 0u006B, 0u006C, 0u006D, 0u006E, 0u006F, \ 107 | 0u0070, 0u0071, 0u0072, 0u0073, 0u0074, \ 108 | 0u0075, 0u0076, 0u0077, 0u0078, 0u0079, \ 109 | 0u007A, 0u007B, 0u007C, 0u007D, 0u007E ] 110 | 111 | # remove glyphs 112 | SelectNone() 113 | j = 0; while (j < SizeOf(ascii_list)) 114 | SelectMore(ascii_list[j]) 115 | j += 1; endloop 116 | SelectInvert() 117 | Clear() 118 | 119 | ######################################## 120 | # generate 121 | ######################################## 122 | 123 | Generate(inputfamily + addfamily + "-" + inputstyle + ".ttf", "", 0x84) 124 | Print("Generated " + inputfamily + addfamily + "-" + inputstyle + ".ttf") 125 | Close() 126 | 127 | # end loop 128 | i += 1; endloop 129 | Quit() 130 | -------------------------------------------------------------------------------- /misc/ricty_greek_regenerator.pe: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/fontforge -script 2 | 3 | # 4 | # Ricty Greek Re-generator 5 | # 6 | # Author: Yasunori Yusa 7 | # 8 | # This script is for regenerating glyphs of Greek with diacritics. 9 | # The re-generated glyphs are fullwidth. Owing to SIL 10 | # Open Font License Version 1.1 section 5, it is PROHIBITED to distribute 11 | # the generated font. 12 | # 13 | # How to use: 14 | # % fontforge -script ricty_greek_regenerator.pe Ricty-Regular.ttf Ricty-Bold.ttf 15 | # 16 | 17 | # check args 18 | if ($argc == 1) 19 | Print("Usage: ricty_greek_regenerator.pe fontfamily-fontstyle.ttf ...") 20 | Quit() 21 | endif 22 | 23 | # begin loop in args 24 | i = 1 25 | while (i < $argc) 26 | 27 | ######################################## 28 | # open file and set configuration 29 | ######################################## 30 | 31 | # open file 32 | Open($argv[i]) 33 | 34 | # set encoding to Unicode-bmp 35 | Reencode("unicode") 36 | 37 | ######################################## 38 | # edit some glyphs 39 | ######################################## 40 | 41 | # dialytika 42 | Select(0u00a8); SetWidth(1000); CenterInWidth() 43 | 44 | # tonos 45 | Select(0u0384); SetWidth(1000); CenterInWidth() 46 | 47 | # dialytika tonos 48 | Select(0u0385); SetWidth(1000); CenterInWidth() 49 | 50 | # Alpha with tonos 51 | Select(0u0391); Copy(); Select(0u0386); Paste() 52 | Select(0u0384); Copy(); Select(0u0386); PasteWithOffset(-250, 0) 53 | RemoveOverlap(); RoundToInt() 54 | 55 | # ano teleia 56 | Select(0u0387); SetWidth(1000); CenterInWidth() 57 | 58 | # Epsilon with tonos 59 | Select(0u0395); Copy(); Select(0u0388); Paste() 60 | Select(0u0384); Copy(); Select(0u0388); PasteWithOffset(-400, 0) 61 | RemoveOverlap(); RoundToInt() 62 | 63 | # Eta with tonos 64 | Select(0u0397); Copy(); Select(0u0389); Paste() 65 | Select(0u0384); Copy(); Select(0u0389); PasteWithOffset(-400, 0) 66 | RemoveOverlap(); RoundToInt() 67 | 68 | # Iota with tonos 69 | Select(0u0399); Copy(); Select(0u038a); Paste() 70 | Select(0u0384); Copy(); Select(0u038a); PasteWithOffset(-250, 0) 71 | RemoveOverlap(); RoundToInt() 72 | 73 | # Omicron with tonos 74 | Select(0u039f); Copy(); Select(0u038c); Paste() 75 | Select(0u0384); Copy(); Select(0u038c); PasteWithOffset(-350, 0) 76 | RemoveOverlap(); RoundToInt() 77 | 78 | # Upsilon with tonos 79 | Select(0u03a5); Copy(); Select(0u038e); Paste() 80 | Select(0u0384); Copy(); Select(0u038e); PasteWithOffset(-400, 0) 81 | RemoveOverlap(); RoundToInt() 82 | 83 | # Omega with tonos 84 | Select(0u03a9); Copy(); Select(0u038f); Paste() 85 | Select(0u0384); Copy(); Select(0u038f); PasteWithOffset(-350, 0) 86 | RemoveOverlap(); RoundToInt() 87 | 88 | # iota with dialytika and tonos 89 | Select(0u03b9); Copy(); Select(0u0390); Paste() 90 | Select(0u0385); Copy(); Select(0u0390); PasteInto() 91 | RemoveOverlap(); RoundToInt() 92 | 93 | # Iota with dialytika 94 | Select(0u0399); Copy(); Select(0u03aa); Paste() 95 | Select(0u00a8); Copy(); Select(0u03aa); PasteWithOffset(0, 150) 96 | RemoveOverlap(); RoundToInt() 97 | 98 | # Upsilon with dialytika 99 | Select(0u03a5); Copy(); Select(0u03ab); Paste() 100 | Select(0u00a8); Copy(); Select(0u03ab); PasteWithOffset(0, 150) 101 | RemoveOverlap(); RoundToInt() 102 | 103 | # alpha with tonos 104 | Select(0u03b1); Copy(); Select(0u03ac); Paste() 105 | Select(0u0384); Copy(); Select(0u03ac); PasteInto() 106 | RemoveOverlap(); RoundToInt() 107 | 108 | # epsilon with tonos 109 | Select(0u03b5); Copy(); Select(0u03ad); Paste() 110 | Select(0u0384); Copy(); Select(0u03ad); PasteInto() 111 | RemoveOverlap(); RoundToInt() 112 | 113 | # eta with tonos 114 | Select(0u03b7); Copy(); Select(0u03ae); Paste() 115 | Select(0u0384); Copy(); Select(0u03ae); PasteInto() 116 | RemoveOverlap(); RoundToInt() 117 | 118 | # iota with tonos 119 | Select(0u03b9); Copy(); Select(0u03af); Paste() 120 | Select(0u0384); Copy(); Select(0u03af); PasteInto() 121 | RemoveOverlap(); RoundToInt() 122 | 123 | # upsilon with dialytika and tonos 124 | Select(0u03c5); Copy(); Select(0u03b0); Paste() 125 | Select(0u0385); Copy(); Select(0u03b0); PasteInto() 126 | RemoveOverlap(); RoundToInt() 127 | 128 | # iota with dialytika 129 | Select(0u03b9); Copy(); Select(0u03ca); Paste() 130 | Select(0u00a8); Copy(); Select(0u03ca); PasteInto() 131 | RemoveOverlap(); RoundToInt() 132 | 133 | # upsilon with dialytika 134 | Select(0u03c5); Copy(); Select(0u03cb); Paste() 135 | Select(0u00a8); Copy(); Select(0u03cb); PasteInto() 136 | RemoveOverlap(); RoundToInt() 137 | 138 | # omicron with tonos 139 | Select(0u03bf); Copy(); Select(0u03cc); Paste() 140 | Select(0u0384); Copy(); Select(0u03cc); PasteInto() 141 | RemoveOverlap(); RoundToInt() 142 | 143 | # upsilon with tonos 144 | Select(0u03c5); Copy(); Select(0u03cd); Paste() 145 | Select(0u0384); Copy(); Select(0u03cd); PasteInto() 146 | RemoveOverlap(); RoundToInt() 147 | 148 | # omega with tonos 149 | Select(0u03c9); Copy(); Select(0u03ce); Paste() 150 | Select(0u0384); Copy(); Select(0u03ce); PasteInto() 151 | RemoveOverlap(); RoundToInt() 152 | 153 | ######################################## 154 | # generate 155 | ######################################## 156 | 157 | Generate($argv[i], "", 0x84) 158 | Print("Generated " + $argv[i] + ".") 159 | Close() 160 | 161 | # end loop 162 | i += 1; endloop 163 | 164 | Quit() 165 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # プログラミング用フォント Ricty 2 | Ricty (リクティ) は Linux 環境での研究・開発に適した 3 | フリーのプログラミング用 TrueType フォントです。 4 | C、C++、FORTRAN、Python、Perl、Ruby、AWK、シェルスクリプト、 5 | Makefile、LaTeX など、UNIX 系のコーディングにおける使用を想定しています。 6 | 以下の 2 つの等幅フォントの合成とプログラミング用フォントとしての 7 | いくつかのチューニングを行う Ricty 生成スクリプトの配布を行なっています。 8 | 9 | * [Inconsolata](http://levien.com/type/myfonts/inconsolata.html) 10 | * [Migu 1M](http://mix-mplus-ipa.sourceforge.jp/) 11 | 12 | # ライセンス 13 | * Ricty が SIL Open Font License Version 1.1 section 5 に 14 | 違反する解釈ができるとの指摘を受け、万全を期すために 15 | Version 3.0.0 より TrueType フォントの配布を中止し、 16 | 生成スクリプトのみの配布とさせていただいております。 17 | * Ricty 生成スクリプトは public domain とします。 18 | 派生物への著作者表示を要求しません。 19 | ただし、使用・複製・改変・再配布は自己責任にて行うことをお願いしています。 20 | * Ricty 生成スクリプトにより生成されたフォントは、 21 | [SIL Open Font License (OFL) Version 1.1](http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=ofl)、 22 | [M+ FONTS LICENSE](http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/#license)、 23 | および、[IPA Font License Agreement v1.0](http://ipafont.ipa.go.jp/ipa_font_license_v1.html) に従うものとします。 24 | 特に、OFL 1.1 section 5 に従い、生成されたフォントの再配布は禁止とします。 25 | 26 | # バージョン 27 | ## Version 3.1.3 (24 Nov. 2011) 28 | * Ricty Discord のコマンドラインオプション 29 | * コマンドラインオプションの追加 30 | 31 | ## Version 3.1.2 (3 Oct. 2011) 32 | * Migu 20111002 に同期 (後方互換を担保せず) 33 | * コマンドラインオプションの追加 34 | 35 | ## Version 3.1.1 (8 July 2011) 36 | * コマンドラインオプションの追加 37 | 38 | ## Version 3.1.0 (19 June 2011) 39 | * Mac OS X で Regular と Bold が異なる高さで表示される問題に対処 40 | 41 | ## Version 3.0.2 (2 June 2011) 42 | * 生成スクリプトへの auto オプションの追加 43 | 44 | ## Version 3.0.1 (20 May 2011) 45 | 46 | ## Version 3.0.0 (17 May 2011) 47 | * 生成スクリプトの配布開始 48 | * TrueType フォントの配布中止 49 | 50 | # 生成方法 51 | ## FontForge のインストール 52 | ### Debian/Ubuntu 53 | 54 | # apt-get install fontforge 55 | 56 | ### Fedora 57 | 58 | # yum install fontforge 59 | 60 | ### その他の Linux 61 | [FontForge 公式サイト](http://fontforge.sourceforge.net/ja/)より 62 | 入手してください。 63 | 64 | ## Inconsolata のインストール 65 | ### Debian/Ubuntu 66 | 67 | # apt install fonts-inconsolata 68 | 69 | ### その他の Linux 70 | [Inconsolata 公式サイト](http://levien.com/type/myfonts/inconsolata.html)より 71 | OpenType file を入手し、インストールしてください。 72 | 73 | ## Migu 1M のインストール 74 | 「[M+ と IPA の合成フォント](http://mix-mplus-ipa.sourceforge.jp/)」より入手し、 75 | インストールしてください (MigMix ではありません)。 76 | 77 | ## Ricty の生成 78 | 79 | % sh ricty_generator.sh auto 80 | 81 | もしくは、 82 | 83 | % sh ricty_generator.sh Inconsolata.otf migu-1m-regular.ttf migu-1m-bold.ttf 84 | 85 | 生成には 2–5 分程の時間がかかります。 86 | 87 | ## Ricty のインストール 88 | 89 | % cp -f Ricty*.ttf ~/.fonts/ 90 | % fc-cache -vf 91 | 92 | ## (おまけ) `ricty_generator.sh` のコマンドラインオプション 93 | ### `-h` 94 | ヘルプを表示する。 95 | ### `-V` 96 | バージョン番号を表示する。 97 | ### `-f /path/to/fontforge` 98 | fontforge コマンドのパスを指定する。 99 | ### `-v` 100 | fontforge の警告メッセージを表示する。 101 | ### `-l` 102 | 生成の過程で生じる中間ファイルを削除せずに残す。 103 | ### `-n string` 104 | フォントファミリ名を「Ricty」ではなく「Ricty ○○○」として生成する。 105 | ### `-w` 106 | 行間を広くする。 107 | ### `-W` 108 | 行間をかなり広くする。 109 | ### `-b` 110 | ASCII グリフのボールド体をより太くする。 111 | ### `-B` 112 | ASCII グリフのレギュラー/ボールド体をより太くする (レギュラーを、デフォルトのボールド体程度の太さにする)。 113 | ### `-Z unicode` 114 | 他のグリフのコピーすることで全角スペースを可視化する (たとえば `-Z 2318` とすると、全角スペースが ⌘ になる)。 115 | ### `-z` 116 | 全角スペースを可視化しない。 117 | ### `-a` 118 | Inconsolata のグリフを優先し、Ambiguous 文字を全角化しない。 119 | ### `-s` 120 | Migu 1M のグリフを縮小しない (`-w` オプションとの併用を推奨)。 121 | 122 | # 派生フォント Ricty Discord 123 | Ricty では、調和・統一感の維持のため、プログラミング用フォントのコアである 124 | Inconsolata 由来の ASCII 文字に手を入れないようにしています。 125 | Discord (不協和音) 版は、統一感を乱す覚悟で ASCII 文字に手を入れた 126 | Ricty の派生フォントです。 127 | 通常、Ricty Discord は Ricty 生成の際に自動的に生成されますが、 128 | パッチスクリプトを直接実行することによっても生成できます。 129 | このとき、オプションを指定することで個々の変更点を無効化することができます。 130 | 131 | % fontforge -script ricty_discord_patch.pe [options] Ricty-Regular.ttf Ricty-Bold.ttf 132 | 133 | ## `ricty_discord_patch.pe` のコマンドラインオプション 134 | ### `-quotedbl` 135 | 「"」を拡大しない。 136 | ### `-quotesingle`, `-quote` 137 | 「'」を拡大しない。 138 | ### `-comma` 139 | 「,」を拡大しない。 140 | ### `-period` 141 | 「.」を拡大しない。 142 | ### `-0`, `-zero` 143 | 「0」をドットゼロにせず、スラッシュゼロのままにする。 144 | ### `-7`, `-seven` 145 | 「7」にクロスバーを付けない。 146 | ### `-colon` 147 | 「:」を拡大しない。 148 | ### `-semicolon` 149 | 「;」を拡大しない。 150 | ### `-D` 151 | 「D」を Eth にしない (「D」にクロスバーを付けない)。 152 | ### `-Z` 153 | 「Z」にクロスバーを付けない。 154 | ### `-asciicircum`, `-circum` 155 | 「^」を拡大しない。 156 | ### `-grave` 157 | 「`」を拡大しない。 158 | ### `-l` 159 | 「l」の左下のセリフを切り落とさない。 160 | ### `-r` 161 | 「r」をセリフ体 (Inconsolata の不使用グリフ) にしない。 162 | ### `-z` 163 | 「z」にクロスバーを付けない。 164 | ### `-bar` 165 | 「|」を破断線 (Inconsolata のグリフ) にしない。 166 | ### `-asciitilde`, `-tilde` 167 | 「~」を上方に移動しない。 168 | 169 | # 既知の問題 170 | * Mac OS X を含む一部の環境において、生成スクリプトを実行すると 171 | FontForge が segmentation fault で異常終了することがあります。 172 | * 「[Ricty のビルド中に fontforge が segmentation fault でクラッシュする問題](http://d.hatena.ne.jp/eagletmt/20110602/1306964018)」にて 173 | これを回避したとの報告がありました。 174 | * また、一部のバージョンの FontForge にはファイル名を誤認識するという 175 | バグがあるようです。`-v` オプションで誤認識後のファイル名を確認し、 176 | ファイル名を変更することで対応してください。 177 | * 一部の環境において、生成されたフォントの全角文字の文字間隔が不自然に 178 | 大きくなることがあります。 179 | * 生成されたフォントを `misc/os2version_reviser.sh` に食べさせることで 180 | 修正できます。 181 | * Windows ではアンチエイリアスがキレイにかからず、 182 | 特にフォントサイズが小さいときに文字が部分的に欠けます。 183 | * [gdipp](http://code.google.com/p/gdipp/)、 184 | [ezgdi](http://code.google.com/p/ezgdi/)、 185 | [gdi++ Helium](http://www18.atwiki.jp/gdiplus2/pages/46.html) などを 186 | 使用すると Linux と同等の美しさで表示されます 187 | (アプリケーションによってまったく機能しないことがあります)。 188 | * 一部のフォントサイズで半角文字と全角文字の横幅比が 189 | 1:2 にならないことがあります。 190 | * ピクセル値 (px) が偶数でないとき、どのフォントにおいても起こりうる問題です。 191 | * 一般的な 96 DPI のフォントレンダリングでは、 192 | 9 pt、10.5 pt、12 pt、13.5 pt、15 pt など、 193 | 1.5 の倍数を指定すると 1:2 で表示されると思います。 194 | * 一般的なフォントと比較すると相対的にフォントサイズ (横幅) が小さくなります。 195 | * 横幅は和文フォントに合わせてあるので、 196 | 一般的な Courier 互換メトリックの欧文フォントと比較すると 197 | 83 % 程度の大きさになります。 198 | * また、アルファベットとのバランスをとるために日本語文字を 199 | 91 % に縮小しています (その分文字間隔が広くなっています)。 200 | 201 | # メモ 202 | * `ricty_generator.sh` に Migu 1M 以外の日本語フォントを食べさせても 203 | 大抵はうまく合成されます。 204 | ボールド体がない日本語フォントでも、 205 | ダミーを食べさせて `Ricty-Bold.ttf` を破棄すれば問題ありません。 206 | * `ricty_discord_patch.pe` は好みで変更点を適宜無効化して 207 | 使われることを想定して、若干過剰に作ってあります。 208 | 私は 7, D, Z, z の 4 文字の変更を無効化しています (`-7 -D -Z -z`)。 209 | * Cocoa Emacs でフレーム幅が意図した幅の倍になってしまうときは、 210 | 本末転倒気味ですが、`misc/ricty_ascii_extractor.pe` で 211 | ASCII 文字のみを分離したフォントを生成する方法が有効です。 212 | * `misc/ricty_greek_regenerator.pe` でアクセント付きギリシア文字を全角幅にすることができます。 213 | 現時点ではギリシア文字拡張グリフには対応していません。 214 | 215 | # 作者連絡先 216 | [遊佐泰紀 (Yasunori Yusa)](http://save.sys.t.u-tokyo.ac.jp/~yusa/index_ja.html) 217 | -------------------------------------------------------------------------------- /ricty_discord_patch.pe: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/fontforge -script 2 | 3 | # 4 | # Ricty Discord Patch for Ricty 3.2.0b 5 | # 6 | # Author: Yasunori Yusa 7 | # 8 | # This script is for generating ``Ricty Discord'' from Ricty. Owing to SIL 9 | # Open Font License Version 1.1 section 5, it is PROHIBITED to distribute 10 | # the generated font. 11 | # 12 | # How to use: 13 | # % fontforge -script ricty_discord_patch.pe [options] Ricty-Regular.ttf Ricty-Bold.ttf 14 | # 15 | 16 | # check args 17 | if ($argc == 1) 18 | Print("Usage: ricty_discord_patch.pe [options] fontfamily-fontstyle.ttf ...") 19 | Print("") 20 | Print("Options:") 21 | Print(" -quotedbl Disable magnified \"") 22 | Print(" -quotesingle, -quote Disable magnified \'") 23 | Print(" -comma Disable magnified ,") 24 | Print(" -period Disable magnified .") 25 | Print(" -0, -zero Disable dotted 0") 26 | Print(" -7, -seven Disable 7 with cross-bar") 27 | Print(" -colon Disable magnified :") 28 | Print(" -semicolon Disable magnified ;") 29 | Print(" -D Disable D of Eth (D with cross-bar)") 30 | Print(" -Z Disable Z with cross-bar") 31 | Print(" -asciicircum, -circum Disable magnified ^") 32 | Print(" -grave Disable magnified `") 33 | Print(" -l Disable l of cutting off left-bottom serif") 34 | Print(" -r Disable r of serif (Inconsolata's unused glyph)") 35 | Print(" -z Disable z with cross-bar") 36 | Print(" -bar Disable broken | (Inconsolata's glyph)") 37 | Print(" -asciitilde, -tilde Disable ~ moved upward") 38 | Quit() 39 | endif 40 | 41 | # set flags 42 | flag_quotedbl="true" 43 | flag_quotesingle="true" 44 | flag_comma="true" 45 | flag_period="true" 46 | flag_0="true" 47 | flag_7="true" 48 | flag_colon="true" 49 | flag_semicolon="true" 50 | flag_D="true" 51 | flag_Z="true" 52 | flag_asciicircum="true" 53 | flag_grave="true" 54 | flag_l="true" 55 | flag_r="true" 56 | flag_z="true" 57 | flag_bar="true" 58 | flag_asciitilde="true" 59 | 60 | # begin loop in args 61 | i = 1 62 | while (i < $argc) 63 | if (Strsub($argv[i], 0, 1) == "-") 64 | if ($argv[i] == "-quotedbl" || $argv[i] == "--quotedbl") 65 | Print("Option: Disable magnified \"") 66 | flag_quotedbl="false" 67 | elseif ($argv[i] == "-quotesingle" || $argv[i] == "--quotesingle" || $argv[i] == "-quote" || $argv[i] == "--quote") 68 | Print("Option: Disable magnified \'") 69 | flag_quotesingle="false" 70 | elseif ($argv[i] == "-comma" || $argv[i] == "--comma") 71 | Print("Option: Disable magnified ,") 72 | flag_comma="false" 73 | elseif ($argv[i] == "-period" || $argv[i] == "--period") 74 | Print("Option: Disable magnified .") 75 | flag_period="false" 76 | elseif ($argv[i] == "-0" || $argv[i] == "-zero" || $argv[i] == "--zero") 77 | Print("Option: Disable dotted 0") 78 | flag_0="false" 79 | elseif ($argv[i] == "-7" || $argv[i] == "-seven" || $argv[i] == "--seven") 80 | Print("Option: Disable 7 with cross-bar") 81 | flag_7="false" 82 | elseif ($argv[i] == "-colon" || $argv[i] == "--colon") 83 | Print("Option: Disable magnified :") 84 | flag_colon="false" 85 | elseif ($argv[i] == "-semicolon" || $argv[i] == "--semicolon") 86 | Print("Option: Disable magnified ;") 87 | flag_semicolon="false" 88 | elseif ($argv[i] == "-D") 89 | Print("Option: Disable D of Eth (D with cross-bar)") 90 | flag_D="false" 91 | elseif ($argv[i] == "-Z") 92 | Print("Option: Disable Z with cross-bar") 93 | flag_Z="false" 94 | elseif ($argv[i] == "-asciicircum" || $argv[i] == "--asciicircum" || $argv[i] == "-circum" || $argv[i] == "--circum") 95 | Print("Option: Disable magnified ^") 96 | flag_asciicircum="false" 97 | elseif ($argv[i] == "-grave" || $argv[i] == "--grave") 98 | Print("Option: Disable magnified `") 99 | flag_grave="false" 100 | elseif ($argv[i] == "-l") 101 | Print("Option: Disable l of cutting off left-bottom serif") 102 | flag_l="false" 103 | elseif ($argv[i] == "-r") 104 | Print("Option: Disable r of serif (Inconsolata's unused glyph)") 105 | flag_r="false" 106 | elseif ($argv[i] == "-z") 107 | Print("Option: Disable z with cross-bar") 108 | flag_z="false" 109 | elseif ($argv[i] == "-bar" || $argv[i] == "--bar") 110 | Print("Option: Disable broken | (Inconsolata's glyph)") 111 | flag_bar="false" 112 | elseif ($argv[i] == "-asciitilde" || $argv[i] == "--asciitilde" || $argv[i] == "-tilde" || $argv[i] == "--tilde") 113 | Print("Option: Disable ~ moved upward") 114 | flag_asciitilde="false" 115 | else 116 | Print("Unknown Option: " + $argv[i]) 117 | Quit() 118 | endif 119 | else 120 | 121 | ######################################## 122 | # set parameters 123 | ######################################## 124 | 125 | # get argument 126 | input = $argv[i]:t:r 127 | 128 | # set font names 129 | hyphen_idx = Strrstr(input, '-') 130 | if ($argv[i]:e != "ttf" || hyphen_idx == -1) 131 | Print("Illegal Argument: " + $argv[i]) 132 | Quit() 133 | endif 134 | inputfamily = Strsub(input, 0, hyphen_idx) 135 | inputstyle = Strsub(input, hyphen_idx+1) 136 | addfamily = "Discord" 137 | 138 | # print message 139 | Print("Generate " + inputfamily + addfamily + "-" + inputstyle + ".ttf.") 140 | 141 | ######################################## 142 | # open file and set configuration 143 | ######################################## 144 | 145 | # open file 146 | Open($argv[i]) 147 | 148 | # set encoding to Unicode-bmp 149 | Reencode("unicode") 150 | 151 | # set configuration 152 | SetFontNames(inputfamily + addfamily + "-" + inputstyle, \ 153 | $familyname + " " + addfamily, \ 154 | $familyname + " " + addfamily + " " + inputstyle, \ 155 | inputstyle) 156 | 157 | ######################################## 158 | # edit some glyphs 159 | ######################################## 160 | 161 | # " -> magnified " 162 | if (flag_quotedbl == "true") 163 | Select(0u0022); Scale(115, 115, 250, 600); SetWidth(500) 164 | RemoveOverlap(); RoundToInt() 165 | endif 166 | 167 | # ' -> magnified ' 168 | if (flag_quotesingle == "true") 169 | Select(0u0027); Scale(115, 115, 250, 600); SetWidth(500) 170 | RemoveOverlap(); RoundToInt() 171 | endif 172 | 173 | # , -> magnified , 174 | if (flag_comma == "true") 175 | Select(0u002c); Scale(115, 115, 250, 0); SetWidth(500) 176 | RemoveOverlap(); RoundToInt() 177 | endif 178 | 179 | # . -> magnified . 180 | if (flag_period == "true") 181 | Select(0u002e); Scale(115, 115, 250, 0); SetWidth(500) 182 | RemoveOverlap(); RoundToInt() 183 | endif 184 | 185 | # 0 -> dotted 0 186 | if (flag_0 == "true") 187 | Select(0u00b7); Copy() # middle dot 188 | Select(0u0030); Paste(); CenterInWidth() 189 | Select(65551); Copy() # zero (Inconsolata's unused glyph) 190 | Select(0u0030); PasteInto() 191 | RemoveOverlap(); RoundToInt() 192 | endif 193 | 194 | # 7 -> 7 with cross-bar 195 | if (flag_7 == "true") 196 | Select(0u00af); Copy() # macron 197 | Select(0u0037); PasteWithOffset(20, -263) 198 | RemoveOverlap(); RoundToInt() 199 | endif 200 | 201 | # : -> magnified : 202 | if (flag_colon == "true") 203 | Select(0u003a); Scale(115, 115, 250, 0); SetWidth(500) 204 | RemoveOverlap(); RoundToInt() 205 | endif 206 | 207 | # ; -> magnified ; 208 | if (flag_semicolon == "true") 209 | Select(0u003b); Scale(115, 115, 250, 0); SetWidth(500) 210 | RemoveOverlap(); RoundToInt() 211 | endif 212 | 213 | # D -> D of Eth (D with cross-bar) 214 | if (flag_D == "true") 215 | Select(0u0110); Copy() 216 | Select(0u0044); Paste() 217 | endif 218 | 219 | # Z -> Z with cross-bar 220 | if (flag_Z == "true") 221 | Select(0u00af); Copy() # macron 222 | Select(65611); Paste() # tmp glyph 223 | Transform(100, -65, 0, 100, 0, -12000); SetWidth(500) 224 | Copy() 225 | Select(0u005a); PasteInto() 226 | RemoveOverlap(); RoundToInt() 227 | Select(65611); Clear() # tmp glyph 228 | endif 229 | 230 | # ^ -> magnified ^ 231 | if (flag_asciicircum == "true") 232 | Select(0u005e); Scale(115, 115, 250, 600); SetWidth(500) 233 | RemoveOverlap(); RoundToInt() 234 | endif 235 | 236 | # ` -> magnified ` 237 | if (flag_grave == "true") 238 | Select(0u0060); Scale(115, 115, 250, 600); SetWidth(500) 239 | RemoveOverlap(); RoundToInt() 240 | endif 241 | 242 | # l -> l of cutting off left-bottom serif 243 | if (flag_l == "true") 244 | Select(0u006c); Copy() 245 | Rotate(180); Move(1, 0); SetWidth(500) 246 | PasteInto(); OverlapIntersect() 247 | endif 248 | 249 | # r -> r of serif (Inconsolata's unused glyph) 250 | if (flag_r == "true") 251 | Select(65549); Copy() 252 | Select(0u0072); Paste() 253 | endif 254 | 255 | # z -> z with cross-bar 256 | if (flag_z == "true") 257 | Select(0u00af); Copy() # macron 258 | Select(65611); Paste() # tmp glyph 259 | Transform(75, -52, 0, 100, 5500, -23500); SetWidth(500) 260 | Copy() 261 | Select(0u007a); PasteInto() 262 | RemoveOverlap(); RoundToInt() 263 | Select(65611); Clear() # tmp glyph 264 | endif 265 | 266 | # | -> broken | (Inconsolata's glyph) 267 | if (flag_bar == "true") 268 | Select(0u00a6); Copy() 269 | Select(0u007c); Paste() 270 | endif 271 | 272 | # ~ -> ~ moved upward 273 | if (flag_asciitilde == "true") 274 | Select(0u007e); Move(0, 120) 275 | endif 276 | 277 | ######################################## 278 | # generate 279 | ######################################## 280 | 281 | Generate(inputfamily + addfamily + "-" + inputstyle + ".ttf", "", 0x84) 282 | Close() 283 | 284 | # end loop 285 | endif 286 | i += 1; endloop 287 | 288 | Quit() 289 | -------------------------------------------------------------------------------- /ricty_generator.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Ricty Generator 5 | ricty_version="3.2.0b" 6 | # 7 | # Author: Yasunori Yusa 8 | # 9 | # This script is for generating ``Ricty'' font from Inconsolata and Migu 1M. 10 | # It requires 2-5 minutes to generate Ricty. Owing to SIL Open Font License 11 | # Version 1.1 section 5, it is PROHIBITED to distribute the generated font. 12 | # This script supports following versions of inputting fonts. 13 | # * Inconsolata Version 001.010 14 | # * Migu 1M Version 20111002 15 | # 16 | # How to use: 17 | # 1. Install FontForge 18 | # Debian/Ubuntu: # apt-get install fontforge 19 | # Fedora: # yum install fontforge 20 | # Other Linux: Get from http://fontforge.sourceforge.net/ 21 | # 2. Get Inconsolata.otf 22 | # Debian/Ubuntu: # apt-get install ttf-inconsolata 23 | # Other Linux: Get from http://levien.com/type/myfonts/inconsolata.html 24 | # 3. Get migu-1m-regular/bold.ttf 25 | # Get from http://mix-mplus-ipa.sourceforge.jp/ 26 | # 4. Run this script 27 | # % sh ricty_generator.sh auto 28 | # or 29 | # % sh ricty_generator.sh Inconsolata.otf migu-1m-regular.ttf migu-1m-bold.ttf 30 | # 5. Install Ricty 31 | # % cp -f Ricty*.ttf ~/.fonts/ 32 | # % fc-cache -vf 33 | # 34 | 35 | # set familyname 36 | ricty_familyname="Ricty" 37 | ricty_addfamilyname="" 38 | 39 | # set ascent and descent (line width parameters) 40 | ricty_ascent=835 41 | ricty_descent=215 42 | 43 | # set bold width of ASCII glyphs 44 | ascii_regular_width=0 45 | ascii_bold_width=30 46 | 47 | # set path to fontforge command 48 | fontforge_cmd="fontforge" 49 | 50 | # set redirection of stderr 51 | redirection_stderr="/dev/null" 52 | 53 | # set fonts directories used in auto flag 54 | fonts_dirs=". ${HOME}/.fonts /usr/local/share/fonts /usr/share/fonts ${HOME}/Library/Fonts /Library/Fonts" 55 | 56 | # set zenkaku space glyph 57 | zenkaku_space_glyph="" 58 | 59 | # set flags 60 | leaving_tmp_flag="false" 61 | fullwidth_ambiguous_flag="true" 62 | scaling_down_flag="true" 63 | 64 | # set filenames 65 | modified_inconsolata_generator="modified_inconsolata_generator.pe" 66 | modified_inconsolata_regu="Modified-Inconsolata-Regular.sfd" 67 | modified_inconsolata_bold="Modified-Inconsolata-Bold.sfd" 68 | modified_migu1m_generator="modified_migu1m_generator.pe" 69 | modified_migu1m_regu="Modified-migu-1m-regular.sfd" 70 | modified_migu1m_bold="Modified-migu-1m-bold.sfd" 71 | ricty_generator="ricty_generator.pe" 72 | 73 | ######################################## 74 | # pre-process 75 | ######################################## 76 | 77 | # print information message 78 | cat << _EOT_ 79 | Ricty Generator ${ricty_version} 80 | 81 | Author: Yasunori Yusa 82 | 83 | This script is for generating \`\`Ricty'' font from Inconsolata and Migu 1M. 84 | It requires 2-5 minutes to generate Ricty. Owing to SIL Open Font License 85 | Version 1.1 section 5, it is PROHIBITED to distribute the generated font. 86 | 87 | _EOT_ 88 | 89 | # display help 90 | ricty_generator_help() 91 | { 92 | echo "Usage: ricty_generator.sh [options] auto" 93 | echo " ricty_generator.sh [options] Inconsolata.otf migu-1m-regular.ttf migu-1m-bold.ttf" 94 | echo "" 95 | echo "Options:" 96 | echo " -h Display this information" 97 | echo " -V Display version number" 98 | echo " -f /path/to/fontforge Set path to fontforge command" 99 | echo " -v Enable verbose mode (display fontforge's warnings)" 100 | echo " -l Leave (NOT remove) temporary files" 101 | echo " -n string Set additional fontfamily name (\`\`Ricty string'')" 102 | echo " -w Widen line space" 103 | echo " -W Widen line space extremely" 104 | echo " -b Make bold-face ASCII glyphs more bold" 105 | echo " -B Make regular-/bold-face ASCII glyphs more bold" 106 | echo " -Z unicode Set visible zenkaku space copied from another glyph" 107 | echo " -z Disable visible zenkaku space" 108 | echo " -a Disable fullwidth ambiguous charactors" 109 | echo " -s Disable scaling down Migu 1M" 110 | exit 0 111 | } 112 | 113 | # get options 114 | while getopts hVf:vln:wWbBZ:zas OPT 115 | do 116 | case $OPT in 117 | "h" ) 118 | ricty_generator_help 119 | ;; 120 | "V" ) 121 | exit 0 122 | ;; 123 | "f" ) 124 | echo "Option: Set path to fontforge command: ${OPTARG}" 125 | fontforge_cmd="$OPTARG" 126 | ;; 127 | "v" ) 128 | echo "Option: Enable verbose mode" 129 | redirection_stderr="/dev/stderr" 130 | ;; 131 | "l" ) 132 | echo "Option: Leave (NOT remove) temporary files" 133 | leaving_tmp_flag="true" 134 | ;; 135 | "n" ) 136 | echo "Option: Set additional fontfamily name: ${OPTARG}" 137 | ricty_addfamilyname=`echo $OPTARG | sed -e 's/ //g'` 138 | ;; 139 | "w" ) 140 | echo "Option: Widen line space" 141 | ricty_ascent=`expr $ricty_ascent + 128` 142 | ricty_descent=`expr $ricty_descent + 32` 143 | ;; 144 | "W" ) 145 | echo "Option: Widen line space extremely" 146 | ricty_ascent=`expr $ricty_ascent + 256` 147 | ricty_descent=`expr $ricty_descent + 64` 148 | ;; 149 | "b" ) 150 | echo "Option: Make bold-face ASCII glyphs more bold" 151 | ascii_bold_width=`expr $ascii_bold_width + 30` 152 | ;; 153 | "B" ) 154 | echo "Option: Make regular-/bold-face ASCII glyphs more bold" 155 | ascii_regular_width=`expr $ascii_regular_width + 30` 156 | ascii_bold_width=`expr $ascii_bold_width + 30` 157 | ;; 158 | "Z" ) 159 | echo "Option: Set visible zenkaku space copied from another glyph: ${OPTARG}" 160 | zenkaku_space_glyph="0u${OPTARG}" 161 | ;; 162 | "z" ) 163 | echo "Option: Disable visible zenkaku space" 164 | zenkaku_space_glyph="0u3000" 165 | ;; 166 | "a" ) 167 | echo "Option: Disable fullwidth ambiguous charactors" 168 | fullwidth_ambiguous_flag="false" 169 | ;; 170 | "s" ) 171 | echo "Option: Disable scaling down Migu 1M" 172 | scaling_down_flag="false" 173 | ;; 174 | * ) 175 | exit 1 176 | ;; 177 | esac 178 | done 179 | shift `expr $OPTIND - 1` 180 | 181 | # check fontforge existance 182 | which $fontforge_cmd > /dev/null 2>&1 183 | if [ $? -ne 0 ] 184 | then 185 | echo "Error: ${fontforge_cmd} command not found" >&2 186 | exit 1 187 | fi 188 | 189 | # get input fonts 190 | if [ $# -eq 1 -a "$1" = "auto" ] 191 | then 192 | # check dirs existance 193 | tmp="" 194 | for i in $fonts_dirs 195 | do 196 | [ -d $i ] && tmp="$tmp $i" 197 | done 198 | fonts_dirs=$tmp 199 | # search Inconsolata 200 | input_inconsolata=`find $fonts_dirs -follow -name Inconsolata.otf | head -n 1` 201 | if [ -z "$input_inconsolata" ] 202 | then 203 | echo "Error: Inconsolata.otf not found" >&2 204 | exit 1 205 | fi 206 | # search Migu 1M 207 | input_migu1m_regu=`find $fonts_dirs -follow -iname migu-1m-regular.ttf | head -n 1` 208 | input_migu1m_bold=`find $fonts_dirs -follow -iname migu-1m-bold.ttf | head -n 1` 209 | if [ -z "$input_migu1m_regu" -o -z "$input_migu1m_bold" ] 210 | then 211 | echo "Error: migu-1m-regular/bold.ttf not found" >&2 212 | exit 1 213 | fi 214 | elif [ $# -eq 3 ] 215 | then 216 | # get args 217 | input_inconsolata=$1 218 | input_migu1m_regu=$2 219 | input_migu1m_bold=$3 220 | # check file existance 221 | if [ ! -r $input_inconsolata ] 222 | then 223 | echo "Error: ${input_inconsolata} not found" >&2 224 | exit 1 225 | elif [ ! -r $input_migu1m_regu ] 226 | then 227 | echo "Error: ${input_migu1m_regu} not found" >&2 228 | exit 1 229 | elif [ ! -r $input_migu1m_bold ] 230 | then 231 | echo "Error: ${input_migu1m_bold} not found" >&2 232 | exit 1 233 | fi 234 | # check filename 235 | [ "$(basename $input_inconsolata)" != "Inconsolata.otf" ] \ 236 | && echo "Warning: ${input_inconsolata} is really Inconsolata?" >&2 237 | [ "$(basename $input_migu1m_regu)" != "migu-1m-regular.ttf" ] \ 238 | && echo "Warning: ${input_migu1m_regu} is really Migu 1M Regular?" >&2 239 | [ "$(basename $input_migu1m_bold)" != "migu-1m-bold.ttf" ] \ 240 | && echo "Warning: ${input_migu1m_bold} is really Migu 1M Bold?" >&2 241 | else 242 | ricty_generator_help 243 | fi 244 | 245 | # make tmp 246 | if [ -w "/tmp" -a "$leaving_tmp_flag" = "false" ] 247 | then 248 | tmpdir=`mktemp -d /tmp/ricty_generator_tmpdir.XXXXXX` || exit 2 249 | else 250 | tmpdir=`mktemp -d ./ricty_generator_tmpdir.XXXXXX` || exit 2 251 | fi 252 | 253 | # remove tmp by trapping 254 | if [ "$leaving_tmp_flag" = "false" ] 255 | then 256 | trap "if [ -d $tmpdir ]; then echo 'Remove temporary files'; rm -rf $tmpdir; echo 'Abnormal terminated'; fi; exit 3" HUP INT QUIT 257 | trap "if [ -d $tmpdir ]; then echo 'Remove temporary files'; rm -rf $tmpdir; echo 'Abnormal terminated'; fi" EXIT 258 | else 259 | trap "if [ -d $tmpdir ]; then echo 'Abnormal terminated'; fi; exit 3" HUP INT QUIT 260 | trap "if [ -d $tmpdir ]; then echo 'Abnormal terminated'; fi" EXIT 261 | fi 262 | 263 | ######################################## 264 | # generate script for modified Inconsolata 265 | ######################################## 266 | 267 | cat > ${tmpdir}/${modified_inconsolata_generator} << _EOT_ 268 | #!$fontforge_cmd -script 269 | 270 | # print message 271 | Print("Generate modified Inconsolata.") 272 | 273 | # open Inconsolata 274 | Print("Find ${input_inconsolata}.") 275 | Open("${input_inconsolata}") 276 | 277 | # scale to standard glyph size 278 | ScaleToEm(860, 140) 279 | 280 | # remove ambiguous glyphs 281 | if ("$fullwidth_ambiguous_flag" == "true") 282 | Select(0u00a2); Clear() # cent 283 | Select(0u00a3); Clear() # pound 284 | Select(0u00a4); Clear() # currency 285 | Select(0u00a5); Clear() # yen 286 | Select(0u00a7); Clear() # section 287 | Select(0u00a8); Clear() # dieresis 288 | Select(0u00ac); Clear() # not 289 | Select(0u00ad); Clear() # soft hyphen 290 | Select(0u00b0); Clear() # degree 291 | Select(0u00b1); Clear() # plus-minus 292 | Select(0u00b4); Clear() # acute 293 | Select(0u00b6); Clear() # pilcrow 294 | Select(0u00d7); Clear() # multiply 295 | Select(0u00f7); Clear() # divide 296 | Select(0u2018); Clear() # left ' 297 | Select(0u2019); Clear() # right ' 298 | Select(0u201c); Clear() # left " 299 | Select(0u201d); Clear() # right " 300 | Select(0u2020); Clear() # dagger 301 | Select(0u2021); Clear() # double dagger 302 | Select(0u2026); Clear() # ... 303 | Select(0u2122); Clear() # TM 304 | Select(0u2191); Clear() # uparrow 305 | Select(0u2193); Clear() # downarrow 306 | Select(0u2212); Clear() # minus 307 | Select(0u2423); Clear() # open box 308 | endif 309 | 310 | # pre-process for merging 311 | SelectWorthOutputting() 312 | ClearInstrs(); UnlinkReference() 313 | 314 | # save regular-face 315 | Print("Save ${modified_inconsolata_regu}.") 316 | Save("${tmpdir}/${modified_inconsolata_regu}") 317 | 318 | # make glyphs bold 319 | Print("While making Inconsolata bold, wait a moment...") 320 | SelectWorthOutputting() 321 | ExpandStroke(${ascii_bold_width}, 0, 0, 0, 1) 322 | Select(0u003e); Copy() # > 323 | Select(0u003c); Paste(); HFlip() # < 324 | RoundToInt(); RemoveOverlap(); RoundToInt() 325 | 326 | # save bold-face 327 | Print("Save ${modified_inconsolata_bold}.") 328 | Save("${tmpdir}/${modified_inconsolata_bold}") 329 | Close() 330 | 331 | # open regular-face and make it bold 332 | if ($ascii_regular_width != 0) 333 | Open("${tmpdir}/${modified_inconsolata_regu}") 334 | Print("While making regular-face Inconsolata bold, wait a moment...") 335 | SelectWorthOutputting() 336 | ExpandStroke(${ascii_regular_width}, 0, 0, 0, 1) 337 | Select(0u003e); Copy() # > 338 | Select(0u003c); Paste(); HFlip() # < 339 | RoundToInt(); RemoveOverlap(); RoundToInt() 340 | Save("${tmpdir}/${modified_inconsolata_regu}") 341 | Close() 342 | endif 343 | 344 | Quit() 345 | _EOT_ 346 | 347 | ######################################## 348 | # generate script for modified Migu 1M 349 | ######################################## 350 | 351 | cat > ${tmpdir}/${modified_migu1m_generator} << _EOT_ 352 | #!$fontforge_cmd -script 353 | 354 | # print message 355 | Print("Generate modified Migu 1M.") 356 | 357 | # set parameters 358 | input_list = ["${input_migu1m_regu}", "${input_migu1m_bold}"] 359 | output_list = ["${modified_migu1m_regu}", "${modified_migu1m_bold}"] 360 | 361 | # begin loop of regular and bold 362 | i = 0; while (i < SizeOf(input_list)) 363 | # open Migu 1M 364 | Print("Find " + input_list[i] + ".") 365 | Open(input_list[i]) 366 | # scale Migu 1M to standard glyph size 367 | ScaleToEm(860, 140) 368 | SelectWorthOutputting() 369 | ClearInstrs(); UnlinkReference() 370 | if ("$scaling_down_flag" == "true") 371 | Print("While scaling " + input_list[i]:t + ", wait a little...") 372 | SetWidth(-1, 1); Scale(91, 91, 0, 0); SetWidth(110, 2); SetWidth(1, 1) 373 | Move(23, 0); SetWidth(-23, 1) 374 | endif 375 | RoundToInt(); RemoveOverlap(); RoundToInt() 376 | # save modified Migu 1M 377 | Save("${tmpdir}/" + output_list[i]) 378 | Print("Save " + output_list[i] + ".") 379 | Close() 380 | i += 1; endloop 381 | Quit() 382 | _EOT_ 383 | 384 | ######################################## 385 | # generate script for Ricty 386 | ######################################## 387 | 388 | cat > ${tmpdir}/${ricty_generator} << _EOT_ 389 | #!$fontforge_cmd -script 390 | 391 | # print message 392 | Print("Generate Ricty.") 393 | 394 | # set parameters 395 | inconsolata_list = ["${tmpdir}/${modified_inconsolata_regu}", \\ 396 | "${tmpdir}/${modified_inconsolata_bold}"] 397 | migu1m_list = ["${tmpdir}/${modified_migu1m_regu}", \\ 398 | "${tmpdir}/${modified_migu1m_bold}"] 399 | fontfamily = "$ricty_familyname" 400 | addfontfamily = "$ricty_addfamilyname" 401 | fontstyle_list = ["Regular", "Bold"] 402 | fontweight_list = [400, 700] 403 | panoseweight_list = [5, 8] 404 | copyright = "Ricty Generator Author: Yasunori Yusa\n" \\ 405 | + "Copyright (c) 2006-2011 Raph Levien\n" \\ 406 | + "Copyright (c) 2006-2011 itouhiro\n" \\ 407 | + "Copyright (c) 2002-2011 M+ FONTS PROJECT\n" \\ 408 | + "Copyright (c) 2003-2011 " \\ 409 | + "Information-technology Promotion Agency, Japan (IPA)\n" \\ 410 | + "Licenses:\n" \\ 411 | + "SIL Open Font License Version 1.1 " \\ 412 | + "(http://scripts.sil.org/OFL)\n" \\ 413 | + "M+ FONTS LICENSE " \\ 414 | + "(http://mplus-fonts.sourceforge.jp/mplus-outline-fonts/#license)\n" \\ 415 | + "IPA Font License Agreement v1.0 " \\ 416 | + "(http://ipafont.ipa.go.jp/ipa_font_license_v1.html)" 417 | version = "${ricty_version}" 418 | 419 | # begin loop of regular and bold 420 | i = 0; while (i < SizeOf(fontstyle_list)) 421 | # open new file 422 | New() 423 | # set encoding to Unicode-bmp 424 | Reencode("unicode") 425 | # set configuration 426 | if (addfontfamily != "") 427 | SetFontNames(fontfamily + addfontfamily + "-" + fontstyle_list[i], \\ 428 | fontfamily + " " + addfontfamily, \\ 429 | fontfamily + " " + addfontfamily + " " + fontstyle_list[i], \\ 430 | fontstyle_list[i], \\ 431 | copyright, version) 432 | else 433 | SetFontNames(fontfamily + "-" + fontstyle_list[i], \\ 434 | fontfamily, \\ 435 | fontfamily + " " + fontstyle_list[i], \\ 436 | fontstyle_list[i], \\ 437 | copyright, version) 438 | endif 439 | ScaleToEm(860, 140) 440 | SetOS2Value("Weight", fontweight_list[i]) # Book or Bold 441 | SetOS2Value("Width", 5) # Medium 442 | SetOS2Value("FSType", 0) 443 | SetOS2Value("VendorID", "PfEd") 444 | SetOS2Value("IBMFamily", 2057) # SS Typewriter Gothic 445 | SetOS2Value("WinAscentIsOffset", 0) 446 | SetOS2Value("WinDescentIsOffset", 0) 447 | SetOS2Value("TypoAscentIsOffset", 0) 448 | SetOS2Value("TypoDescentIsOffset", 0) 449 | SetOS2Value("HHeadAscentIsOffset", 0) 450 | SetOS2Value("HHeadDescentIsOffset", 0) 451 | SetOS2Value("WinAscent", $ricty_ascent) 452 | SetOS2Value("WinDescent", $ricty_descent) 453 | SetOS2Value("TypoAscent", 860) 454 | SetOS2Value("TypoDescent", -140) 455 | SetOS2Value("TypoLineGap", 0) 456 | SetOS2Value("HHeadAscent", $ricty_ascent) 457 | SetOS2Value("HHeadDescent", -$ricty_descent) 458 | SetOS2Value("HHeadLineGap", 0) 459 | SetPanose([2, 11, panoseweight_list[i], 9, 2, 2, 3, 2, 2, 7]) 460 | # merge fonts 461 | Print("While merging " + inconsolata_list[i]:t \\ 462 | + " with " +migu1m_list[i]:t + ", wait a little more...") 463 | MergeFonts(inconsolata_list[i]) 464 | MergeFonts(migu1m_list[i]) 465 | # edit zenkaku space (from ballot box and heavy greek cross) 466 | if ("$zenkaku_space_glyph" == "") 467 | Select(0u2610); Copy(); Select(0u3000); Paste() 468 | Select(0u271a); Copy(); Select(0u3000); PasteInto(); OverlapIntersect() 469 | else 470 | Select(${zenkaku_space_glyph}); Copy(); Select(0u3000); Paste() 471 | endif 472 | # edit zenkaku comma and period 473 | Select(0uff0c); Scale(150, 150, 100, 0); SetWidth(1000) 474 | Select(0uff0e); Scale(150, 150, 100, 0); SetWidth(1000) 475 | # edit zenkaku colon and semicolon 476 | Select(0uff0c); Copy(); Select(0uff1b); Paste() 477 | Select(0uff0e); Copy(); Select(0uff1b); PasteWithOffset(0, 400) 478 | CenterInWidth() 479 | Select(0uff1a); Paste(); PasteWithOffset(0, 400) 480 | CenterInWidth() 481 | # edit en dash 482 | Select(0u2013); Copy() 483 | PasteWithOffset(200, 0); PasteWithOffset(-200, 0); OverlapIntersect() 484 | # edit em dash and horizontal bar 485 | Select(0u2014); Copy() 486 | PasteWithOffset(620, 0); PasteWithOffset(-620, 0) 487 | Select(0u2010); Copy() 488 | Select(0u2014); PasteInto() 489 | OverlapIntersect() 490 | Copy(); Select(0u2015); Paste() 491 | # post-proccess 492 | SelectWorthOutputting(); RoundToInt(); RemoveOverlap(); RoundToInt() 493 | # generate Ricty 494 | if (addfontfamily != "") 495 | Print("Save " + fontfamily + addfontfamily + "-" + fontstyle_list[i] + ".ttf.") 496 | Generate(fontfamily + addfontfamily + "-" + fontstyle_list[i] + ".ttf", "", 0x84) 497 | else 498 | Print("Save " + fontfamily + "-" + fontstyle_list[i] + ".ttf.") 499 | Generate(fontfamily + "-" + fontstyle_list[i] + ".ttf", "", 0x84) 500 | endif 501 | Close() 502 | i += 1; endloop 503 | Quit() 504 | _EOT_ 505 | 506 | ######################################## 507 | # generate Ricty 508 | ######################################## 509 | 510 | # generate 511 | $fontforge_cmd -script ${tmpdir}/${modified_inconsolata_generator} \ 512 | 2> $redirection_stderr || exit 4 513 | $fontforge_cmd -script ${tmpdir}/${modified_migu1m_generator} \ 514 | 2> $redirection_stderr || exit 4 515 | $fontforge_cmd -script ${tmpdir}/${ricty_generator} \ 516 | 2> $redirection_stderr || exit 4 517 | 518 | # remove tmp 519 | if [ "$leaving_tmp_flag" = "false" ] 520 | then 521 | echo "Remove temporary files." 522 | rm -rf $tmpdir 523 | fi 524 | 525 | # generate Ricty Discord (if the script exists) 526 | path2discord_patch=`dirname $0`/ricty_discord_patch.pe 527 | if [ -r $path2discord_patch ] 528 | then 529 | $fontforge_cmd -script $path2discord_patch \ 530 | ${ricty_familyname}${ricty_addfamilyname}-Regular.ttf \ 531 | ${ricty_familyname}${ricty_addfamilyname}-Bold.ttf \ 532 | 2> $redirection_stderr || exit 4 533 | fi 534 | 535 | # exit 536 | echo "Succeeded to generate Ricty!" 537 | exit 0 538 | --------------------------------------------------------------------------------