Mercurial > emacs
comparison src/w32fns.c @ 45465:84120e75baa0
* 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.
author | Jason Rumney <jasonr@gnu.org> |
---|---|
date | Wed, 22 May 2002 19:35:48 +0000 |
parents | 3244cd2850b8 |
children | e4d2d8c8186f |
comparison
equal
deleted
inserted
replaced
45464:f45806ed6479 | 45465:84120e75baa0 |
---|---|
199 #define VIETNAMESE_CHARSET 163 | 199 #define VIETNAMESE_CHARSET 163 |
200 #endif | 200 #endif |
201 | 201 |
202 Lisp_Object Qauto_raise; | 202 Lisp_Object Qauto_raise; |
203 Lisp_Object Qauto_lower; | 203 Lisp_Object Qauto_lower; |
204 Lisp_Object Qbar; | 204 Lisp_Object Qbar, Qhbar; |
205 Lisp_Object Qborder_color; | 205 Lisp_Object Qborder_color; |
206 Lisp_Object Qborder_width; | 206 Lisp_Object Qborder_width; |
207 Lisp_Object Qbox; | 207 Lisp_Object Qbox; |
208 Lisp_Object Qcursor_color; | 208 Lisp_Object Qcursor_color; |
209 Lisp_Object Qcursor_type; | 209 Lisp_Object Qcursor_type; |
2366 && XINT (XCDR (arg)) >= 0) | 2366 && XINT (XCDR (arg)) >= 0) |
2367 { | 2367 { |
2368 type = BAR_CURSOR; | 2368 type = BAR_CURSOR; |
2369 *width = XINT (XCDR (arg)); | 2369 *width = XINT (XCDR (arg)); |
2370 } | 2370 } |
2371 else if (EQ (arg, Qhbar)) | |
2372 { | |
2373 type = HBAR_CURSOR; | |
2374 *width = 2; | |
2375 } | |
2376 else if (CONSP (arg) | |
2377 && EQ (XCAR (arg), Qhbar) | |
2378 && INTEGERP (XCDR (arg)) | |
2379 && XINT (XCDR (arg)) >= 0) | |
2380 { | |
2381 type = HBAR_CURSOR; | |
2382 *width = XINT (XCDR (arg)); | |
2383 } | |
2371 else if (NILP (arg)) | 2384 else if (NILP (arg)) |
2372 type = NO_CURSOR; | 2385 type = NO_CURSOR; |
2373 else | 2386 else |
2374 /* Treat anything unknown as "box cursor". | 2387 /* Treat anything unknown as "box cursor". |
2375 It was bad to signal an error; people have trouble fixing | 2388 It was bad to signal an error; people have trouble fixing |
7091 { | 7104 { |
7092 HDC hdc; | 7105 HDC hdc; |
7093 int numFonts; | 7106 int numFonts; |
7094 LOGFONT logfont; | 7107 LOGFONT logfont; |
7095 XFontStruct *size_ref; | 7108 XFontStruct *size_ref; |
7096 Lisp_Object *pattern; | 7109 Lisp_Object pattern; |
7097 Lisp_Object list; | 7110 Lisp_Object list; |
7098 Lisp_Object *tail; | |
7099 } enumfont_t; | 7111 } enumfont_t; |
7100 | 7112 |
7101 | 7113 |
7102 static void | 7114 static void |
7103 enum_font_maybe_add_to_list (enumfont_t *, LOGFONT *, char *, Lisp_Object); | 7115 enum_font_maybe_add_to_list (enumfont_t *, LOGFONT *, char *, Lisp_Object); |
7149 char *charset = NULL; | 7161 char *charset = NULL; |
7150 | 7162 |
7151 /* Truetype fonts do not report their true metrics until loaded */ | 7163 /* Truetype fonts do not report their true metrics until loaded */ |
7152 if (FontType != RASTER_FONTTYPE) | 7164 if (FontType != RASTER_FONTTYPE) |
7153 { | 7165 { |
7154 if (!NILP (*(lpef->pattern))) | 7166 if (!NILP (lpef->pattern)) |
7155 { | 7167 { |
7156 /* Scalable fonts are as big as you want them to be. */ | 7168 /* Scalable fonts are as big as you want them to be. */ |
7157 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; | 7169 lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; |
7158 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; | 7170 lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; |
7159 width = make_number (lpef->logfont.lfWidth); | 7171 width = make_number (lpef->logfont.lfWidth); |
7174 lplf->elfLogFont.lfHeight = lptm->tmInternalLeading - lptm->tmHeight; | 7186 lplf->elfLogFont.lfHeight = lptm->tmInternalLeading - lptm->tmHeight; |
7175 else | 7187 else |
7176 lplf->elfLogFont.lfHeight = -lplf->elfLogFont.lfHeight; | 7188 lplf->elfLogFont.lfHeight = -lplf->elfLogFont.lfHeight; |
7177 } | 7189 } |
7178 | 7190 |
7179 if (!NILP (*(lpef->pattern))) | 7191 if (!NILP (lpef->pattern)) |
7180 { | 7192 { |
7181 charset = xlfd_charset_of_font (XSTRING(*(lpef->pattern))->data); | 7193 charset = xlfd_charset_of_font (XSTRING(lpef->pattern)->data); |
7182 | 7194 |
7183 /* We already checked charsets above, but DEFAULT_CHARSET | 7195 /* We already checked charsets above, but DEFAULT_CHARSET |
7184 slipped through. So only allow exact matches for DEFAULT_CHARSET. */ | 7196 slipped through. So only allow exact matches for DEFAULT_CHARSET. */ |
7185 if (charset | 7197 if (charset |
7186 && strncmp (charset, "*-*", 3) != 0 | 7198 && strncmp (charset, "*-*", 3) != 0 |
7240 char buf[100]; | 7252 char buf[100]; |
7241 | 7253 |
7242 if (!w32_to_x_font (logfont, buf, 100, match_charset)) | 7254 if (!w32_to_x_font (logfont, buf, 100, match_charset)) |
7243 return; | 7255 return; |
7244 | 7256 |
7245 if (NILP (*(lpef->pattern)) | 7257 if (NILP (lpef->pattern) |
7246 || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) | 7258 || w32_font_match (buf, XSTRING (lpef->pattern)->data)) |
7247 { | 7259 { |
7248 /* Check if we already listed this font. This may happen if | 7260 /* Check if we already listed this font. This may happen if |
7249 w32_enable_synthesized_fonts is non-nil, and there are real | 7261 w32_enable_synthesized_fonts is non-nil, and there are real |
7250 bold and italic versions of the font. */ | 7262 bold and italic versions of the font. */ |
7251 Lisp_Object font_name = build_string (buf); | 7263 Lisp_Object font_name = build_string (buf); |
7252 if (NILP (Fmember (font_name, lpef->list))) | 7264 if (NILP (Fmember (font_name, lpef->list))) |
7253 { | 7265 { |
7254 *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); | 7266 Lisp_Object entry = Fcons (font_name, width); |
7255 lpef->tail = &(XCDR_AS_LVALUE (*lpef->tail)); | 7267 lpef->list = Fcons (entry, lpef->list); |
7256 lpef->numFonts++; | 7268 lpef->numFonts++; |
7257 } | 7269 } |
7258 } | 7270 } |
7259 } | 7271 } |
7260 | 7272 |
7395 goto label_cached; | 7407 goto label_cached; |
7396 } | 7408 } |
7397 | 7409 |
7398 BLOCK_INPUT; | 7410 BLOCK_INPUT; |
7399 /* At first, put PATTERN in the cache. */ | 7411 /* At first, put PATTERN in the cache. */ |
7400 list = Qnil; | 7412 ef.pattern = tpat; |
7401 ef.pattern = &tpat; | 7413 ef.list = Qnil; |
7402 ef.list = list; | |
7403 ef.tail = &list; | |
7404 ef.numFonts = 0; | 7414 ef.numFonts = 0; |
7405 | 7415 |
7406 /* Use EnumFontFamiliesEx where it is available, as it knows | 7416 /* Use EnumFontFamiliesEx where it is available, as it knows |
7407 about character sets. Fall back to EnumFontFamilies for | 7417 about character sets. Fall back to EnumFontFamilies for |
7408 older versions of NT that don't support the 'Ex function. */ | 7418 older versions of NT that don't support the 'Ex function. */ |
7433 | 7443 |
7434 ReleaseDC (dpyinfo->root_window, ef.hdc); | 7444 ReleaseDC (dpyinfo->root_window, ef.hdc); |
7435 } | 7445 } |
7436 | 7446 |
7437 UNBLOCK_INPUT; | 7447 UNBLOCK_INPUT; |
7448 list = ef.list; | |
7438 | 7449 |
7439 /* Make a list of the fonts we got back. | 7450 /* Make a list of the fonts we got back. |
7440 Store that in the font cache for the display. */ | 7451 Store that in the font cache for the display. */ |
7441 XSETCDR (dpyinfo->name_list_element, | 7452 XSETCDR (dpyinfo->name_list_element, |
7442 Fcons (Fcons (tpat, list), | 7453 Fcons (Fcons (tpat, list), |
14810 staticpro (&Qauto_raise); | 14821 staticpro (&Qauto_raise); |
14811 Qauto_lower = intern ("auto-lower"); | 14822 Qauto_lower = intern ("auto-lower"); |
14812 staticpro (&Qauto_lower); | 14823 staticpro (&Qauto_lower); |
14813 Qbar = intern ("bar"); | 14824 Qbar = intern ("bar"); |
14814 staticpro (&Qbar); | 14825 staticpro (&Qbar); |
14826 Qhbar = intern ("hbar"); | |
14827 staticpro (&Qhbar); | |
14815 Qborder_color = intern ("border-color"); | 14828 Qborder_color = intern ("border-color"); |
14816 staticpro (&Qborder_color); | 14829 staticpro (&Qborder_color); |
14817 Qborder_width = intern ("border-width"); | 14830 Qborder_width = intern ("border-width"); |
14818 staticpro (&Qborder_width); | 14831 staticpro (&Qborder_width); |
14819 Qbox = intern ("box"); | 14832 Qbox = intern ("box"); |