1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-10 01:48:00 +00:00

Support for line attributes: ESC #3, #4 and #6 for double-width and

double-height text.

[originally from svn r2054]
This commit is contained in:
Simon Tatham 2002-10-15 00:22:48 +00:00
parent cf74237900
commit 74f8f8e8ac

View File

@ -281,7 +281,6 @@ gint key_event(GtkWidget *widget, GdkEventKey *event, gpointer data)
/* /*
* NYI: * NYI:
* - nethack mode
* - alt+numpad * - alt+numpad
* - Compose key (!!! requires Unicode faff before even trying) * - Compose key (!!! requires Unicode faff before even trying)
*/ */
@ -1047,7 +1046,6 @@ void do_text(Context ctx, int x, int y, char *text, int len,
/* /*
* NYI: * NYI:
* - Unicode, code pages, and ATTR_WIDE for CJK support. * - Unicode, code pages, and ATTR_WIDE for CJK support.
* - LATTR_* (ESC # 4 double-width and double-height stuff)
* - cursor shapes other than block * - cursor shapes other than block
* - shadow bolding * - shadow bolding
*/ */
@ -1068,6 +1066,12 @@ void do_text(Context ctx, int x, int y, char *text, int len,
nbg = NCOLOURS-1; nbg = NCOLOURS-1;
} }
if (lattr != LATTR_NORM) {
if (x*2 >= cols)
return;
x *= 2;
}
gdk_gc_set_foreground(gc, &inst->cols[nbg]); gdk_gc_set_foreground(gc, &inst->cols[nbg]);
gdk_draw_rectangle(inst->pixmap, gc, 1, gdk_draw_rectangle(inst->pixmap, gc, 1,
x*inst->font_width+cfg.window_border, x*inst->font_width+cfg.window_border,
@ -1090,6 +1094,44 @@ void do_text(Context ctx, int x, int y, char *text, int len,
y*inst->font_height + uheight + cfg.window_border); y*inst->font_height + uheight + cfg.window_border);
} }
if (lattr != LATTR_NORM) {
/*
* I can't find any plausible StretchBlt equivalent in the
* X server, so I'm going to do this the slow and painful
* way. This will involve repeated calls to
* gdk_draw_pixmap() to stretch the text horizontally. It's
* O(N^2) in time and O(N) in network bandwidth, but you
* try thinking of a better way. :-(
*/
int i;
for (i = 0; i < len * inst->font_width; i++) {
gdk_draw_pixmap(inst->pixmap, gc, inst->pixmap,
x*inst->font_width+cfg.window_border + 2*i,
y*inst->font_height+cfg.window_border,
x*inst->font_width+cfg.window_border + 2*i+1,
y*inst->font_height+cfg.window_border,
len * inst->font_width - i, inst->font_height);
}
len *= 2;
if (lattr != LATTR_WIDE) {
int dt, db;
/* Now stretch vertically, in the same way. */
if (lattr == LATTR_BOT)
dt = 0, db = 1;
else
dt = 1, db = 0;
for (i = 0; i < inst->font_height; i+=2) {
gdk_draw_pixmap(inst->pixmap, gc, inst->pixmap,
x*inst->font_width+cfg.window_border,
y*inst->font_height+cfg.window_border+dt*i+db,
x*inst->font_width+cfg.window_border,
y*inst->font_height+cfg.window_border+dt*(i+1),
len * inst->font_width, inst->font_height-i-1);
}
}
len *= 2;
}
gdk_draw_pixmap(inst->area->window, gc, inst->pixmap, gdk_draw_pixmap(inst->area->window, gc, inst->pixmap,
x*inst->font_width+cfg.window_border, x*inst->font_width+cfg.window_border,
y*inst->font_height+cfg.window_border, y*inst->font_height+cfg.window_border,