[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | AMIGA NOTES |
Notice: | Join us in the *NEW* conference - HYDRA::AMIGA_V2 |
Moderator: | HYDRA::MOORE |
|
Created: | Sat Apr 26 1986 |
Last Modified: | Wed Feb 05 1992 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 5378 |
Total number of notes: | 38326 |
3373.0. "Well now, lattice C..." by SSDEVO::YESSE (Computing at 6200 ft.) Sun Jan 21 1990 22:17
A plea for assistance using Lattice C V5.04...
Has anyone changed fonts in a rastport using SetFont? My sample program
below works OK up till the SetFont call, when the Guru visits with an
apparent illegal instruction. The OpenDiskFont call is successful after
making sure FONTS: points to my fonts disk.
All I can think of is a possible lack of an allocation, but I can't
imagine where, since my TextFont structure is defined. I'm hoping I
can make this simple case work without AvailFonts calls, etc.
Any help much appreciated!
-----------------------------------------------------------------------------
#include <exec/types.h>
#include <graphics/gfx.h>
#include <graphics/gfxbase.h>
#include <graphics/copper.h>
#include <graphics/rastport.h>
#include <graphics/text.h>
#include <graphics/view.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>
#include <libraries/diskfont.h>
struct IntuitionBase *IntuitionBase;
struct DiskfontBase *DiskfontBase;
struct NewWindow myWindow = { 40, 10, 200, 150,
1, 3,
DISKINSERTED,
ACTIVATE | REPORTMOUSE |
WINDOWDRAG | WINDOWCLOSE,
0, 0, "Test Window",
0, 0,
40, 40, 300, 300,
WBENCHSCREEN };
struct Window *p_myw;
struct RastPort *p_myrport;
struct TextFont *tf;
struct TextAttr ta;
main()
{
/* Open intuition, diskfont libraries */
IntuitionBase = (struct IntuitionBase *)
OpenLibrary ("intuition.library", 0);
if (IntuitionBase == 0) exit (20);
printf ("intuition opened ok\n");
DiskfontBase = (struct DiskfontBase *)
OpenLibrary ("diskfont.library", 0);
if (DiskfontBase == 0) exit (21);
printf ("diskfont opened ok\n");
/* Open window on Workbench */
p_myw = (struct Window *) OpenWindow (&myWindow);
if (p_myw == 0) exit (22);
printf ("window opened ok\n");
/* Define TextAttr structure elements */
ta.ta_Name = (STRPTR) "garnet.font";
ta.ta_YSize = 9;
ta.ta_Style = FS_NORMAL;
ta.ta_Flags = FPF_DISKFONT;
/* Get ptr to TextFont structure */
tf = (struct TextFont *) OpenDiskFont (&ta);
if (tf == 0) exit (23);
printf ("font opened ok\n");
/* Change window/rastport font */
SetFont (p_myw->RPort, tf);
/* ... future stuff ... */
Delay (500);
/* Clean up */
CloseWindow (p_myw);
CloseLibrary (IntuitionBase);
}
T.R | Title | User | Personal Name | Date | Lines
|
---|