Commit 23afac8f authored by Jason Rumney's avatar Jason Rumney

* w32fns.c (enumfont_t): Remove tail, make pattern a normal

Lisp_Object.
(enum_font_cb2, enum_font_maybe_add_to_list, w32_list_fonts):
Use modified enumfont_t struct.

* w32fns.c (Qhbar): New variable.
(x_specified_cursor_type): Use it.
parent 232dbe4f
...@@ -201,7 +201,7 @@ Lisp_Object Vw32_charset_info_alist; ...@@ -201,7 +201,7 @@ Lisp_Object Vw32_charset_info_alist;
Lisp_Object Qauto_raise; Lisp_Object Qauto_raise;
Lisp_Object Qauto_lower; Lisp_Object Qauto_lower;
Lisp_Object Qbar; Lisp_Object Qbar, Qhbar;
Lisp_Object Qborder_color; Lisp_Object Qborder_color;
Lisp_Object Qborder_width; Lisp_Object Qborder_width;
Lisp_Object Qbox; Lisp_Object Qbox;
...@@ -2368,6 +2368,19 @@ x_specified_cursor_type (arg, width) ...@@ -2368,6 +2368,19 @@ x_specified_cursor_type (arg, width)
type = BAR_CURSOR; type = BAR_CURSOR;
*width = XINT (XCDR (arg)); *width = XINT (XCDR (arg));
} }
else if (EQ (arg, Qhbar))
{
type = HBAR_CURSOR;
*width = 2;
}
else if (CONSP (arg)
&& EQ (XCAR (arg), Qhbar)
&& INTEGERP (XCDR (arg))
&& XINT (XCDR (arg)) >= 0)
{
type = HBAR_CURSOR;
*width = XINT (XCDR (arg));
}
else if (NILP (arg)) else if (NILP (arg))
type = NO_CURSOR; type = NO_CURSOR;
else else
...@@ -7093,9 +7106,8 @@ typedef struct enumfont_t ...@@ -7093,9 +7106,8 @@ typedef struct enumfont_t
int numFonts; int numFonts;
LOGFONT logfont; LOGFONT logfont;
XFontStruct *size_ref; XFontStruct *size_ref;
Lisp_Object *pattern; Lisp_Object pattern;
Lisp_Object list; Lisp_Object list;
Lisp_Object *tail;
} enumfont_t; } enumfont_t;
...@@ -7151,7 +7163,7 @@ enum_font_cb2 (lplf, lptm, FontType, lpef) ...@@ -7151,7 +7163,7 @@ enum_font_cb2 (lplf, lptm, FontType, lpef)
/* Truetype fonts do not report their true metrics until loaded */ /* Truetype fonts do not report their true metrics until loaded */
if (FontType != RASTER_FONTTYPE) if (FontType != RASTER_FONTTYPE)
{ {
if (!NILP (*(lpef->pattern))) if (!NILP (lpef->pattern))
{ {
/* Scalable fonts are as big as you want them to be. */ /* Scalable fonts are as big as you want them to be. */
lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight;
...@@ -7176,9 +7188,9 @@ enum_font_cb2 (lplf, lptm, FontType, lpef) ...@@ -7176,9 +7188,9 @@ enum_font_cb2 (lplf, lptm, FontType, lpef)
lplf->elfLogFont.lfHeight = -lplf->elfLogFont.lfHeight; lplf->elfLogFont.lfHeight = -lplf->elfLogFont.lfHeight;
} }
if (!NILP (*(lpef->pattern))) if (!NILP (lpef->pattern))
{ {
charset = xlfd_charset_of_font (XSTRING(*(lpef->pattern))->data); charset = xlfd_charset_of_font (XSTRING(lpef->pattern)->data);
/* We already checked charsets above, but DEFAULT_CHARSET /* We already checked charsets above, but DEFAULT_CHARSET
slipped through. So only allow exact matches for DEFAULT_CHARSET. */ slipped through. So only allow exact matches for DEFAULT_CHARSET. */
...@@ -7242,8 +7254,8 @@ enum_font_maybe_add_to_list (lpef, logfont, match_charset, width) ...@@ -7242,8 +7254,8 @@ enum_font_maybe_add_to_list (lpef, logfont, match_charset, width)
if (!w32_to_x_font (logfont, buf, 100, match_charset)) if (!w32_to_x_font (logfont, buf, 100, match_charset))
return; return;
if (NILP (*(lpef->pattern)) if (NILP (lpef->pattern)
|| w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) || w32_font_match (buf, XSTRING (lpef->pattern)->data))
{ {
/* Check if we already listed this font. This may happen if /* Check if we already listed this font. This may happen if
w32_enable_synthesized_fonts is non-nil, and there are real w32_enable_synthesized_fonts is non-nil, and there are real
...@@ -7251,8 +7263,8 @@ enum_font_maybe_add_to_list (lpef, logfont, match_charset, width) ...@@ -7251,8 +7263,8 @@ enum_font_maybe_add_to_list (lpef, logfont, match_charset, width)
Lisp_Object font_name = build_string (buf); Lisp_Object font_name = build_string (buf);
if (NILP (Fmember (font_name, lpef->list))) if (NILP (Fmember (font_name, lpef->list)))
{ {
*lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); Lisp_Object entry = Fcons (font_name, width);
lpef->tail = &(XCDR_AS_LVALUE (*lpef->tail)); lpef->list = Fcons (entry, lpef->list);
lpef->numFonts++; lpef->numFonts++;
} }
} }
...@@ -7397,10 +7409,8 @@ w32_list_fonts (f, pattern, size, maxnames) ...@@ -7397,10 +7409,8 @@ w32_list_fonts (f, pattern, size, maxnames)
BLOCK_INPUT; BLOCK_INPUT;
/* At first, put PATTERN in the cache. */ /* At first, put PATTERN in the cache. */
list = Qnil; ef.pattern = tpat;
ef.pattern = &tpat; ef.list = Qnil;
ef.list = list;
ef.tail = &list;
ef.numFonts = 0; ef.numFonts = 0;
/* Use EnumFontFamiliesEx where it is available, as it knows /* Use EnumFontFamiliesEx where it is available, as it knows
...@@ -7435,6 +7445,7 @@ w32_list_fonts (f, pattern, size, maxnames) ...@@ -7435,6 +7445,7 @@ w32_list_fonts (f, pattern, size, maxnames)
} }
UNBLOCK_INPUT; UNBLOCK_INPUT;
list = ef.list;
/* Make a list of the fonts we got back. /* Make a list of the fonts we got back.
Store that in the font cache for the display. */ Store that in the font cache for the display. */
...@@ -14812,6 +14823,8 @@ syms_of_w32fns () ...@@ -14812,6 +14823,8 @@ syms_of_w32fns ()
staticpro (&Qauto_lower); staticpro (&Qauto_lower);
Qbar = intern ("bar"); Qbar = intern ("bar");
staticpro (&Qbar); staticpro (&Qbar);
Qhbar = intern ("hbar");
staticpro (&Qhbar);
Qborder_color = intern ("border-color"); Qborder_color = intern ("border-color");
staticpro (&Qborder_color); staticpro (&Qborder_color);
Qborder_width = intern ("border-width"); Qborder_width = intern ("border-width");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment