Hiya Tash.
Should work what you tried..
You can try with the following example I am using, and works:
Note that I have, consequently, this font installed!
So in my case, with my installation directory, this font is located at:
/opt/local/share/fonts/truetype/DejaVuSansCondensed.ttf

This might be the catch..

Greets
Niels

---snips-----

#include <lite/lite.h>
#include <lite/window.h>
#include <leck/label.h>

DFBColor black = { 0,0,0,0 };
DFBColor white = { 255,255,255,255 };
DFBColor yellow = { r:255,g:255,b:0,a:255 };

int
main (int argc, char *argv[])
{
     LiteWindow   *window;
     LiteLabel    *label1;
     LiteLabel    *label2;
    
     DFBRectangle  rect = { x:0,y:0,w:720,h:480 };
     DFBResult     res;

     if (lite_open( &argc, &argv ))  return -1;

     res = lite_new_window( NULL, &rect, DWCAPS_NONE, liteNoWindowTheme, 
"Example", &window );
     res = lite_set_window_background( window, &black );
     if( res ) return res;

     rect.y = 50;
     res = lite_new_label( LITE_BOX(window), &rect, liteNoLabelTheme, 
20, &label1 );
     lite_set_label_color( label1, &white );
     lite_set_label_text( label1, "Example default font" );

     rect.y = 150;
     res = lite_new_label( LITE_BOX(window), &rect, liteNoLabelTheme, 
20, &label2 );
     lite_set_label_color( label2, &yellow );
     lite_set_label_font( label2, "DejaVuSansCondensed", 
LITE_FONT_PLAIN, 20, DFFA_NONE );
     lite_set_label_text( label2, "Example Sans Condensed font" );

     lite_set_window_opacity( window, liteFullWindowOpacity );
     lite_window_event_loop( window, 0 );
     lite_destroy_window( window );
     lite_close();

     return 0;
}





Tash Robinson wrote:
> Hello all,
>
> I've been trying in vain to set a font other than the default for a
> label.
>
> When I do it like this:
>
>    dfb_res = lite_new_label( LITE_BOX( lwFrame), &rect,
> liteNoLabelTheme, 20, &label_title);
>    lite_set_label_font( &label_title, "FontName", LITE_FONT_PLAIN, 18,
> 0);
>
> It seems to have no effect - default font is still used.
>
> I think the font should load properly like that because this works fine
> to set the font for a TextButton:
>         lite_get_font("FontName", LITE_FONT_PLAIN, 18, 0, &textFont);
>         lite_new_text_button_theme( DATADIR "/textbuttonbgnd.png",
> &textButtonTheme);
>         textButtonTheme->font = textFont;
>
>
>   

-- 

.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/                 |
"------------------------------------------" 

_______________________________________________
LiTE mailing list
[email protected]
http://mail.directfb.org/cgi-bin/mailman/listinfo/lite

Reply via email to