Hi:
I have updated my test according to the tutorial of directfb: "
http://www.directfb.org/docs/DirectFB_Tutorials/text.html", but if fails.
The error message is:
*test.cpp <40>:
(#) DirectFBError [dfb->CreateFont (dfb, "FreeMono.ttf", &font_dsc,
&font)]: No (suitable) implementation found!*
Looks like I need to install the implementation for the font? How can I do
so?
Thanks a lot!
Here is my testing program.
*#include <iostream>
#include <directfb.h>
using namespace std;
static IDirectFB *dfb = NULL;
static IDirectFBSurface *primary = NULL;
static int screen_width = 0;
static int screen_height = 0;
#define DFBCHECK(x...) \
{ \
DFBResult err = x; \
\
if (err != DFB_OK) \
{ \
fprintf( stderr, "%s <%d>:\n\t", __FILE__, __LINE__ ); \
DirectFBErrorFatal( #x, err ); \
} \
}
static IDirectFBFont *font = NULL;
static char *text = "DirectFB rulez!";
int main(int argc, char *argv[])
{
int i, width;
DFBFontDescription font_dsc;
DFBSurfaceDescription dsc;
DFBCHECK (DirectFBInit (&argc, &argv));
DFBCHECK (DirectFBCreate (&dfb));
DFBCHECK (dfb->SetCooperativeLevel (dfb, DFSCL_FULLSCREEN));
dsc.flags = DSDESC_CAPS;
dsc.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY | DSCAPS_FLIPPING);
DFBCHECK (dfb->CreateSurface( dfb, &dsc, &primary ));
DFBCHECK (primary->GetSize (primary, &screen_width, &screen_height));
font_dsc.flags = DFDESC_HEIGHT;
font_dsc.height = 48;
DFBCHECK (dfb->CreateFont (dfb, "FreeMono.ttf", &font_dsc, &font))
dfb->Release(dfb);
return 0;
}
*
On Sat, Nov 20, 2010 at 5:21 PM, Kelvin Chen <[email protected]> wrote:
> Ouch, looks like the attached file is too large.
> But it doesn't matters much.
>
> Please help me with this issue, thanks a lot!
>
>
> On Sat, Nov 20, 2010 at 4:58 PM, Kelvin Chen <[email protected]> wrote:
>
>> Hi,
>>
>> I couldn't create font for IDirectFB. The code I'm using is really simple,
>> but it fails.
>> Could anyone please give me some clue why it fails? I'm really appreciate
>> your help.
>>
>> The font file I used is attached.
>>
>> Thanks!
>>
>> #include <iostream>
>> #include <directfb.h>
>> using namespace std;
>>
>> int main(int argc, char *argv[])
>> {
>> IDirectFB *dfb;
>>
>> // Initialize DirectFB
>> DirectFBInit(&argc, &argv);
>> DirectFBCreate(&dfb);
>> dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);
>>
>> // Create fonts
>> IDirectFBFont *font = NULL;
>> // the font description where we will store the font height
>> DFBFontDescription fontDsc;
>> fontDsc.flags = DFDESC_HEIGHT;
>> fontDsc.height = 32;
>> // create the font
>> if(dfb->CreateFont(dfb, "FreeMono.ttf", &fontDsc, &font) != DFB_OK) {
>> cout << endl;
>> cout << "Create font failed!" << endl;
>> cout << endl;
>> return NULL;
>> }
>> }
>>
>>
>> --
>> Kelvin Chen
>>
>
>
>
> --
> Kelvin Chen
>
--
Kelvin Chen
_______________________________________________
directfb-users mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users