Niels, Your code works fine and showed me where my bug was. I was derefrencing the label pointer when passing it to lite_set_label_font... Doh.
So is this the preferred way rather than defining and using a LiteLabelTheme? Thanks for your help, Tash ------------------------------ Message: 2 Date: Wed, 04 Feb 2009 18:34:46 +0100 From: Niels Roest <[email protected]> Subject: Re: [LiTE] How to set a font for a Label? Cc: [email protected] Message-ID: <[email protected]> Content-Type: text/plain; charset=ISO-8859-1; format=flowed 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; } _______________________________________________ LiTE mailing list [email protected] http://mail.directfb.org/cgi-bin/mailman/listinfo/lite
