|
Errr... I guess I forgot to attach the patch :) On Wed, 3 Jan 2001, Scott Klement wrote: > > On Wed, 3 Jan 2001, Frank Richter wrote: > > > > I think its a really bad idea to use a hard-coded font size & name inside > > > cursesterm. Instead, why don't we make this an option that can be set > > > in your configuration? > > > > You're right. But I already wrote, that the fonts should be > > configurable, but I've not the time, to implement it now. > > So you have the choice of implementing this feature or waiting and > > meanwhile configuring the fonts by changing the source and recompiling. > > > > My patch is in no way intended to go into CVS in its current state. > > > > This patch implements the same functionality as the one that you recently > submitted, except that it uses config options to do it, and if the options > aren't given, it falls back to tn5250's prior behavior. > > Apply the patch to the current devel version from the src > directory. > > Put an entry in your ~/.tn5250rc that looks something like: > > W3 { > env.DEVNAME = w3 > host = as400.whatever.com > -underscores > env.TERM=IBM-3477-FC > xterm_font80 = 9x15 > xterm_font132 = fixed > } > > then try: xt5250 W3 > > > Doing it this way, people can set it up however they want it... I'd even > recommend putting it in CVS. :) > > -Scott > > > +--- > | This is the LINUX5250 Mailing List! > | To submit a new message, send your mail to LINUX5250@midrange.com. > | To subscribe to this list send email to LINUX5250-SUB@midrange.com. > | To unsubscribe from this list send email to LINUX5250-UNSUB@midrange.com. > | Questions should be directed to the list owner/operator: david@midrange.com > +--- >
diff -u ../../orig/src/cursesterm.c ./cursesterm.c --- ../../orig/src/cursesterm.c Wed Dec 6 13:30:38 2000 +++ ./cursesterm.c Wed Jan 3 15:13:35 2001 @@ -121,6 +121,8 @@ Key * k_map; int k_map_len; #endif + char * xterm_font80; + char * xterm_font132; int quit_flag : 1; int have_underscores : 1; int underscores : 1; @@ -275,6 +277,8 @@ r->data->last_width = 0; r->data->last_height = 0; r->data->is_xterm = 0; + r->data->xterm_font80 = NULL; + r->data->xterm_font132 = NULL; #ifdef USE_OWN_KEY_PARSING r->data->k_buf_len = 0; @@ -428,6 +432,37 @@ This->data->underscores = u; } + +/****i* lib5250/tn5250_curses_terminal_set_xterm_font + * NAME + * tn5250_curses_terminal_set_xterm_font + * SYNOPSIS + * tn5250_curses_terminal_set_xterm_font (This, font80, font132); + * INPUTS + * Tn5250Terminal * This - curses terminal object + * const char * font80 - string to send when using 80 col font + * const char * font132 - string to send when using 132 col font + * DESCRIPTION + * When using an xterm, it is sometimes desirable to change fonts when + * switching from 80 to 132 col mode. If this is not explicitly set, + * no font-change will be sent to the xterm. + * + * Font changes consist of "\x1b]50;<font string>\x07". You only need + * specify the "<font string>" portion as an argument to this function. + *****/ +void tn5250_curses_terminal_set_xterm_font (Tn5250Terminal *This, + const char *font80, const char *font132) +{ + This->data->xterm_font80 = g_malloc(strlen(font80) + 6); + This->data->xterm_font132 = g_malloc(strlen(font132) + 6); + sprintf(This->data->xterm_font80, "\x1b]50;%s\x07", font80); + sprintf(This->data->xterm_font132, "\x1b]50;%s\x07", font132); + TN5250_LOG(("xterm_font80 = %s.\n",This->data->xterm_font80)); + TN5250_LOG(("xterm_font132 = %s.\n",This->data->xterm_font132)); +} + + + /****i* lib5250/curses_terminal_term * NAME * curses_terminal_term @@ -459,6 +494,10 @@ if (This->data->k_map != NULL) g_free(This->data->k_map); #endif + if (This->data->xterm_font80 !=NULL) + g_free(This->data->xterm_font80); + if (This->data->xterm_font132 !=NULL) + g_free(This->data->xterm_font132); if (This->data != NULL) g_free(This->data); g_free(This); @@ -540,7 +579,13 @@ if(This->data->is_xterm) { printf ("\x1b[8;%d;%dt", tn5250_display_height (display)+1, tn5250_display_width (display)); - fflush (stdout); + if (This->data->xterm_font132!=NULL) { + if (tn5250_display_width (display)>100) + printf(This->data->xterm_font132); + else + printf(This->data->xterm_font80); + } + fflush (stdout); #ifdef HAVE_RESIZETERM resizeterm(tn5250_display_height(display)+1, tn5250_display_width(display)+1); #endif diff -u ../../orig/src/cursesterm.h ./cursesterm.h --- ../../orig/src/cursesterm.h Wed Dec 6 13:30:38 2000 +++ ./cursesterm.h Wed Jan 3 15:03:50 2001 @@ -42,6 +42,9 @@ extern Tn5250Terminal /*@null@*/ /*@only@*/ *tn5250_curses_terminal_new(void); extern void tn5250_curses_terminal_use_underscores (Tn5250Terminal *This, int use_underscores); + extern void tn5250_curses_terminal_set_xterm_font (Tn5250Terminal *This, + const char *font80, + const char *font132); #endif #ifdef __cplusplus diff -u ../../orig/src/tn5250.c ./tn5250.c --- ../../orig/src/tn5250.c Thu May 25 08:54:51 2000 +++ ./tn5250.c Wed Jan 3 15:02:07 2001 @@ -99,6 +99,13 @@ tn5250_config_get_bool (config, "underscores") ); } + if ((tn5250_config_get (config, "xterm_font80")) + && (tn5250_config_get (config, "xterm_font132"))) { + tn5250_curses_terminal_set_xterm_font (term, + tn5250_config_get (config, "xterm_font80"), + tn5250_config_get (config, "xterm_font132") + ); + } #endif #ifdef USE_SLANG term = tn5250_slang_terminal_new();
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.