[comp.sys.amiga] diffs for making vt100 use other fonts, plus a suggested standard.

flaps@utcsri.UUCP (05/23/87)

If you apply this change to init.c from vt100 v2.6, the environment
variable "font" will be used on startup to decide what font to use.  It
should contain, for example, "topaz".  The string ".font" is appended.
I don't know how general this change is but it should probably at least
work for any font which has only one point size which is 8.  Point
sizes other than 8 are probably incompatible with other things in vt100
anyway.

Note that the 'set' command in the Shell, at least in 2.04M, doesn't
actually set the environment.  There was a PD set command posted awhile
back, or you can use the Manx one.  I don't know if vt100 will compile
under Lattice with this change (mostly, whether or not Lattice has a
getenv()).

The suggested standard is that the environment variable "font" be used
in this way whenever possible.

Just to be absolutely clear: the command you should put in your startup
file is "c:set font=pearl" or whatever font.  The "c:" is needed if you
are using the Shell so that the internal set command isn't used.

Here are the diffs:


*** init.c.orig	Sat May 23 15:36:59 1987
--- init.c	Sat May 23 15:44:00 1987
***************
*** 16,21
   ***************************************************************/
  
  #include "vt100.h"
  
  char line[256];
  static char cmds[] = "V^GRSBLHXEOIT.DWKCZ";

--- 16,24 -----
   ***************************************************************/
  
  #include "vt100.h"
+ #define FONTNAMESIZE   40
+ #define FONTSUFFIX     ".font"
+ #define MAXFONTVARLEN  34      /* 40 minus sizeof (".font") */
  
  char line[256];
  static char cmds[] = "V^GRSBLHXEOIT.DWKCZ";
***************
*** 19,24
  
  char line[256];
  static char cmds[] = "V^GRSBLHXEOIT.DWKCZ";
  
  char *InitDefaults(argc,argv)
  int	argc;

--- 22,29 -----
  
  char line[256];
  static char cmds[] = "V^GRSBLHXEOIT.DWKCZ";
+ static char myfontname[FONTNAMESIZE];
+ extern char *getenv();
  
  char *InitDefaults(argc,argv)
  int	argc;
***************
*** 25,31
  char	**argv;
      {
      FILE    *fd;
!     char    *p;
      int	    l;
  
      doing_init = 1;	/* make sure we only allow INIT script commands */

--- 30,36 -----
  char	**argv;
      {
      FILE    *fd;
!     char    *p,*t;
      int	    l;
  
      doing_init = 1;	/* make sure we only allow INIT script commands */
***************
*** 83,88
  	NewWindow.Screen	= NULL;
  	NewWindow.Type		= WBENCHSCREEN;
  	}
      /* see if we exit with a startup script */
      if (*p == 'e') {
  	p = next_wrd(p+l+1,&l);

--- 88,104 -----
  	NewWindow.Screen	= NULL;
  	NewWindow.Type		= WBENCHSCREEN;
  	}
+ 
+ 	/* check for environment variable specifying font name */
+ 	if((t = getenv("font"))) {
+ 		if(strlen(t) <= MAXFONTVARLEN) {
+ 			strcpy(myfontname,t);
+ 			strcat(myfontname,FONTSUFFIX);
+ 			myattr.ta_Name = (STRPTR)myfontname;
+ 		} else
+ 			fprintf(stderr,"font environment variable is too long.\n");
+ 	}
+ 
      /* see if we exit with a startup script */
      if (*p == 'e') {
  	p = next_wrd(p+l+1,&l);


-- 

      //  Alan J Rosenthal
     //
 \\ //        flaps@csri.toronto.edu, {seismo!utai or utzoo}!utcsri!flaps,
  \//              flaps@toronto on csnet, flaps at utorgpu on bitnet.


Kermit - Protocol error