diff --git a/src/conio/GNUmakefile b/src/conio/GNUmakefile index 2eb6e0fe55aad4cbc2cf06ed74aee42ccb8aadd8..216c917b2edddbf9535f4bd592dafee271d19686 100644 --- a/src/conio/GNUmakefile +++ b/src/conio/GNUmakefile @@ -2,7 +2,7 @@ SRC_ROOT = .. # Cross platform/compiler definitions include $(SRC_ROOT)/build/Common.gmake # defines clean and output directory rules -CFLAGS += $(XPDEV-MT_CFLAGS) $(CIOLIB-MT_CFLAGS) +CFLAGS += $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) $(CIOLIB-MT_CFLAGS) ifeq ($(os),win32) OBJS += $(MTOBJODIR)$(DIRSEP)SDL_win32_main$(OFILE) diff --git a/src/conio/cterm.c b/src/conio/cterm.c index 8be47b224ce3d0f15438f119386ad769da0bc343..72a979449e7cb608e0e3f121e2c10c8d7f145aaf 100644 --- a/src/conio/cterm.c +++ b/src/conio/cterm.c @@ -50,6 +50,7 @@ #include "cterm.h" #include "vidmodes.h" +#include "base64.h" #define BUFSIZE 2048 @@ -2635,6 +2636,47 @@ static void do_ansi(struct cterminal *cterm, char *retbuf, size_t retsize, int * case CTERM_STRING_DCS: if (cterm->sixel == SIXEL_STARTED) parse_sixel_string(cterm, true); + else { + if (strncmp(cterm->strbuf, "CTerm:Font:", 11) == 0) { + cterm->font_slot = strtoul(cterm->strbuf+11, &p, 10); + if (p && *p == ':') { + p++; + i = b64_decode(cterm->fontbuf, sizeof(cterm->fontbuf), p, 0); + switch (i) { + case 4096: + p2 = malloc(i); + if (p2) { + memcpy(p2, cterm->fontbuf, i); + FREE_AND_NULL(conio_fontdata[cterm->font_slot].eight_by_sixteen); + conio_fontdata[cterm->font_slot].eight_by_sixteen=p2; + FREE_AND_NULL(conio_fontdata[cterm->font_slot].desc); + conio_fontdata[cterm->font_slot].desc=strdup("Remote Defined Font"); + } + break; + case 3584: + p2 = malloc(i); + if (p2) { + memcpy(p2, cterm->fontbuf, i); + FREE_AND_NULL(conio_fontdata[cterm->font_slot].eight_by_fourteen); + conio_fontdata[cterm->font_slot].eight_by_fourteen=p2; + FREE_AND_NULL(conio_fontdata[cterm->font_slot].desc); + conio_fontdata[cterm->font_slot].desc=strdup("Remote Defined Font"); + } + break; + case 2048: + p2 = malloc(i); + if (p2) { + memcpy(p2, cterm->fontbuf, i); + FREE_AND_NULL(conio_fontdata[cterm->font_slot].eight_by_eight); + conio_fontdata[cterm->font_slot].eight_by_eight=p2; + FREE_AND_NULL(conio_fontdata[cterm->font_slot].desc); + conio_fontdata[cterm->font_slot].desc=strdup("Remote Defined Font"); + } + break; + } + } + } + } cterm->sixel = SIXEL_INACTIVE; break; case CTERM_STRING_OSC: diff --git a/src/conio/cterm.h b/src/conio/cterm.h index 58c10f2b526f2b9acd25516911cb9b9293fb9104..a745d500e64ebead3275445b8ab67c3607baef1d 100644 --- a/src/conio/cterm.h +++ b/src/conio/cterm.h @@ -143,7 +143,7 @@ struct cterminal { int ypos; cterm_log_t log; FILE* logfile; - char fontbuf[4096]; // Remote font + char fontbuf[4097]; // Remote font int font_read; // Current position in fontbuf int font_slot; int font_size; // Bytes diff --git a/src/conio/cterm.txt b/src/conio/cterm.txt index 48905cb8416502cf55dba334ebc96b7fa3f8399d..57ace685fc74dd08a8b3a3d4a37374cb9ad29ab9 100644 --- a/src/conio/cterm.txt +++ b/src/conio/cterm.txt @@ -72,6 +72,15 @@ ESC P Device Control String Begins a string consisting of the characters 0x08 - 0x0d and 0x20-0x7e, terminated by a String Terminator (ST) Supported OSC values: + "CTerm:Font:p1:<b64>" + Indicates the string is a loadable font. (CTerm 1.213) + + p1 is a font slot number, which must be higher than the last + default defined font (See CSI sp D for list of predefined + fonts). <b64> is the base64 encoded font data. Font size is + deduced from the size of the data. This replaces the now + deprecated CSI = Ps1 ; Ps2 { + [ p1 [ ; p2 ] ] q Defaults: p1 = 0 p2 = 0 Indicates the string is a sixel sequence. @@ -491,7 +500,7 @@ CSI < Ps c CSI < 0 ; Ps... c Possible values for Ps: - 1 - Loadable fonts are availabe via CSI = Ps1 ; Ps2 { + 1 - Loadable fonts are availabe via Device Control Strings 2 - Palette entries may be modified via an Operating System Command string 3 - Pixel operations are supported (currently, sixel graphics) @@ -786,7 +795,7 @@ CSI u SOURCE: ANSI.SYS CSI = Ps1 ; Ps2 { - NON-STANDARD EXTENSION. + NON-STANDARD EXTENSION (Deprecated) Defaults: Ps1 = 255 Ps2 = 0 Indicates that a font block is following. Ps1 indicates the font slot to place the loaded font into. This must @@ -797,6 +806,8 @@ CSI = Ps1 ; Ps2 { 1 - 8x14 font, 3584 bytes. 2 - 8x8 font, 2048 bytes. + The DCS font string should be used instead as of CTerm 1.213 + SOURCE: CTerm only. "ANSI" Music diff --git a/src/syncterm/GNUmakefile b/src/syncterm/GNUmakefile index 0c387fd6dbbbbc88d03fd7cc92ae871833ed8fd6..0ca739e4ad76171438f555c390dc23ce923c1c2a 100644 --- a/src/syncterm/GNUmakefile +++ b/src/syncterm/GNUmakefile @@ -105,8 +105,8 @@ else endif CFLAGS += -DSYSTEM_LIST_DIR=\"${SYSTEM_LIST_DIR}\" -CFLAGS += $(UIFC-MT_CFLAGS) $(CIOLIB-MT_CFLAGS) $(XPDEV-MT_CFLAGS) -I../sbbs3 -I../smblib -I../comio -LDFLAGS += $(UIFC-MT_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(CRYPT_LDFLAGS) +CFLAGS += $(UIFC-MT_CFLAGS) $(CIOLIB-MT_CFLAGS) $(XPDEV-MT_CFLAGS) $(SMBLIB_CFLAGS) -I../sbbs3 -I../smblib -I../comio +LDFLAGS += $(UIFC-MT_LDFLAGS) $(CIOLIB-MT_LDFLAGS) $(XPDEV-MT_LDFLAGS) $(SMBLIB_LDFLAGS) $(CRYPT_LDFLAGS) vpath %.c ../sbbs3 ../smblib ../uifc ../guts ../comio @@ -147,7 +147,7 @@ $(MTOBJODIR)$(DIRSEP)ciolib_res$(OFILE): $(SYNCTERM): $(CRYPT_DEPS) $(EXEODIR) $(OBJS) $(BUILD_DEPENDS) @echo Linking $@ - ${QUIET}$(CC) $(LDFLAGS) $(MT_LDFLAGS) $(OBJS) -o $@ $(UIFC-MT_LIBS) $(EXTRA_LIBS) $(CIOLIB-MT_LIBS) $(WXLIBS) $(XPDEV-MT_LIBS) + ${QUIET}$(CC) $(LDFLAGS) $(MT_LDFLAGS) $(OBJS) -o $@ $(UIFC-MT_LIBS) $(EXTRA_LIBS) $(CIOLIB-MT_LIBS) $(SMBLIB_LIBS) $(WXLIBS) $(XPDEV-MT_LIBS) ifeq ($(os),darwin) -${QUIET}mkdir $(EXEODIR)/SyncTERM.app -${QUIET}mkdir $(EXEODIR)/SyncTERM.app/Contents diff --git a/src/syncterm/targets.mk b/src/syncterm/targets.mk index 79b88d7a87f0609d137089cb247027b3ea12aab5..0103a675ce0f8365c35e8e0dbd36aa9b005f4aac 100644 --- a/src/syncterm/targets.mk +++ b/src/syncterm/targets.mk @@ -2,5 +2,5 @@ SYNCTERM = $(EXEODIR)$(DIRSEP)syncterm$(EXEFILE) all: xpdev-mt ciolib-mt uifc-mt $(MTOBJODIR) $(EXEODIR) $(SYNCTERM) -$(SYNCTERM): $(XPDEV-MT_LIB) $(CIOLIB-MT) $(UIFCLIB-MT) +$(SYNCTERM): $(XPDEV-MT_LIB) $(CIOLIB-MT) $(UIFCLIB-MT) $(SMBLIB)