@@ -307,7 +307,15 @@ handler(void *user, const char *section, const char *name, const char *value)
307307			return  1 ;
308308		}
309309		if  (strcmp (name , "font" ) ==  0 ) {
310- 			config -> default_style .font_path  =  strdup (value );
310+ 			config -> font_path  =  strdup (value );
311+ 			return  1 ;
312+ 		}
313+ 		if  (strcmp (name , "font_size" ) ==  0 ) {
314+ 			if  (parse_number (value , & ul ) ==  false) {
315+ 				wob_log_error ("Font size must be a positive value." );
316+ 				return  0 ;
317+ 			}
318+ 			config -> font_size  =  ul ;
311319			return  1 ;
312320		}
313321
@@ -393,6 +401,14 @@ handler(void *user, const char *section, const char *name, const char *value)
393401			output_config -> dimensions .bar_padding  =  ul ;
394402			return  1 ;
395403		}
404+ 		if  (strcmp (name , "font_size" ) ==  0 ) {
405+ 			if  (parse_number (value , & ul ) ==  false) {
406+ 				wob_log_error ("Font size must be a positive value." );
407+ 				return  0 ;
408+ 			}
409+ 			output_config -> font_size  =  ul ;
410+ 			return  1 ;
411+ 		}
396412
397413		wob_log_warn ("Unknown config key %s" , name );
398414		return  1 ;
@@ -457,10 +473,6 @@ handler(void *user, const char *section, const char *name, const char *value)
457473			}
458474			return  1 ;
459475		}
460- 		if  (strcmp (name , "font" ) ==  0 ) {
461- 			style -> font_path  =  strdup (value );
462- 			return  1 ;
463- 		}
464476
465477		wob_log_warn ("Unknown config key %s" , name );
466478		return  1 ;
@@ -520,13 +532,14 @@ wob_config_create()
520532	config -> margin  =  (struct  wob_margin ) {.top  =  0 , .left  =  0 , .bottom  =  0 , .right  =  0 };
521533	config -> anchor  =  WOB_ANCHOR_CENTER ;
522534	config -> overflow_mode  =  WOB_OVERFLOW_MODE_WRAP ;
535+ 	config -> font_path  =  NULL ;
536+ 	config -> font_size  =  16 ;
523537	config -> default_style .colors .background  =  (struct  wob_color ) {.a  =  1.0f , .r  =  0.0f , .g  =  0.0f , .b  =  0.0f };
524538	config -> default_style .colors .value  =  (struct  wob_color ) {.a  =  1.0f , .r  =  1.0f , .g  =  1.0f , .b  =  1.0f };
525539	config -> default_style .colors .border  =  (struct  wob_color ) {.a  =  1.0f , .r  =  1.0f , .g  =  1.0f , .b  =  1.0f };
526540	config -> default_style .overflow_colors .background  =  (struct  wob_color ) {.a  =  1.0f , .r  =  0.0f , .g  =  0.0f , .b  =  0.0f };
527541	config -> default_style .overflow_colors .value  =  (struct  wob_color ) {.a  =  1.0f , .r  =  1.0f , .g  =  0.0f , .b  =  0.0f };
528542	config -> default_style .overflow_colors .border  =  (struct  wob_color ) {.a  =  1.0f , .r  =  1.0f , .g  =  1.0f , .b  =  1.0f };
529- 	config -> default_style .font_path  =  NULL ;
530543
531544	return  config ;
532545}
@@ -594,7 +607,8 @@ wob_config_debug(struct wob_config *config)
594607	wob_log_debug ("config.overflow_colors.background = "  WOB_COLOR_PRINTF_FORMAT , WOB_COLOR_PRINTF_RGBA (config -> default_style .overflow_colors .background ));
595608	wob_log_debug ("config.overflow_colors.value = "  WOB_COLOR_PRINTF_FORMAT , WOB_COLOR_PRINTF_RGBA (config -> default_style .overflow_colors .value ));
596609	wob_log_debug ("config.overflow_colors.border = "  WOB_COLOR_PRINTF_FORMAT , WOB_COLOR_PRINTF_RGBA (config -> default_style .overflow_colors .border ));
597- 	wob_log_debug ("config.font = %s" , config -> default_style .font_path  !=  NULL  ? config -> default_style .font_path  : "<empty>" );
610+ 	wob_log_debug ("config.font = %s" , config -> font_path  !=  NULL  ? config -> font_path  : "<empty>" );
611+ 	wob_log_debug ("config.font_size = %d" , config -> font_size );
598612
599613	struct  wob_style  * style ;
600614	wl_list_for_each  (style , & config -> styles , link ) {
@@ -604,7 +618,6 @@ wob_config_debug(struct wob_config *config)
604618		wob_log_debug ("config.style.%s.overflow_colors.background = "  WOB_COLOR_PRINTF_FORMAT , style -> name , WOB_COLOR_PRINTF_RGBA (style -> overflow_colors .background ));
605619		wob_log_debug ("config.style.%s.overflow_colors.value = "  WOB_COLOR_PRINTF_FORMAT , style -> name , WOB_COLOR_PRINTF_RGBA (style -> overflow_colors .value ));
606620		wob_log_debug ("config.style.%s.overflow_colors.border = "  WOB_COLOR_PRINTF_FORMAT , style -> name , WOB_COLOR_PRINTF_RGBA (style -> overflow_colors .border ));
607- 		wob_log_debug ("config.style.%s.font = %s" , style -> name , style -> font_path  !=  NULL  ? style -> font_path  : "<empty>" );
608621	}
609622
610623	struct  wob_output_config  * output_config ;
@@ -626,6 +639,7 @@ wob_config_debug(struct wob_config *config)
626639			WOB_ORIENTATION_HORIZONTAL ,
627640			WOB_ORIENTATION_VERTICAL 
628641		);
642+ 		wob_log_debug ("config.output.%s.font_size = %d" , output_config -> id , output_config -> font_size );
629643	}
630644}
631645
@@ -642,12 +656,11 @@ wob_config_destroy(struct wob_config *config)
642656	struct  wob_style  * style , * style_tmp ;
643657	wl_list_for_each_safe  (style , style_tmp , & config -> styles , link ) {
644658		free (style -> name );
645- 		free (style -> font_path );
646659		free (style );
647660	}
648661
649- 	if  (config -> default_style . font_path  !=  NULL ) {
650- 		free (config -> default_style . font_path );
662+ 	if  (config -> font_path  !=  NULL ) {
663+ 		free (config -> font_path );
651664	}
652665
653666	free (config );
@@ -699,7 +712,8 @@ wob_config_match_output(struct wob_config *config, const char *match)
699712	struct  wob_output_config  * output_config  =  NULL ;
700713	bool  output_found  =  false;
701714	wl_list_for_each  (output_config , & config -> outputs , link ) {
702- 		if  (strstr (output_config -> match , match ) ==  0 ) {
715+ 		wob_log_debug ("%s = %s?" , output_config -> match , match );
716+ 		if  (strstr (match , output_config -> match ) !=  NULL ) {
703717			output_found  =  true;
704718			break ;
705719		}
0 commit comments