Implement italic fonts

This commit is contained in:
Ray Chason
2026-08-19 09:37:40 +03:00
committed by Pasi Kallinen
parent 9d1aac189e
commit 737b3ac89a
5 changed files with 10 additions and 9 deletions
+1 -1
View File
@@ -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
+4 -3
View File
@@ -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);
+2 -2
View File
@@ -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 */
+2 -2
View File
@@ -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 */
+1 -1
View File
@@ -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);