2 # Copyright (c) 2019 Dimitar Toshkov Zhekov <dimitar.zhekov@gmail.com>
\r
4 # This program is free software; you can redistribute it and/or
\r
5 # modify it under the terms of the GNU General Public License as
\r
6 # published by the Free Software Foundation; either version 2 of
\r
7 # the License, or (at your option) any later version.
\r
9 # This program is distributed in the hope that it will be useful,
\r
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
12 # GNU General Public License for more details.
\r
15 !include nsDialogs.nsh
\r
16 !include LogicLib.nsh
\r
17 !include FileFunc.nsh
\r
20 Name "Terminus Font"
\r
21 OutFile terminus-font-4.48.exe
\r
25 RequestExecutionLevel admin
\r
27 InstallDir "$EXEDIR\terminus-font-4.48"
\r
28 InstallButtonText "Proceed"
\r
60 Page custom ter_dialog_page ter_dialog_page_leave
\r
63 Function install_clicked
\r
65 EnableWindow $directory 0
\r
66 EnableWindow $browse 0
\r
67 ${NSD_SetText} $directory "$FONTS"
\r
71 Function unpack_clicked
\r
73 ${NSD_SetText} $directory "$INSTDIR"
\r
74 EnableWindow $directory 1
\r
75 EnableWindow $browse 1
\r
79 Function hamster_clicked
\r
81 ExecShell "open" "http://terminus-font.sourceforge.net#variants"
\r
82 ToolTips::Classic $hamster "http://terminus-font.sourceforge.net#variants"
\r
86 Function browse_clicked
\r
88 nsDialogs::SelectFolderDialog Directory $INSTDIR
\r
92 StrCpy $INSTDIR "$0"
\r
93 ${NSD_SetText} $directory "$INSTDIR"
\r
98 Function ter_dialog_page
\r
100 nsDialogs::Create 1018
\r
103 ${NSD_CreateLink} 2% 1 11% 10u "Variants"
\r
105 ${NSD_OnClick} $hamster hamster_clicked
\r
106 ToolTips::Classic $hamster "http://terminus-font.sourceforge.net#variants"
\r
107 ${NSD_CreateGroupBox} 0 0 100% 25u ""
\r
108 ${NSD_CreateCheckBox} 2% 10u 11% 12u "ao2"
\r
110 ${NSD_CreateCheckBox} 13% 10u 11% 12u "dv1"
\r
112 ${NSD_CreateCheckBox} 24% 10u 11% 12u "ge2"
\r
114 ${NSD_CreateCheckBox} 35% 10u 11% 12u "gq2"
\r
116 ${NSD_CreateCheckBox} 46% 10u 10% 12u "ij1"
\r
118 ${NSD_CreateCheckBox} 56% 10u 11% 12u "ka2"
\r
120 ${NSD_CreateCheckBox} 67% 10u 10% 12u "ll2"
\r
122 ${NSD_CreateCheckBox} 77% 10u 11% 12u "td1"
\r
124 ${NSD_CreateCheckBox} 88% 10u 11% 12u "hi2"
\r
127 ${NSD_CreateRadioButton} 0 28u 14% 12u "Install"
\r
129 ${NSD_AddStyle} $install ${WS_GROUP}
\r
130 ${NSD_Check} $install
\r
131 ${NSD_OnClick} $install install_clicked
\r
132 ${NSD_CreateRadioButton} 15% 28u 35% 12u "Unpack and patch only"
\r
134 ${NSD_UnCheck} $unpack
\r
135 ${NSD_OnClick} $unpack unpack_clicked
\r
136 ${NSD_CreateFileRequest} 0% 42u 95% 12u ""
\r
138 ${NSD_CreateBrowseButton} 95% 42u 5% 12u "..."
\r
140 ${NSD_OnClick} $browse browse_clicked
\r
141 Call install_clicked
\r
143 ${NSD_CreateHLine} 0 57u 100% 1u
\r
145 ${NSD_AddStyle} $0 ${WS_GROUP}
\r
146 ${NSD_CreateLabel} 2% 63u 96% 8u "Terminus Font is licensed under \
\r
147 the SIL Open Font License, Version 1.1."
\r
148 ${NSD_CreateLabel} 2% 71u 96% 12u "The license is available with a \
\r
149 FAQ at: http://scripts.sil.org/OFL"
\r
150 ${NSD_CreateLabel} 2% 83u 96% 24u "Note: the Windows code pages \
\r
151 contain a total of 356 characters. All other characters \
\r
152 (math, pseudographics etc.) are not currently available."
\r
153 ${NSD_CreateLabel} 2% 107u 96% 12u "Terminus Font 4.48, \
\r
154 Copyright (C) 2019 Dimitar Toshkov Zhekov."
\r
155 ${NSD_CreateLabel} 2% 119u 96% 12u "Report bugs to \
\r
156 <dimitar.zhekov@gmail.com>"
\r
162 Function ter_dialog_page_leave
\r
164 ${NSD_GetState} $apply_ao2 $0
\r
165 ${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ao2 "ao2" ${|}
\r
166 ${NSD_GetState} $apply_dv1 $0
\r
167 ${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $dv1 "dv1" ${|}
\r
168 ${NSD_GetState} $apply_ge2 $0
\r
169 ${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ge2 "ge2" ${|}
\r
170 ${NSD_GetState} $apply_gq2 $0
\r
171 ${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $gq2 "gq2" ${|}
\r
172 ${NSD_GetState} $apply_ij1 $0
\r
173 ${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ij1 "ij1" ${|}
\r
174 ${NSD_GetState} $apply_ka2 $0
\r
175 ${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ka2 "ka2" ${|}
\r
176 ${NSD_GetState} $apply_ll2 $0
\r
177 ${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ll2 "ll2" ${|}
\r
178 ${NSD_GetState} $apply_td1 $0
\r
179 ${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $td1 "td1" ${|}
\r
181 ${NSD_GetState} $apply_hi2 $0
\r
182 ${If} $0 == ${BST_CHECKED}
\r
184 ${IfThen} $dv1 != "" ${|} StrCpy $dv1 "hi2-dv1" ${|}
\r
185 ${IfThen} $ka2 != "" ${|} StrCpy $ka2 "hi2-ka2" ${|}
\r
188 ${NSD_GetState} $install $instate
\r
189 ${If} $instate == ${BST_UNCHECKED}
\r
190 ${NSD_GetText} $directory $INSTDIR
\r
191 ${If} $INSTDIR == ""
\r
192 MessageBox MB_ICONSTOP|MB_OK "Unpack directory name required"
\r
203 ExecWait '"$OUTDIR\fcpw.exe" 4100 terminus.fon $1.txt' $R0
\r
205 MessageBox MB_OK|MB_ICONEXCLAMATION "Can't run $OUTDIR\fcpw.exe"
\r
206 Abort "Can't run $OUTDIR\fcpw.exe"
\r
208 ${IfThen} $R0 != 0 ${|} Abort "fcpw.exe failed with exit code $R0" ${|}
\r
218 !define Patch `!insertmacro PATCH`
\r
222 ${If} $instate == ${BST_CHECKED}
\r
224 SetOutPath "$PLUGINSDIR"
\r
226 SetOutPath "$INSTDIR"
\r
229 File "terminus.fon"
\r
253 ${If} $instate == ${BST_CHECKED}
\r
255 Push "$FONTS\terminus.fon"
\r
256 System::Call "Gdi32::RemoveFontResource(t s) i.r0"
\r
257 ${IfThen} $0 == 0 ${|} ${ExitFor} ${|}
\r
259 SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=250
\r
263 CopyFiles "$OUTDIR\terminus.fon" "$FONTS\terminus.fon"
\r
264 ${IfNotThen} ${Errors} ${|} ${Break} ${|}
\r
265 MessageBox MB_RETRYCANCEL|MB_ICONSTOP "Can't copy terminus.fon$\n\
\r
267 All programs using the font should be stopped." IDRETRY +2
\r
268 Abort "Can't copy terminus.fon"
\r
272 Push "$FONTS\terminus.fon"
\r
273 System::Call "Gdi32::AddFontResource(t s) i.r0"
\r
274 ${IfThen} $0 == 0 ${|} ${ExitFor} ${|}
\r
276 SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=250
\r
279 StrCpy $1 "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
\r
281 StrCpy $1 "SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts"
\r
283 WriteRegStr HKLM "$1" "Terminus" "terminus.fon"
\r
284 ReadRegStr $0 HKLM "$1" "Terminus"
\r
287 ${If} $0 != "terminus.fon"
\r
288 StrCpy $1 'If the font is not available after restart, open Control \
\r
289 Panel -> Fonts, find "Terminus" and open it.$\n$\n'
\r
291 MessageBox MB_OK '$1\
\r
292 Depending on the Windows font settings, some sizes may be unavailable. \
\r
293 For example, with "Medium - 125%" fonts, 8x14 and 12x24 will likely be \
\r
294 suppressed by 8x16 and 11x22 respectively. This seems to be Windows GUI \
\r
295 problem; if you remove 8x16 and 11x12 with a resource editor, 8x14 and \
\r
296 12x24 will work.$\n\
\r
298 Uninstallation: stop all programs using Terminus Font, open Control \
\r
299 Panel -> Fonts, find "Terminus" and delete it. If you get an Access \
\r
300 denied error, re-login or restart the system and try again.'
\r