[comp.sys.amiga.tech] Using multiple fonts with Intuition

jack@stevie.cs.unlv.edu (The Prism) (09/08/89)

I have an Amiga programming question involving using multiple fonts
with intuition.  First of all, my program sets up the screen using
topaz 11 as the standard font, later on however, I want to change fonts
to courier 18, but when I print my string, it is still in topaz 11.
below are the lines from my program where I try to use courier 11:
 --------------

struct TextAttr biggerfont = {
	"courier.font",
	18,
	FS_NORMAL,
	FPB_DISKFONT,
};

struct IntuiText	IT2 = {
	WHITE, 0,
	JAM1, 100, 100,
	&biggerfont,
	"This is a test",
	NULL,
}

    ...
    ...
    ...

	PrintIText(rport,&IT2,0,0);
    ...
    ...

ken@cbmvax.UUCP (Ken Farinsky - CATS) (09/08/89)

In article <1317@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (The Prism) writes:
>I have an Amiga programming question involving using multiple fonts
>with intuition.  First of all, my program sets up the screen using
>topaz 11 as the standard font, later on however, I want to change fonts
>to courier 18, but when I print my string, it is still in topaz 11.
>below are the lines from my program where I try to use courier 11:
> --------------
>
>struct TextAttr biggerfont = {
>	"courier.font",
>	18,
>	FS_NORMAL,
>	FPB_DISKFONT,
>};
>
>struct IntuiText	IT2 = {
>	WHITE, 0,
>	JAM1, 100, 100,
>	&biggerfont,
>	"This is a test",
>	NULL,
>}
>
>    ...
>    ...
>    ...
>
>	PrintIText(rport,&IT2,0,0);
>    ...
>    ...

For IntuiText to have access to a font, it must be in memory.  Use
OpenDiskFont() to load the font and this should work.  Remember to 
close the font when you are done.

-- 
--------------------------------------------------------------
Ken Farinsky -- CATS               Commodore Business Machines
PHONE 215-431-9421         UUCP  ...{uunet,rutgers}!cbmvax!ken
--------------------------------------------------------------

usenet@cps3xx.UUCP (Usenet file owner) (09/08/89)

In article <1317@jimi.cs.unlv.edu> jack@jimi.cs.unlv.edu (The Prism) writes:
Before you can use a font, you Must open it.
Since the font you want is on disk, you must load it before the
graphics.library (called by intuition) can see it.

Please note that the OpenFont call cann return a font of a different
height than you specify, if that size was not available.

struct TextFont *font;

->struct TextAttr biggerfont = {
->	"courier.font",
->	18,
->	FS_NORMAL,
->	FPB_DISKFONT,
->};
->
->struct IntuiText	IT2 = {
->	WHITE, 0,
->	JAM1, 100, 100,
->	&biggerfont,
->	"This is a test",
->	NULL,
->}

init() {
	DiskfontBase=OpenLibrary("diskfont.library",version);
	if(DiskfontBase==0) barf();
}

playwithfonts() {
	...

	font=OpenDiskFont(&biggerfont););
	if(font==0) barf();

/* Now you can use your new font pointed to by "font" */


	...
	Closefont(font);
}
REAL NAME: Joe Porkka   jap@frith.cl.msu.edu

bartonr@jove.cs.pdx.edu (Robert Barton) (09/10/89)

 jack@stevie.cs.unlv.edu (The Prism) writes:
struct TextAttr biggerfont = {
   "courier.font",
   18,
   FS_NORMAL,
   FPB_DISKFONT,
};
==========
  That should be FPF_DISKFONT.  FPB_DISKFONT == 1 == FPF_ROMFONT.
So you're really asking for a ROM font which doesn't exist.