Skip to content
Snippets Groups Projects
Commit 00275311 authored by deuce's avatar deuce
Browse files

Add support for a DCS font loading command that won't break other terminals

(that support DCS strings).  With this, CSI = Ps1 ; Ps2 { is deprecated and
should not be used when CTerm is newer than this commit (1.213).
parent 68a01368
Branches
Tags
No related merge requests found
......@@ -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)
......
......@@ -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:
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment