[comp.sys.atari.st] detecting GDOS and using vst_load_fonts

steve@thelake.mn.org (Steve.Yelvington) (05/30/91)

(This is a repost ... because of a configuration error, the original may
not have achieved the distribution I had intended.)

---

I'm having trouble figuring out how to use an alternate font
to draw text in a GEM window. I presume I need to check for
the existence of GDOS before calling vst_load_fonts, but
how?

I'm also getting three bombs when calling vst_load_fonts, with
AMCLITE installed and ASSIGN.SYS set up properly (or at least well
enough that GEMINI doesn't complain).

I'd like to install Gemini 9 pt inside an application program.
Do I need to search for "Gemini 9 pt" in the data returned by
vqt_name() or do I search for the filename "BAGE09.FNT"?

Code fragment follows:


open_vwork()
	{
	int i;
	char tmpln[80];
	handle = graf_handle( &char_w, &char_h, &box_w, &box_h);
	for( i=0; i<10; work_in[i++] = 1 );
	work_in[10] = 2;
	v_opnvwk( work_in, &handle, work_out);
	fonts_loaded = work_out[10];
	sprintf(tmpln,"[1][There are %d|fonts available][OK]",fonts_loaded);
	form_alert(1,tmpln);
/* note: it tells me I have one font available */
	fonts_loaded =  vst_load_fonts(handle,2);
/* BOOM! Three big ones and we go no further */
	sprintf(tmpln,"[1][After vst_load_fonts,|there are %d|fonts available][OK]",fonts_loaded);
	form_alert(1,tmpln);
	if (fonts_loaded > 1)
		set_font();
	}

set_font()
	{
/* Wouldn't it be nice if there were a font selector like the 
   file selector? (Volunteers?)  */
	int i,fontindex;
	char fontname[32];
	char *p = "BAGE09.FNT"; /* or should it be "Gemini 9"? */
	if (form_alert(2,"[1][Load BAGE09.FNT?][Yes|No]") == 2) 
		return;
	for (i=0;i<fonts_loaded;i++)
		{
		/* find the font */
		fontindex = vqt_name(handle,i,fontname);
		if(strnicmp(p,fontname,strlen(p))== 0)
			{		
			/* select the font */
			vst_font(handle,fontindex);
			/* set the point size */
			vst_point(handle,9,&char_w, &char_h, &box_w, &box_h);
			return;
			}
		}
	}
		
 ----
 Steve Yelvington, Marine on St. Croix, Minnesota, USA / steve@thelake.mn.org