Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!ysub!psuvm!dearn!dmswwu1c!onm07 Organisation: Westfaelische Wilhelms-Universitaet, Muenster, Germany Date: Friday, 31 May 1991 11:21:45 MES From: Julian F. Reschke Message-ID: <91151.112145ONM07@DMSWWU1A.BITNET> Newsgroups: comp.sys.atari.st.tech Subject: Re: detecting GDOS and using vst_load_fonts References: In article , steve@thelake.mn.org (Steve Yelvington) says: > >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? [...] > > >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 */ (1) make it: fonts_loaded += vst_load_fonts (handle, ...); You get the number of _additional_ fonts. (2) call vq_gdos() first (3) No, I really don't know what the problem could be. > 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"? */ No, it should be 'Gemini'! The font comes in several point sizes, but the font id is always the same. > if (form_alert(2,"[1][Load BAGE09.FNT?][Yes|No]") == 2) > return; > for (i=0;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 ___________________________ cut here _____________________________________ Julian F. Reschke, Hensenstr. 142, D-4400 Muenster, Phone: ++49 251 861241 fast eMail: ONM07@DMSWWU1A.BITNET, slow: jr@ms.maus.de (++49 251 77216) ____________________ correct me if I'm wrong _____________________________