Correct, your example works, BUT, if you modify it to act as my program
does, it crashes.
How to modify it then? Add an additional loop around the first one, like
this:
------8<------
...
while(1) {
for (i=4; i < n; i++) {
...
------8<------
If there is no bug, this should not be a problem, right? Well, there is one
:( ... This is the result I get:
------8<------
root@magi dvp # ./dfb_test
(*) parsing config file '/etc/directfbrc'.
---------------------- DirectFB v0.9.15 ---------------------
(c) 2000-2002 convergence integrated media GmbH
(c) 2002 convergence GmbH
-----------------------------------------------------------
(*) Single Application Core. (with MMX support) (2002-11-20 20:58)
(*) DirectFB/misc/memcpy: using MMXEXT optimized memcpy()
(*) DirectFB/InputDevice: IMPS/2 Mouse 0.9 (convergence integrated media
GmbH)
(*) DirectFB/InputDevice: Keyboard 0.9 (convergence integrated media GmbH)
(*) MMX detected and enabled
(*) DirectFB/GraphicsDevice: MMX Software Rasterizer 0.6 (convergence
integrated media GmbH)
(!) DirectFB/core/fbdev: Panning display failed!
--> Invalid argument
(!) DirectFB/core/fbdev: Panning display failed!
--> Invalid argument
(!) DirectFB/core/fbdev: Panning display failed!
--> Invalid argument
(*) DirectFB/Interface: Loaded 'FT2' implementation of 'IDirectFBFont'.
(!) DirectFB/FontFT2: Failed loading face 0 from font file
`images/menu.ttf'!
(#) DirectFBError [dfb->CreateFont (dfb, FONT, &desc, &font)]: General
failure!
root@magi dvp #
------8<------
I'm using the latest CVS snapshot (updated today, 20/11 2002 22:00 CET)
Any input would be nice (and no, I can not/will not rewrite my program,
besides, this should be fixed no? ;))
/Henric
----- Original Message -----
From: "Denis Oliver Kropp" <[EMAIL PROTECTED]>
To: "Henric Andersson" <[EMAIL PROTECTED]>
Cc: "directfb-dev" <[EMAIL PROTECTED]>
Sent: Monday, November 18, 2002 8:27 PM
Subject: Re: [directfb-dev] The correct way of using fonts?
> Quoting Henric Andersson ([EMAIL PROTECTED]):
> > I've made a program that uses TrueType fonts quite extensively. What
I've noticed is that the program is leaking memory. ALOT of memory. I traced
it to the font loading.
> >
> > Correct me if I'm wrong, but isn't this how it is supposed to be used:
> >
> > DFBFontDescription font_dsc;
> > IDirectFBFont *font = NULL; // Our font
> >
> > font_dsc.flags = DFDESC_HEIGHT;
> > font_dsc.height = 30;
> > DFBCHECK (dfb->CreateFont (dfb, "arial.ttf", &font_dsc, &font));
> > DFBCHECK (primary->SetFont (primary, font));
> >
> > *** do something with the font, ie, draw stuff on screen :) ***
> >
> > font->Release(font);
> >
> > If you run this in a loop, the program will eventually fail to load the
font, and before it does, it will eat alot of memory.
> >
> > Any comments are welcomed...
>
> I wrote a small test app and it works perfectly.
>
> --
> Best regards,
> Denis Oliver Kropp
>
> .------------------------------------------.
> | DirectFB - Hardware accelerated graphics |
> | http://www.directfb.org/ |
> "------------------------------------------"
>
> Convergence GmbH
>
--
Info: To unsubscribe send a mail to [EMAIL PROTECTED] with
"unsubscribe directfb-dev" as subject.