First jameswitzema.net commit

This commit is contained in:
Lao Tzu
2026-05-29 11:30:10 -07:00
commit 32cc108c4a
200 changed files with 1200635 additions and 0 deletions
+92
View File
@@ -0,0 +1,92 @@
INT = python3
EXT = py
BIN = ../bin
UNI = ../uni
UCS2ANY = $(INT) $(BIN)/ucstoany.$(EXT)
BDF2FNT = $(INT) $(BIN)/bdftofnt.$(EXT) -fModern
CC32 = i686-w64-mingw32-gcc
CFLAGS = -O2 -Wall -Wextra
LDFLAGS = -mwindows -s
FONFLAGS = -shared -nostdlib -nostartfiles
RC32 = windres -F pe-i386
RM = rm -f
REG_MS_1252 = Microsoft CP1252
REG_MS_1250 = Microsoft CP1250
REG_MS_1253 = Microsoft CP1253
REG_MS_1254 = Microsoft CP1254
REG_MS_1251 = Microsoft CP1251
REG_MS_1257 = Microsoft CP1257
REG_MS_1255 = Microsoft CP1255
REG_IBM_437 = IBM CP437
REG_BG_MIK = Bulgarian MIK
FNT_MS_1252 = ter-112n.fnt ter-112b.fnt ter-114n.fnt ter-114b.fnt ter-116n.fnt ter-116b.fnt ter-118n.fnt ter-118b.fnt ter-120n.fnt ter-120b.fnt ter-122n.fnt ter-122b.fnt ter-124n.fnt ter-124b.fnt ter-128n.fnt ter-128b.fnt ter-132n.fnt ter-132b.fnt
FNT_MS_1250 = ter-212n.fnt ter-212b.fnt ter-214n.fnt ter-214b.fnt ter-216n.fnt ter-216b.fnt ter-218n.fnt ter-218b.fnt ter-220n.fnt ter-220b.fnt ter-222n.fnt ter-222b.fnt ter-224n.fnt ter-224b.fnt ter-228n.fnt ter-228b.fnt ter-232n.fnt ter-232b.fnt
FNT_MS_1253 = ter-712n.fnt ter-712b.fnt ter-714n.fnt ter-714b.fnt ter-716n.fnt ter-716b.fnt ter-718n.fnt ter-718b.fnt ter-720n.fnt ter-720b.fnt ter-722n.fnt ter-722b.fnt ter-724n.fnt ter-724b.fnt ter-728n.fnt ter-728b.fnt ter-732n.fnt ter-732b.fnt
FNT_MS_1254 = ter-912n.fnt ter-912b.fnt ter-914n.fnt ter-914b.fnt ter-916n.fnt ter-916b.fnt ter-918n.fnt ter-918b.fnt ter-920n.fnt ter-920b.fnt ter-922n.fnt ter-922b.fnt ter-924n.fnt ter-924b.fnt ter-928n.fnt ter-928b.fnt ter-932n.fnt ter-932b.fnt
FNT_MS_1251 = ter-c12n.fnt ter-c12b.fnt ter-c14n.fnt ter-c14b.fnt ter-c16n.fnt ter-c16b.fnt ter-c18n.fnt ter-c18b.fnt ter-c20n.fnt ter-c20b.fnt ter-c22n.fnt ter-c22b.fnt ter-c24n.fnt ter-c24b.fnt ter-c28n.fnt ter-c28b.fnt ter-c32n.fnt ter-c32b.fnt
FNT_MS_1257 = ter-d12n.fnt ter-d12b.fnt ter-d14n.fnt ter-d14b.fnt ter-d16n.fnt ter-d16b.fnt ter-d18n.fnt ter-d18b.fnt ter-d20n.fnt ter-d20b.fnt ter-d22n.fnt ter-d22b.fnt ter-d24n.fnt ter-d24b.fnt ter-d28n.fnt ter-d28b.fnt ter-d32n.fnt ter-d32b.fnt
FNT_MS_1255 = ter-h12n.fnt ter-h12b.fnt ter-h14n.fnt ter-h14b.fnt ter-h16n.fnt ter-h16b.fnt ter-h18n.fnt ter-h18b.fnt ter-h20n.fnt ter-h20b.fnt ter-h22n.fnt ter-h22b.fnt ter-h24n.fnt ter-h24b.fnt ter-h28n.fnt ter-h28b.fnt ter-h32n.fnt ter-h32b.fnt
FNT_IBM_437 = ter-i12n.fnt ter-i12b.fnt ter-i14n.fnt ter-i14b.fnt ter-i16n.fnt ter-i16b.fnt ter-i18n.fnt ter-i18b.fnt ter-i20n.fnt ter-i20b.fnt ter-i22n.fnt ter-i22b.fnt ter-i24n.fnt ter-i24b.fnt ter-i28n.fnt ter-i28b.fnt ter-i32n.fnt ter-i32b.fnt
FNT_BG_MIK = ter-m12n.fnt ter-m12b.fnt ter-m14n.fnt ter-m14b.fnt ter-m16n.fnt ter-m16b.fnt ter-m18n.fnt ter-m18b.fnt ter-m20n.fnt ter-m20b.fnt ter-m22n.fnt ter-m22b.fnt ter-m24n.fnt ter-m24b.fnt ter-m28n.fnt ter-m28b.fnt ter-m32n.fnt ter-m32b.fnt
FNT = $(FNT_MS_1252) $(FNT_MS_1250) $(FNT_MS_1253) $(FNT_MS_1254) $(FNT_MS_1251) $(FNT_MS_1257) $(FNT_MS_1255)
all: $(FNT) terminus.fon fcpw.exe
WIN_MS_1252 = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/win-1252.uni
WIN_MS_1250 = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/win-1250.uni
WIN_MS_1253 = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/win-1253.uni
WIN_MS_1254 = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/win-1254.uni
WIN_MS_1251 = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/x11-1251.uni $(UNI)/win-1251.uni
WIN_MS_1257 = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/x11-1257.uni $(UNI)/win-1257.uni
WIN_MS_1255 = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/win-1255.uni
WIN_IBM_437 = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/ibm-437.uni
WIN_BG_MIK = $(UNI)/cntrl.uni $(UNI)/ascii-h.uni $(UNI)/bg-mik.uni
$(FNT_MS_1252): ter-1%.fnt : ter-u%.bdf $(WIN_MS_1252)
$(UCS2ANY) $< $(REG_MS_1252) $(WIN_MS_1252) | $(BDF2FNT) -o $@
$(FNT_MS_1250): ter-2%.fnt : ter-u%.bdf $(WIN_MS_1250)
$(UCS2ANY) $< $(REG_MS_1250) $(WIN_MS_1250) | $(BDF2FNT) -o $@
$(FNT_MS_1253): ter-7%.fnt : ter-u%.bdf $(WIN_MS_1253)
$(UCS2ANY) $< $(REG_MS_1253) $(WIN_MS_1253) | $(BDF2FNT) -o $@
$(FNT_MS_1254): ter-9%.fnt : ter-u%.bdf $(WIN_MS_1254)
$(UCS2ANY) $< $(REG_MS_1254) $(WIN_MS_1254) | $(BDF2FNT) -o $@
$(FNT_MS_1251): ter-c%.fnt : ter-u%.bdf $(WIN_MS_1251)
$(UCS2ANY) $< $(REG_MS_1251) $(WIN_MS_1251) | $(BDF2FNT) -o $@
$(FNT_MS_1257): ter-d%.fnt : ter-u%.bdf $(WIN_MS_1257)
$(UCS2ANY) $< $(REG_MS_1257) $(WIN_MS_1257) | $(BDF2FNT) -o $@
$(FNT_MS_1255): ter-h%.fnt : ter-u%.bdf $(WIN_MS_1255)
$(UCS2ANY) $< $(REG_MS_1255) $(WIN_MS_1255) | $(BDF2FNT) -o $@
$(FNT_IBM_437): ter-i%.fnt : ter-u%.bdf $(WIN_IBM_437)
$(UCS2ANY) -F Terminal $< $(REG_IBM_437) $(WIN_IBM_437) | $(BDF2FNT) -o $@
$(FNT_BG_MIK): ter-m%.fnt : ter-u%.bdf $(WIN_BG_MIK)
$(UCS2ANY) -F Terminal $< $(REG_BG_MIK) $(WIN_BG_MIK) | $(BDF2FNT) -o $@
fnt: $(FNT)
fnt-255: $(FNT_IBM_437) $(FNT_BG_MIK)
ter-font.o: $(FNT) ter-font.rc
$(RC32) -o $@ ter-font.rc
terminus.fon: ter-main.c ter-font.o
$(CC32) $(CFLAGS) $(LDFLAGS) $(FONFLAGS) -o $@ ter-main.c ter-font.o
fcpw.exe: fcp.c
$(CC32) -DFCPW $(CFLAGS) $(LDFLAGS) -o $@ $<
clean:
$(RM) ter-*.bdf ter-*.fnt *.txt ter-*.o terminus.fon fcpw.exe
.PHONY: all fnt fnt-255 clean
+41
View File
@@ -0,0 +1,41 @@
if errorlevel 1 type nul
if not exist dup\nul mkdir dup
if errorlevel 1 exit /b
if not errorlevel 1 copy /y ..\ter-*.bdf
if not errorlevel 1 make -B -j8 terminus.fon
if not errorlevel 1 move /y terminus.fon terminus.bak
if not errorlevel 1 call :difftofcp ao2
if not errorlevel 1 call :difftofcp dv1
if not errorlevel 1 call :difftofcp ge2
if not errorlevel 1 call :difftofcp gq2
if not errorlevel 1 call :difftofcp ij1
if not errorlevel 1 copy /y ..\dup\xos4-2.dup dup
if not errorlevel 1 call :difftofcp ka2
if not errorlevel 1 call :difftofcp ll2
if not errorlevel 1 call :difftofcp td1
if not errorlevel 1 call :difftofcp hi2
if not errorlevel 1 move /y terminus.fon terminus.bak
if not errorlevel 1 patch --binary -p1 < ..\alt\hi2.diff
if not errorlevel 1 call :difftofcp hi2-dv1
if not errorlevel 1 patch --binary -p1 < ..\alt\hi2.diff
if not errorlevel 1 copy /y ..\dup\xos4-2.dup dup
if not errorlevel 1 call :difftofcp hi2-ka2
if not errorlevel 1 make -B -j8 terminus.fon
if not errorlevel 1 make fcpw.exe
if not errorlevel 1 del ter-*.bdf ter-*.fnt terminus.bak ter-*.o dup\xos4-2.dup
exit /b
:difftofcp
if not errorlevel 1 patch --binary -p1 < ..\alt\%1.diff
if not errorlevel 1 make -B -j8 fnt
if not errorlevel 1 make terminus.fon
if not errorlevel 1 fc /b terminus.bak terminus.fon > %1.txt
rem fc sets errorlevel 1 on differences
if not errorlevel 2 copy /y ..\ter-*.bdf
+171
View File
@@ -0,0 +1,171 @@
#include <fcntl.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
#ifdef FCPW
#include <windows.h>
#define FCP "fcpw"
#else
#define FCP "fcp"
#endif
#ifndef O_BINARY
#define O_BINARY 0
#endif
static void fatal(const char *format, ...)
{
va_list ap;
#ifdef FCPW
char buffer[640];
va_start(ap, format);
vsnprintf(buffer, sizeof buffer, format, ap);
MessageBox(NULL, buffer, FCP, MB_ICONSTOP | MB_OK);
#else
fprintf(stderr, "%s: ", FCP);
va_start(ap, format);
vfprintf(stderr, format, ap);
fputc('\n', stderr);
#endif
va_end(ap);
exit(1);
}
static void error(const char *s)
{
#ifdef FCPW
char buffer[640];
snprintf(buffer, sizeof buffer, "%s: %s", s, strerror(errno));
MessageBox(NULL, buffer, FCP, MB_ICONSTOP | MB_OK);
#else
fprintf(stderr, "%s: ", FCP);
perror(s);
#endif
exit(1);
}
#define SIZE ((1 << 24) + 1)
#ifdef FCPW
#define main wrap
#endif
static const char *USAGE =
"usage: " FCP " [OFFSET] FILE PATCH\n"
"\n"
FCP " 0.10.2, Copyright (C) 2017 Dimitar Toshkov Zhekov\n"
"\n"
"This program is free software; you can redistribute it and/or modify it\n"
"under the terms of the GNU General Public License as published by the Free\n"
"Software Foundation; either version 2 of the License, or (at your option)\n"
"any later version.\n"
"\n"
"This program is distributed in the hope that it will be useful, but\n"
"WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n"
"or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n"
"for more details.\n"
"\n"
"You should have received a copy of the GNU General Public License along\n"
"with this program; if not, write to the Free Software Foundation, Inc.,\n"
"51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n";
int main(int argc, char **argv)
{
unsigned char *buffer;
const char *name, *patch;
int f, n;
FILE *p;
char s[0x80];
long ignore;
long minoff = -1, maxoff;
if (argc == 4)
{
argv++;
if (sscanf(*argv, "%lx%n", &ignore, &n) != 1 || n != (int) strlen(*argv)) fatal("%s: invalid offset", *argv);
if (ignore < 0 || ignore >= SIZE) fatal("%s: offset out of range", ignore);
}
else if (argc != 3)
{
#ifdef FCPW
MessageBox(NULL, USAGE, FCP, MB_OK);
#else
fputs(USAGE, stderr);
#endif
return 1;
}
if ((buffer = malloc(SIZE)) == NULL) error(FCP);
name = argv[1];
patch = argv[2];
if ((f = open(name, O_RDWR | O_BINARY)) == -1) error(name);
if ((n = read(f, buffer, SIZE)) == -1) error(name);
if (n == SIZE) fatal("%s: larger than %d bytes", name, SIZE - 1);
if ((p = fopen(patch, "r")) == NULL) error(patch);
while (fgets(s, sizeof s, p) != NULL)
{
char *lf;
long offset;
unsigned orig, chng;
if ((lf = strchr(s, '\n')) != NULL) *lf = '\0';
if (sscanf(s, "%lx: %x %x%n", &offset, &orig, &chng, &n) == 3 && n == (int) strlen(s))
{
if (offset < 0 || offset >= SIZE) fatal("%s: offset out of range", s);
if (orig > 0xFF || chng > 0xFF) fatal("%s: byte(s) out of range", s);
if (offset >= ignore)
{
if (buffer[offset] != orig) fatal("offset %lx not equal to %x", offset, orig);
if (orig != chng)
{
if (minoff == -1) minoff = offset;
buffer[maxoff = offset] = chng;
}
}
}
#ifdef FCPW
#else
else
fprintf(stderr, "%s: `%s'\n", patch, s);
#endif
}
if (minoff >= 0)
{
if (lseek(f, minoff, SEEK_SET) == -1) error(name);
if (write(f, buffer + minoff, maxoff - minoff + 1) == -1) error(name);
}
if (close(f) == -1) error(name);
if (fclose(p) == -1) error(patch);
return 0;
}
#ifdef FCPW
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int i;
(void) hInstance;
(void) hPrevInstance;
(void) lpCmdLine;
(void) nCmdShow;
for (i = 1; i < __argc; i++)
if (strlen(__argv[i]) > 255) fatal("argument %d too long", i);
return wrap(__argc, __argv);
}
#endif
+132
View File
@@ -0,0 +1,132 @@
100 FONT ter-112b.fnt
101 FONT ter-112n.fnt
102 FONT ter-114b.fnt
103 FONT ter-114n.fnt
104 FONT ter-116b.fnt
105 FONT ter-116n.fnt
106 FONT ter-118b.fnt
107 FONT ter-118n.fnt
108 FONT ter-120b.fnt
109 FONT ter-120n.fnt
110 FONT ter-122b.fnt
111 FONT ter-122n.fnt
112 FONT ter-124b.fnt
114 FONT ter-124n.fnt
115 FONT ter-128b.fnt
116 FONT ter-128n.fnt
117 FONT ter-132b.fnt
118 FONT ter-132n.fnt
120 FONT ter-212b.fnt
121 FONT ter-212n.fnt
122 FONT ter-214b.fnt
123 FONT ter-214n.fnt
124 FONT ter-216b.fnt
125 FONT ter-216n.fnt
126 FONT ter-218b.fnt
127 FONT ter-218n.fnt
128 FONT ter-220b.fnt
129 FONT ter-220n.fnt
130 FONT ter-222b.fnt
131 FONT ter-222n.fnt
132 FONT ter-224b.fnt
133 FONT ter-224n.fnt
134 FONT ter-228b.fnt
135 FONT ter-228n.fnt
136 FONT ter-232b.fnt
137 FONT ter-232n.fnt
140 FONT ter-712b.fnt
141 FONT ter-712n.fnt
142 FONT ter-714b.fnt
143 FONT ter-714n.fnt
144 FONT ter-716b.fnt
145 FONT ter-716n.fnt
146 FONT ter-718b.fnt
147 FONT ter-718n.fnt
148 FONT ter-720b.fnt
149 FONT ter-720n.fnt
150 FONT ter-722b.fnt
151 FONT ter-722n.fnt
152 FONT ter-724b.fnt
153 FONT ter-724n.fnt
154 FONT ter-728b.fnt
155 FONT ter-728n.fnt
156 FONT ter-732b.fnt
157 FONT ter-732n.fnt
160 FONT ter-912b.fnt
161 FONT ter-912n.fnt
162 FONT ter-914b.fnt
163 FONT ter-914n.fnt
164 FONT ter-916b.fnt
165 FONT ter-916n.fnt
166 FONT ter-918b.fnt
167 FONT ter-918n.fnt
168 FONT ter-920b.fnt
169 FONT ter-920n.fnt
170 FONT ter-922b.fnt
171 FONT ter-922n.fnt
172 FONT ter-924b.fnt
173 FONT ter-924n.fnt
174 FONT ter-928b.fnt
175 FONT ter-928n.fnt
176 FONT ter-932b.fnt
177 FONT ter-932n.fnt
180 FONT ter-c12b.fnt
181 FONT ter-c12n.fnt
182 FONT ter-c14b.fnt
183 FONT ter-c14n.fnt
184 FONT ter-c16b.fnt
185 FONT ter-c16n.fnt
186 FONT ter-c18b.fnt
187 FONT ter-c18n.fnt
188 FONT ter-c20b.fnt
189 FONT ter-c20n.fnt
190 FONT ter-c22b.fnt
191 FONT ter-c22n.fnt
192 FONT ter-c24b.fnt
193 FONT ter-c24n.fnt
194 FONT ter-c28b.fnt
195 FONT ter-c28n.fnt
196 FONT ter-c32b.fnt
197 FONT ter-c32n.fnt
200 FONT ter-d12b.fnt
201 FONT ter-d12n.fnt
202 FONT ter-d14b.fnt
203 FONT ter-d14n.fnt
204 FONT ter-d16b.fnt
205 FONT ter-d16n.fnt
206 FONT ter-d18b.fnt
207 FONT ter-d18n.fnt
208 FONT ter-d20b.fnt
209 FONT ter-d20n.fnt
210 FONT ter-d22b.fnt
211 FONT ter-d22n.fnt
212 FONT ter-d24b.fnt
214 FONT ter-d24n.fnt
215 FONT ter-d28b.fnt
216 FONT ter-d28n.fnt
217 FONT ter-d32b.fnt
218 FONT ter-d32n.fnt
220 FONT ter-h12b.fnt
221 FONT ter-h12n.fnt
222 FONT ter-h14b.fnt
223 FONT ter-h14n.fnt
224 FONT ter-h16b.fnt
225 FONT ter-h16n.fnt
226 FONT ter-h18b.fnt
227 FONT ter-h18n.fnt
228 FONT ter-h20b.fnt
229 FONT ter-h20n.fnt
230 FONT ter-h22b.fnt
231 FONT ter-h22n.fnt
232 FONT ter-h24b.fnt
233 FONT ter-h24n.fnt
234 FONT ter-h28b.fnt
235 FONT ter-h28n.fnt
236 FONT ter-h32b.fnt
237 FONT ter-h32n.fnt
+9
View File
@@ -0,0 +1,9 @@
#include <windows.h>
BOOL WINAPI DllMainCRTStartup(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
(void) hinstDLL;
(void) fdwReason;
(void) lpvReserved;
return TRUE;
}
+298
View File
@@ -0,0 +1,298 @@
#
# Copyright (c) 2020 Dimitar Toshkov Zhekov <dimitar.zhekov@gmail.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2 of the License, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
!include nsDialogs.nsh
!include LogicLib.nsh
!include FileFunc.nsh
!include WinVer.nsh
Name "Terminus Font"
OutFile terminus-font-4.49.exe
XPStyle on
CRCCheck force
RequestExecutionLevel admin
InstallDir "$EXEDIR\terminus-font-4.49"
InstallButtonText "Proceed"
Var apply_ao2
Var apply_dv1
Var apply_ge2
Var apply_gq2
Var apply_ij1
Var apply_ka2
Var apply_ll2
Var apply_td1
Var apply_hi2
Var install
Var unpack
Var hamster
Var directory
Var browse
Var ao2
Var dv1
Var ge2
Var gq2
Var ij1
Var ka2
Var ll2
Var td1
Var hi2
Var instate
Page custom ter_dialog_page ter_dialog_page_leave
Page instfiles
Function install_clicked
EnableWindow $directory 0
EnableWindow $browse 0
${NSD_SetText} $directory $FONTS
FunctionEnd
Function unpack_clicked
${NSD_SetText} $directory $INSTDIR
EnableWindow $directory 1
EnableWindow $browse 1
FunctionEnd
Function hamster_clicked
ExecShell "open" "http://terminus-font.sourceforge.net#variants"
ToolTips::Classic $hamster "http://terminus-font.sourceforge.net#variants"
FunctionEnd
Function browse_clicked
nsDialogs::SelectFolderDialog Directory $INSTDIR
Pop $0
${If} $0 != error
StrCpy $INSTDIR $0
${NSD_SetText} $directory $INSTDIR
${EndIf}
FunctionEnd
Function ter_dialog_page
nsDialogs::Create 1018
Pop $0
${If} $0 == error
MessageBox MB_ICONSTOP|MB_OK "Failed to create installation dialog."
Abort
${EndIf}
${NSD_CreateLink} 2% 1 11% 10u "Variants"
Pop $hamster
${NSD_OnClick} $hamster hamster_clicked
ToolTips::Classic $hamster "http://terminus-font.sourceforge.net#variants"
${NSD_CreateGroupBox} 0 0 100% 25u ""
${NSD_CreateCheckBox} 2% 10u 11% 12u "ao2"
Pop $apply_ao2
${NSD_CreateCheckBox} 13% 10u 11% 12u "dv1"
Pop $apply_dv1
${NSD_CreateCheckBox} 24% 10u 11% 12u "ge2"
Pop $apply_ge2
${NSD_CreateCheckBox} 35% 10u 11% 12u "gq2"
Pop $apply_gq2
${NSD_CreateCheckBox} 46% 10u 10% 12u "ij1"
Pop $apply_ij1
${NSD_CreateCheckBox} 56% 10u 11% 12u "ka2"
Pop $apply_ka2
${NSD_CreateCheckBox} 67% 10u 10% 12u "ll2"
Pop $apply_ll2
${NSD_CreateCheckBox} 77% 10u 11% 12u "td1"
Pop $apply_td1
${NSD_CreateCheckBox} 88% 10u 11% 12u "hi2"
Pop $apply_hi2
${NSD_CreateRadioButton} 0 28u 14% 12u "Install"
Pop $install
${NSD_AddStyle} $install ${WS_GROUP}
${NSD_Check} $install
${NSD_OnClick} $install install_clicked
${NSD_CreateRadioButton} 15% 28u 35% 12u "Unpack and patch only"
Pop $unpack
${NSD_UnCheck} $unpack
${NSD_OnClick} $unpack unpack_clicked
${NSD_CreateFileRequest} 0% 42u 95% 12u ""
Pop $directory
${NSD_CreateBrowseButton} 95% 42u 5% 12u "..."
Pop $browse
${NSD_OnClick} $browse browse_clicked
Call install_clicked
${NSD_CreateHLine} 0 57u 100% 1u
Pop $0
${NSD_AddStyle} $0 ${WS_GROUP}
${NSD_CreateLabel} 2% 63u 96% 8u "Terminus Font is licensed under \
the SIL Open Font License, Version 1.1."
${NSD_CreateLabel} 2% 71u 96% 12u "The license is available with a \
FAQ at: http://scripts.sil.org/OFL"
${NSD_CreateLabel} 2% 83u 96% 24u "Note: the Windows code pages \
contain a total of 384 characters. All other characters \
(math, pseudographics etc.) are not currently available."
${NSD_CreateLabel} 2% 107u 96% 12u "Terminus Font 4.49, \
Copyright (C) 2020 Dimitar Toshkov Zhekov."
${NSD_CreateLabel} 2% 119u 96% 12u "Report bugs to \
<dimitar.zhekov@gmail.com>"
nsDialogs::Show
FunctionEnd
Function ter_dialog_page_leave
${NSD_GetState} $apply_ao2 $0
${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ao2 "ao2" ${|}
${NSD_GetState} $apply_dv1 $0
${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $dv1 "dv1" ${|}
${NSD_GetState} $apply_ge2 $0
${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ge2 "ge2" ${|}
${NSD_GetState} $apply_gq2 $0
${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $gq2 "gq2" ${|}
${NSD_GetState} $apply_ij1 $0
${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ij1 "ij1" ${|}
${NSD_GetState} $apply_ka2 $0
${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ka2 "ka2" ${|}
${NSD_GetState} $apply_ll2 $0
${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $ll2 "ll2" ${|}
${NSD_GetState} $apply_td1 $0
${IfThen} $0 == ${BST_CHECKED} ${|} StrCpy $td1 "td1" ${|}
${NSD_GetState} $apply_hi2 $0
${If} $0 == ${BST_CHECKED}
StrCpy $hi2 "hi2"
${IfThen} $dv1 != "" ${|} StrCpy $dv1 "hi2-dv1" ${|}
${IfThen} $ka2 != "" ${|} StrCpy $ka2 "hi2-ka2" ${|}
${EndIf}
${NSD_GetState} $install $instate
${If} $instate == ${BST_UNCHECKED}
${NSD_GetText} $directory $INSTDIR
${If} $INSTDIR == ""
MessageBox MB_ICONSTOP|MB_OK "Unpack directory name required"
Abort
${EndIf}
${EndIf}
FunctionEnd
Function patch
Pop $1
${If} $1 != ""
ClearErrors
ExecWait '"$OUTDIR\fcpw.exe" 4100 terminus.fon $1.txt' $R0
${If} ${Errors}
MessageBox MB_OK|MB_ICONEXCLAMATION "Can't run $OUTDIR\fcpw.exe"
Abort "Can't run $OUTDIR\fcpw.exe"
${EndIf}
${IfThen} $R0 != 0 ${|} Abort "fcpw.exe failed with exit code $R0" ${|}
${EndIf}
FunctionEnd
!macro PATCH arg
push ${arg}
Call patch
!macroend
!define Patch `!insertmacro PATCH`
Section "Install"
${If} $instate == ${BST_CHECKED}
InitPluginsDir
SetOutPath $PLUGINSDIR
${Else}
SetOutPath $INSTDIR
${EndIf}
File "terminus.fon"
File "fcpw.exe"
File "ao2.txt"
File "dv1.txt"
File "ge2.txt"
File "gq2.txt"
File "ij1.txt"
File "ka2.txt"
File "ll2.txt"
File "td1.txt"
File "hi2.txt"
File "hi2-dv1.txt"
File "hi2-ka2.txt"
${Patch} $ao2
${Patch} $ge2
${Patch} $gq2
${Patch} $ij1
${Patch} $hi2
${Patch} $dv1
${Patch} $ka2
${Patch} $ll2
${Patch} $td1
${If} $instate == ${BST_CHECKED}
${For} $R0 1 15
Push "$FONTS\terminus.fon"
System::Call "Gdi32::RemoveFontResource(t s) i.r0"
${IfThen} $0 == 0 ${|} ${ExitFor} ${|}
${Next}
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=250
${Do}
ClearErrors
CopyFiles "$OUTDIR\terminus.fon" "$FONTS\terminus.fon"
${IfNotThen} ${Errors} ${|} ${Break} ${|}
MessageBox MB_RETRYCANCEL|MB_ICONSTOP "Can't copy terminus.fon$\n\
$\n\
All programs using the font should be stopped." IDRETRY +2
Abort "Can't copy terminus.fon"
${Loop}
${For} $R1 1 $R0
Push "$FONTS\terminus.fon"
System::Call "Gdi32::AddFontResource(t s) i.r0"
${IfThen} $0 == 0 ${|} ${ExitFor} ${|}
${Next}
SendMessage ${HWND_BROADCAST} ${WM_FONTCHANGE} 0 0 /TIMEOUT=250
${If} ${IsNT}
StrCpy $1 "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts"
${Else}
StrCpy $1 "SOFTWARE\Microsoft\Windows\CurrentVersion\Fonts"
${EndIf}
WriteRegStr HKLM $1 "Terminus" "terminus.fon"
ReadRegStr $0 HKLM $1 "Terminus"
StrCpy $1 ""
${If} $0 != "terminus.fon"
StrCpy $1 'If the font is not available after restart, open Control \
Panel -> Fonts, find "Terminus" and open it.$\n$\n'
${EndIf}
MessageBox MB_OK '$1\
Depending on the Windows font settings, some sizes may be unavailable. \
For example, with "Medium - 125%" fonts, 8x14 and 12x24 will likely be \
suppressed by 8x16 and 11x22 respectively. This seems to be Windows GUI \
problem; if you remove 8x16 and 11x12 with a resource editor, 8x14 and \
12x24 will work.$\n\
$\n\
Uninstallation: stop all programs using Terminus Font, open Control \
Panel -> Fonts, find "Terminus" and delete it. If you get an Access \
denied error, re-login or restart the system and try again.'
${Else}
File "..\AUTHORS"
File "..\CHANGES"
File "..\OFL.TXT"
${EndIf}
SectionEnd