diff --git a/ede-desktop/DesktopIcon.cpp b/ede-desktop/DesktopIcon.cpp index 4db944c..cbe33f2 100644 --- a/ede-desktop/DesktopIcon.cpp +++ b/ede-desktop/DesktopIcon.cpp @@ -104,12 +104,6 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : gsettings = gs; settings = is; - /* setting fonts is TODO :P */ -#if 0 - Fl::set_font((Fl_Font)20, "-windows-*-medium-r-*-*-14-*-*-*-*-*-*-*"); - labelfont((Fl_Font)20); -#endif - label(settings->name.c_str()); imenu = new MenuButton(0, 0, 0, 0); @@ -127,7 +121,7 @@ DesktopIcon::DesktopIcon(GlobalIconSettings* gs, IconSettings* is, int bg) : color(bg); align(FL_ALIGN_WRAP); - update_label_size(); + update_label_font_and_size(); } DesktopIcon::~DesktopIcon() { @@ -175,7 +169,8 @@ void DesktopIcon::load_icon(int face) { darker_img->color_average(FL_BLUE, 0.6); } -void DesktopIcon::update_label_size(void) { +void DesktopIcon::update_label_font_and_size(void) { + labelfont(gsettings->label_font); labelsize(gsettings->label_fontsize); lwidth = gsettings->label_maxwidth; lheight= 0; @@ -278,7 +273,7 @@ void DesktopIcon::rename(const char* str) { settings->name = str; label(settings->name.c_str()); - update_label_size(); + update_label_font_and_size(); redraw(); } diff --git a/ede-desktop/DesktopIcon.h b/ede-desktop/DesktopIcon.h index 425eb11..fc07719 100644 --- a/ede-desktop/DesktopIcon.h +++ b/ede-desktop/DesktopIcon.h @@ -41,7 +41,7 @@ private: edelib::MenuButton* imenu; void load_icon(int face); - void update_label_size(void); + void update_label_font_and_size(void); void fix_position(int X, int Y); public: diff --git a/ede-desktop/ede-desktop.cpp b/ede-desktop/ede-desktop.cpp index c31df34..0aed364 100644 --- a/ede-desktop/ede-desktop.cpp +++ b/ede-desktop/ede-desktop.cpp @@ -18,6 +18,7 @@ #include #include // rand, srand #include // time +#include #include #include @@ -40,6 +41,7 @@ #include #include #include +#include #include #include "ede-desktop.h" @@ -81,6 +83,7 @@ EDELIB_NS_USING(netwm_workarea_get_size) EDELIB_NS_USING(netwm_window_set_type) EDELIB_NS_USING(netwm_callback_add) EDELIB_NS_USING(netwm_callback_remove) +EDELIB_NS_USING(font_cache_find) EDELIB_NS_USING(NETWM_WINDOW_TYPE_DESKTOP) EDELIB_NS_USING(NETWM_CHANGED_CURRENT_WORKAREA) EDELIB_NS_USING(NETWM_CHANGED_CURRENT_WORKSPACE) @@ -163,6 +166,7 @@ Desktop::Desktop() : EDE_DESKTOP_WINDOW(0, 0, 100, 100, "") { /* gnome light blue */ gisett->label_background = 138; gisett->label_foreground = FL_WHITE; + gisett->label_font = FL_HELVETICA; gisett->label_fontsize = 12; gisett->label_maxwidth = 75; gisett->label_transparent = true; @@ -293,7 +297,7 @@ void Desktop::read_config(void) { } bool wuse; - char wpath[256]; + char wpath[PATH_MAX], font_name[64]; int bcolor, wmode; /* use nice darker blue color as default for background */ @@ -306,13 +310,20 @@ void Desktop::read_config(void) { /* '138' is gnome light blue */ conf.get("Icons", "label_background", gisett->label_background, 138); conf.get("Icons", "label_foreground", gisett->label_foreground, FL_WHITE); - conf.get("Icons", "label_fontsize", gisett->label_fontsize, 12); conf.get("Icons", "label_maxwidth", gisett->label_maxwidth, 75); conf.get("Icons", "label_transparent",gisett->label_transparent, true); conf.get("Icons", "label_visible", gisett->label_draw, true); conf.get("Icons", "one_click_exec", gisett->one_click_exec, false); conf.get("Icons", "auto_arrange", gisett->auto_arrange, true); + /* try to get font */ + if(conf.get("Icons", "label_font", font_name, sizeof(font_name))) { + font_cache_find(font_name, gisett->label_font, + gisett->label_fontsize, + gisett->label_font, + gisett->label_fontsize); + } + /* minimal allowed font size */ if(gisett->label_fontsize < 8) gisett->label_fontsize = 12; diff --git a/ede-desktop/ede-desktop.h b/ede-desktop/ede-desktop.h index efa4d21..1eeb636 100644 --- a/ede-desktop/ede-desktop.h +++ b/ede-desktop/ede-desktop.h @@ -44,6 +44,7 @@ struct GlobalIconSettings { int label_background; int label_foreground; + int label_font; int label_fontsize; int label_maxwidth; bool label_transparent;