Implement italic fonts
This commit is contained in:
committed by
Pasi Kallinen
parent
9d1aac189e
commit
737b3ac89a
+1
-1
@@ -544,7 +544,7 @@ extern XFontStruct *X11_unicode_font(Display *, XFontStruct *);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_XFT
|
#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_release_font(Widget w, XftFont *font);
|
||||||
extern void X11_new_color(Widget w, Pixel pixel, XftColor *color);
|
extern void X11_new_color(Widget w, Pixel pixel, XftColor *color);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+4
-3
@@ -3164,7 +3164,7 @@ X11_unicode_font(Display *display, XFontStruct *font)
|
|||||||
/* Open a vector font for the given widget */
|
/* Open a vector font for the given widget */
|
||||||
|
|
||||||
extern XftFont *
|
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 *font_name = NULL;
|
||||||
const char *iflags_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 */
|
/* Set reasonable bounds on the font size */
|
||||||
font_size = min(max(font_size, 6), 50);
|
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,
|
(int) name_len, font_name, font_size,
|
||||||
bold ? "bold" : "medium");
|
(attrs & HL_BOLD) ? ":bold" : "",
|
||||||
|
(attrs & HL_ITALIC) ? ":italic" : "");
|
||||||
|
|
||||||
Display *display = XtDisplay(w);
|
Display *display = XtDisplay(w);
|
||||||
XftFont *font = XftFontOpenName(display, DefaultScreen(display), name);
|
XftFont *font = XftFontOpenName(display, DefaultScreen(display), name);
|
||||||
|
|||||||
+2
-2
@@ -1040,7 +1040,7 @@ get_char_info(struct xwindow *wp)
|
|||||||
#ifdef USE_XFT
|
#ifdef USE_XFT
|
||||||
struct map_info_t *map_info = wp->map_information;
|
struct map_info_t *map_info = wp->map_information;
|
||||||
struct text_map_info_t *text_map = &map_info->text_map;
|
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_width = font->max_advance_width;
|
||||||
text_map->square_height = font->height;
|
text_map->square_height = font->height;
|
||||||
text_map->square_ascent = 0;
|
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);
|
XtGetValues(wp->w, arg, 1);
|
||||||
|
|
||||||
XftDraw *draw = XftDrawCreate(display, XtWindow(wp->w), visual, cmap);
|
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;
|
XftColor bgcolor;
|
||||||
X11_new_color(wp->w, bgpixel, &bgcolor);
|
X11_new_color(wp->w, bgpixel, &bgcolor);
|
||||||
#endif /* USE_XFT */
|
#endif /* USE_XFT */
|
||||||
|
|||||||
+2
-2
@@ -159,7 +159,7 @@ create_message_window(struct xwindow *wp, /* window pointer */
|
|||||||
|
|
||||||
/* Save character information for fast use later. */
|
/* Save character information for fast use later. */
|
||||||
#ifdef USE_XFT
|
#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_width = font->max_advance_width;
|
||||||
mesg_info->char_height = font->height;
|
mesg_info->char_height = font->height;
|
||||||
mesg_info->char_ascent = font->ascent;
|
mesg_info->char_ascent = font->ascent;
|
||||||
@@ -481,7 +481,7 @@ redraw_message_window(struct xwindow *wp)
|
|||||||
Visual *visual = DefaultVisualOfScreen(screen);
|
Visual *visual = DefaultVisualOfScreen(screen);
|
||||||
Colormap cmap = DefaultColormapOfScreen(screen);
|
Colormap cmap = DefaultColormapOfScreen(screen);
|
||||||
XftDraw *draw = XftDrawCreate(display, XtWindow(wp->w), visual, cmap);
|
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;
|
XftColor fgcolor;
|
||||||
X11_new_color(wp->w, mesg_info->fgpixel, &fgcolor);
|
X11_new_color(wp->w, mesg_info->fgpixel, &fgcolor);
|
||||||
#endif /* USE_XFT */
|
#endif /* USE_XFT */
|
||||||
|
|||||||
+1
-1
@@ -779,7 +779,7 @@ tty_render_text(Widget w, const XRectangle *clip, int x, int y,
|
|||||||
#ifdef USE_XPM
|
#ifdef USE_XPM
|
||||||
|
|
||||||
/* Get the font */
|
/* 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 */
|
/* Get the drawing resources */
|
||||||
Display *display = XtDisplay(w);
|
Display *display = XtDisplay(w);
|
||||||
|
|||||||
Reference in New Issue
Block a user