Path: utzoo!attcan!uunet!van-bc!rsoft!mindlink!a464 From: a464@mindlink.UUCP (Bruce Dawson) Newsgroups: comp.sys.amiga.tech Subject: Re: Fonts and freeing memory Message-ID: <942@mindlink.UUCP> Date: 15 Jan 90 00:09:43 GMT Organization: MIND LINK! - British Columbia, Canada Lines: 31 > root writes: > > Msg-ID: <145@ccave.UUCP> > Posted: 9 Jan 90 03:21:25 GMT > > Org. : Chameleon's Cave [JDCP 0.96] > Person: Juergen Hermann > > You MUST use OpenFont() to look for resident fonts before ever calling > OpenDiskFont(). If not, the font is made resident over and over again, in > fact loosing memory for nothing. > > So do something like > > if ((WinFont = (struct TextFont *) OpenFont (&ta)) == NULL && > (WinFont = (struct TextFont *) OpenDiskFont (&ta)) == NULL) { > Abort ("Can't open font\n"); > } > > -- > // Juergen Hermann UUCP: ira.uka.de!smurf!ccave!root > \X/ 75 Karlsruhe 1, FRG Fido: 2:241/2.1212@FidoNet Are you sure about having to call OpenFont() to avoid losing memory? I have never seen that documented, and when I tried it just now (opened the same font several times, closing it after each opening, checking for memory loss, using OpenDiskFont() only) and I had no memory loss, except (of course) on the first open. .Bruce Dawson.