diff --git a/include/winX.h b/include/winX.h index 952ddcec4..4e97de267 100644 --- a/include/winX.h +++ b/include/winX.h @@ -544,7 +544,7 @@ extern XFontStruct *X11_unicode_font(Display *, XFontStruct *); #endif #ifdef USE_XFT -extern XftFont *X11_new_font(Widget w, boolean bold, int win_type); +extern XftFont *X11_new_font(Widget w, unsigned attrs, int win_type); extern void X11_release_font(Widget w, XftFont *font); extern void X11_new_color(Widget w, Pixel pixel, XftColor *color); #endif diff --git a/win/X11/winX.c b/win/X11/winX.c index 4889ac74a..86691d15b 100644 --- a/win/X11/winX.c +++ b/win/X11/winX.c @@ -3164,7 +3164,7 @@ X11_unicode_font(Display *display, XFontStruct *font) /* Open a vector font for the given widget */ extern XftFont * -X11_new_font(Widget w, boolean bold, int win_type) +X11_new_font(Widget w, unsigned attrs, int win_type) { const char *font_name = NULL; const char *iflags_font_name = NULL; @@ -3247,9 +3247,10 @@ X11_new_font(Widget w, boolean bold, int win_type) /* Set reasonable bounds on the font size */ font_size = min(max(font_size, 6), 50); - Snprintf(name, sizeof(name), "%.*s-%d:%s", + Snprintf(name, sizeof(name), "%.*s-%d%s%s", (int) name_len, font_name, font_size, - bold ? "bold" : "medium"); + (attrs & HL_BOLD) ? ":bold" : "", + (attrs & HL_ITALIC) ? ":italic" : ""); Display *display = XtDisplay(w); XftFont *font = XftFontOpenName(display, DefaultScreen(display), name); diff --git a/win/X11/winmap.c b/win/X11/winmap.c index 3befe1887..c6733f76c 100644 --- a/win/X11/winmap.c +++ b/win/X11/winmap.c @@ -1040,7 +1040,7 @@ get_char_info(struct xwindow *wp) #ifdef USE_XFT struct map_info_t *map_info = wp->map_information; struct text_map_info_t *text_map = &map_info->text_map; - XftFont *font = X11_new_font(wp->w, FALSE, NHW_MAP); + XftFont *font = X11_new_font(wp->w, 0, NHW_MAP); text_map->square_width = font->max_advance_width; text_map->square_height = font->height; text_map->square_ascent = 0; @@ -1430,7 +1430,7 @@ map_update(struct xwindow *wp, int start_row, int stop_row, int start_col, int s XtGetValues(wp->w, arg, 1); XftDraw *draw = XftDrawCreate(display, XtWindow(wp->w), visual, cmap); - XftFont *font = X11_new_font(wp->w, FALSE, NHW_MAP); + XftFont *font = X11_new_font(wp->w, 0, NHW_MAP); XftColor bgcolor; X11_new_color(wp->w, bgpixel, &bgcolor); #endif /* USE_XFT */ diff --git a/win/X11/winmesg.c b/win/X11/winmesg.c index 861e280d4..69df458b0 100644 --- a/win/X11/winmesg.c +++ b/win/X11/winmesg.c @@ -159,7 +159,7 @@ create_message_window(struct xwindow *wp, /* window pointer */ /* Save character information for fast use later. */ #ifdef USE_XFT - XftFont *font = X11_new_font(wp->w, FALSE, NHW_MESSAGE); + XftFont *font = X11_new_font(wp->w, 0, NHW_MESSAGE); mesg_info->char_width = font->max_advance_width; mesg_info->char_height = font->height; mesg_info->char_ascent = font->ascent; @@ -481,7 +481,7 @@ redraw_message_window(struct xwindow *wp) Visual *visual = DefaultVisualOfScreen(screen); Colormap cmap = DefaultColormapOfScreen(screen); XftDraw *draw = XftDrawCreate(display, XtWindow(wp->w), visual, cmap); - XftFont *font = X11_new_font(wp->w, FALSE, NHW_MESSAGE); + XftFont *font = X11_new_font(wp->w, 0, NHW_MESSAGE); XftColor fgcolor; X11_new_color(wp->w, mesg_info->fgpixel, &fgcolor); #endif /* USE_XFT */ diff --git a/win/X11/winstat.c b/win/X11/winstat.c index 024045e6f..c8e7c353e 100644 --- a/win/X11/winstat.c +++ b/win/X11/winstat.c @@ -779,7 +779,7 @@ tty_render_text(Widget w, const XRectangle *clip, int x, int y, #ifdef USE_XPM /* Get the font */ - XftFont *font = X11_new_font(w, (attr & HL_BOLD) != 0, NHW_STATUS); + XftFont *font = X11_new_font(w, attr, NHW_STATUS); /* Get the drawing resources */ Display *display = XtDisplay(w);