Update:

I looked at the code in more detail and it seems that the error occurs a
little earlier, in function IDirectFB_CreateFont (src/idirectfb.c:1169).
That function calls DirectGetInterface (lib/direct/interface.c:130) which
returns DR_NOIMPL, meaning "No implementation for this interface or content
type has been found".

Below there's the code I am using. I can't figure out what's going on, any
help is greatly appreciated.

Thank you.

   R.


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <directfb.h>
#include <string.h>

#define DATADIR "/usr/share/fonts/"

int main(int argc, char *argv[])
{
    IDirectFB             *dfb = NULL;
    IDirectFBSurface      *primary = NULL;
    DFBSurfaceDescription dsc;

    IDirectFBFont    *font = NULL;
    DFBFontDescription font_dsc;
    char             *text = "test123";

    int screen_width = 0;
    int screen_height = 0;

    // Init
    DirectFBInit(&argc, &argv);
    DirectFBCreate(&dfb);
    dfb->SetCooperativeLevel(dfb, DFSCL_FULLSCREEN);

    // Create the primary surface
    memset(&dsc, 0, sizeof(DFBSurfaceDescription));
    dsc.flags = DSDESC_CAPS;
    dsc.caps = DSCAPS_PRIMARY;
    dfb->CreateSurface(dfb, &dsc, &primary);
    primary->GetSize(primary, &screen_width, &screen_height);

    // Set font
    font_dsc.flags = DFDESC_HEIGHT;
    font_dsc.height = 48;
    dfb->CreateFont(dfb, DATADIR"DejaVuSans.ttf", &font_dsc, &font);

    primary->SetFont(primary, font);
    primary->SetColor(primary, 0xFF, 0xFF, 0xFF, 0xFF);
    primary->DrawString(primary, text, -1, 300, 300, DSTF_LEFT);
    primary->Flip(primary, NULL, DSFLIP_WAITFORSYNC);

    sleep(30);

    // Cleanup
    font->Release(font);
    primary->Release(primary);
    dfb->Release(dfb);
    return 0;
}



On Fri, Sep 5, 2008 at 3:42 PM, rippel tippel <[EMAIL PROTECTED]>wrote:

> Hi all,
>
>    I compiled Freetype 2.3.7 and I want to use it with DirectFB 1.2.3.
> After installing Freetype in /usr/local/freetype-2.3.7, I'm using
> DejaVuSans.ttf (which is in /usr/shared/fonts) to run the third DirectFB
> tutorial, writing a short string on the screen... but it remains black.
>
> Going into the source code I could see that IDirectFBSurface_DrawString()
> (src/display/idirectfbsurface.c:1971) returns DFB_MISSINGFONT.
>
> Did I forget to do something important? What's going wrong?
>
> Thanks,
>    Rippel
>
>
>
>
_______________________________________________
directfb-users mailing list
directfb-users@directfb.org
http://mail.directfb.org/cgi-bin/mailman/listinfo/directfb-users

Reply via email to