diff options
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | TODO | 2 | ||||
| -rw-r--r-- | man/feh.1 | 9 | ||||
| -rw-r--r-- | src/imlib.c | 24 | ||||
| -rw-r--r-- | src/index.c | 6 | ||||
| -rw-r--r-- | src/options.c | 4 | ||||
| -rw-r--r-- | src/thumbnail.c | 6 | 
7 files changed, 38 insertions, 16 deletions
| @@ -3,7 +3,8 @@ git HEAD      * support LDLIBS in Makefile/config.mk      * Don't make the --thumbnails window fullscreen. The images launched from        thumbnail mode may be fullscreen, though. You can still use 'v' to -       toggle fullscreen, should you really need it. +      toggle fullscreen, should you really need it. +    * --font now sets the global default font (for action/filename display etc.)  Thu Jun 10 12:12:04 CEST 2010 @@ -23,5 +23,3 @@ thumbnails are created, becoming quite slow for large filelists.  A workaround (--thumb-redraw) exists, but at some point a rewrite with a  GUI-toolkit or similar (or maybe writing a completely new tool for that and  removing the feature from feh) would be due. - -Option to set font globally @@ -185,6 +185,10 @@ when  .Nm  exits.  You can add files to filelists by specifying them on the commandline  when also specifying the list. +.It Cm -e , --font Ar font +Set global font.  Should be a truetype font, resident in the current directory +or the font directory, and should be defined in the form fontname/points, like +.Qq myfont/12 .  .It Cm -C , --fontpath Ar path  Specify  .Ar path @@ -472,11 +476,6 @@ will only redraw once all thumbnails are loaded.  .  .Sh INDEX MODE OPTIONS  .Bl -tag -width indent -.It Cm -e , --font Ar font -Set font for printing the information under each thumbnail.  Should be a -truetype font, resident in the current directory or the font directory, and -should be defined in the form fontname/points, like -.Qq myfont/12 .  .It Cm -@ , --title-font Ar font  Set font to print a title on the index, if no font is specified, no title will  be printed. diff --git a/src/imlib.c b/src/imlib.c index c8aaf82..eedab6a 100644 --- a/src/imlib.c +++ b/src/imlib.c @@ -552,9 +552,11 @@ void feh_draw_zoom(winwidget w)  	if (!w->im)  		return; +	if (opt.font) +		fn = gib_imlib_load_font(opt.font); +  	if (!fn) {  		fn = gib_imlib_load_font(DEFAULT_FONT); -		memset(atab, 0, sizeof(atab));  	}  	if (!fn) { @@ -562,6 +564,8 @@ void feh_draw_zoom(winwidget w)  		return;  	} +	memset(atab, 0, sizeof(atab)); +  	snprintf(buf, sizeof(buf), "%.0f%%, %dx%d", w->zoom * 100,  			(int) (w->im_w * w->zoom), (int) (w->im_h * w->zoom)); @@ -598,8 +602,10 @@ void feh_draw_filename(winwidget w)  			|| (!FEH_FILE(w->file->data)->filename))  		return; +	if (opt.font) +		fn = gib_imlib_load_font(opt.font); +  	if (!fn) { -		memset(atab, 0, sizeof(atab));  		if (w->full_screen)  			fn = gib_imlib_load_font(DEFAULT_FONT_BIG);  		else @@ -611,6 +617,8 @@ void feh_draw_filename(winwidget w)  		return;  	} +	memset(atab, 0, sizeof(atab)); +  	/* Work out how high the font is */  	gib_imlib_get_text_size(fn, FEH_FILE(w->file->data)->filename, NULL, &tw, &th, IMLIB_TEXT_TO_RIGHT); @@ -730,8 +738,10 @@ void feh_draw_caption(winwidget w)  	caption_style->bits = gib_list_add_front(caption_style->bits,  		gib_style_bit_new(1, 1, 0, 0, 0, 255)); +	if (opt.font) +		fn = gib_imlib_load_font(opt.font); +  	if (!fn) { -		memset(atab, 0, sizeof(atab));  		if (w->full_screen)  			fn = gib_imlib_load_font(DEFAULT_FONT_BIG);  		else @@ -743,6 +753,8 @@ void feh_draw_caption(winwidget w)  		return;  	} +	memset(atab, 0, sizeof(atab)); +  	if (*(file->caption) == '\0') {  		p = estrdup("Caption entry mode - Hit ESC to cancel");  		lines = feh_wrap_string(p, w->w, fn, NULL); @@ -1035,8 +1047,10 @@ void feh_draw_actions(winwidget w)  			|| (!FEH_FILE(w->file->data)->filename))  		return; +	if (opt.font) +		fn = gib_imlib_load_font(opt.font); +  	if (!fn) { -		memset(atab, 0, sizeof(atab));  		if (w->full_screen)  			fn = gib_imlib_load_font(DEFAULT_FONT_BIG);  		else @@ -1048,6 +1062,8 @@ void feh_draw_actions(winwidget w)  		return;  	} +	memset(atab, 0, sizeof(atab)); +  	gib_imlib_get_text_size(fn, "defined actions:", NULL, &tw, &th, IMLIB_TEXT_TO_RIGHT);  /* Check for the widest line */  	max_tw = tw; diff --git a/src/index.c b/src/index.c index 8321185..e611ba6 100644 --- a/src/index.c +++ b/src/index.c @@ -68,7 +68,11 @@ void init_index_mode(void)  		mode = "index";  	} -	fn = gib_imlib_load_font(opt.font); +	if (opt.font) +		fn = gib_imlib_load_font(opt.font); + +	if (!fn) +		fn = gib_imlib_load_font(DEFAULT_FONT);  	if (opt.title_font) {  		int fh, fw; diff --git a/src/options.c b/src/options.c index b7deb12..e2e9c05 100644 --- a/src/options.c +++ b/src/options.c @@ -55,7 +55,7 @@ void init_parse_options(int argc, char **argv)  	opt.thumb_h = 60;  	opt.thumb_redraw = 10;  	opt.menu_font = estrdup(DEFAULT_MENU_FONT); -	opt.font = estrdup(DEFAULT_FONT); +	opt.font = NULL;  	opt.image_bg = estrdup("default");  	opt.menu_bg = estrdup(PREFIX "/share/feh/images/menubg_default.png");  	opt.menu_style = estrdup(PREFIX "/share/feh/fonts/menu.style"); @@ -1081,10 +1081,10 @@ static void show_usage(void)  " -o, --output FILE         Save the created montage to FILE\n"  " -O, --output-only  FILE   Just save the created montage to FILE\n"  "                           WITHOUT displaying it (use in scripts)\n" -" INDEX MODE OPTIONS\n"  " -e, --font FONT           Use FONT to print the information under each\n"  "                           thumbnail. FONT should be defined in the form\n"  "                           fontname/size(points). eg -e myfont/12\n" +" INDEX MODE OPTIONS\n"  " -@, --title-font FONT     Use FONT to print a title on the index, if no\n"  "                           font is specified, a title will not be printed\n"  " SLIDESHOW KEYS\n" diff --git a/src/thumbnail.c b/src/thumbnail.c index c104cb8..74cc033 100644 --- a/src/thumbnail.c +++ b/src/thumbnail.c @@ -92,7 +92,11 @@ void init_thumbnail_mode(void)  	mode = "thumbnail"; -	td.font_main = gib_imlib_load_font(opt.font); +	if (opt.font) +		td.font_main = gib_imlib_load_font(opt.font); + +	if (!td.font_main) +		td.font_main = gib_imlib_load_font(DEFAULT_FONT);  	if (opt.title_font) {  		int fh, fw; | 
