Mercurial > emacs
comparison src/w32fns.c @ 24147:c83b0bc4e8b9
(Vw32_bdf_filename_alist): New variable.
(x_destroy_bitmap): Returns void not int.
(x_set_border_pixel): Returns void.
(w32_load_bdf_font): New function.
(w32_load_system_font): New function, was w32_load_font. List
fonts before loading. Explicitly set encoding for SJIS fonts.
Set default_ascent to 0 as comment indicates.
(w32_load_font): Call w32_load_system_font and w32_load_bdf_font.
(w32_unload_font): Support BDF fonts.
(w32_to_x_charset): Fix mappings to avoid wildcard mismatches.
Autodetect whether to use koi8-r instead of iso8859-5.
Associate "ksc5601.1987" with HANGUEL_CHARSET.
Associate "ksc5601.1992" with JOHAB_CHARSET.
(x_to_w32_charset): Make consistent with w32_to_x_charset.
(w32_to_x_font): Add resolution.
(x_to_w32_font): Use font resolution to calculate height if supplied.
(w32_font_match): Handle wildcards anywhere within field.
(enumfont_t): Remove unused head pointer.
(enum_font_cb2): Dereference elfLogFont.
(w32_list_bdf_fonts): New function.
(w32_list_fonts): Use one_w32_dispay_info instead of insisting on
valid frame. Remove MessageBox. Support BDF fonts.
(Fw32_find_bdf_fonts): New function.
(syms_of_w32fns): Add Vw32_bdf_filename_alist and
Sw32_find_bdf_fonts.
author | Geoff Voelker <voelker@cs.washington.edu> |
---|---|
date | Fri, 22 Jan 1999 19:59:22 +0000 |
parents | 3a271e4c5332 |
children | d3649b38bb37 |
comparison
equal
deleted
inserted
replaced
24146:9ed2245a9b79 | 24147:c83b0bc4e8b9 |
---|---|
132 /* Search path for bitmap files. */ | 132 /* Search path for bitmap files. */ |
133 Lisp_Object Vx_bitmap_file_path; | 133 Lisp_Object Vx_bitmap_file_path; |
134 | 134 |
135 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */ | 135 /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */ |
136 Lisp_Object Vx_pixel_size_width_font_regexp; | 136 Lisp_Object Vx_pixel_size_width_font_regexp; |
137 | |
138 /* Alist of bdf fonts and the files that define them. */ | |
139 Lisp_Object Vw32_bdf_filename_alist; | |
137 | 140 |
138 /* A flag to control how to display unibyte 8-bit character. */ | 141 /* A flag to control how to display unibyte 8-bit character. */ |
139 int unibyte_display_via_language_environment; | 142 int unibyte_display_via_language_environment; |
140 | 143 |
141 /* Evaluate this expression to rebuild the section of syms_of_w32fns | 144 /* Evaluate this expression to rebuild the section of syms_of_w32fns |
523 #endif | 526 #endif |
524 } | 527 } |
525 | 528 |
526 /* Remove reference to bitmap with id number ID. */ | 529 /* Remove reference to bitmap with id number ID. */ |
527 | 530 |
528 int | 531 void |
529 x_destroy_bitmap (f, id) | 532 x_destroy_bitmap (f, id) |
530 FRAME_PTR f; | 533 FRAME_PTR f; |
531 int id; | 534 int id; |
532 { | 535 { |
533 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 536 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
1946 x_display_cursor (f, 1); | 1949 x_display_cursor (f, 1); |
1947 } | 1950 } |
1948 } | 1951 } |
1949 } | 1952 } |
1950 | 1953 |
1954 /* Set the border-color of frame F to pixel value PIX. | |
1955 Note that this does not fully take effect if done before | |
1956 F has an window. */ | |
1957 void | |
1958 x_set_border_pixel (f, pix) | |
1959 struct frame *f; | |
1960 int pix; | |
1961 { | |
1962 f->output_data.w32->border_pixel = pix; | |
1963 | |
1964 if (FRAME_W32_WINDOW (f) != 0 && f->output_data.w32->border_width > 0) | |
1965 { | |
1966 if (FRAME_VISIBLE_P (f)) | |
1967 redraw_frame (f); | |
1968 } | |
1969 } | |
1970 | |
1951 /* Set the border-color of frame F to value described by ARG. | 1971 /* Set the border-color of frame F to value described by ARG. |
1952 ARG can be a string naming a color. | 1972 ARG can be a string naming a color. |
1953 The border-color is used for the border that is drawn by the server. | 1973 The border-color is used for the border that is drawn by the server. |
1954 Note that this does not fully take effect if done before | 1974 Note that this does not fully take effect if done before |
1955 F has a window; it must be redone when the window is created. */ | 1975 F has a window; it must be redone when the window is created. */ |
1966 str = XSTRING (arg)->data; | 1986 str = XSTRING (arg)->data; |
1967 | 1987 |
1968 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); | 1988 pix = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); |
1969 | 1989 |
1970 x_set_border_pixel (f, pix); | 1990 x_set_border_pixel (f, pix); |
1971 } | |
1972 | |
1973 /* Set the border-color of frame F to pixel value PIX. | |
1974 Note that this does not fully take effect if done before | |
1975 F has an window. */ | |
1976 | |
1977 x_set_border_pixel (f, pix) | |
1978 struct frame *f; | |
1979 int pix; | |
1980 { | |
1981 f->output_data.w32->border_pixel = pix; | |
1982 | |
1983 if (FRAME_W32_WINDOW (f) != 0 && f->output_data.w32->border_width > 0) | |
1984 { | |
1985 if (FRAME_VISIBLE_P (f)) | |
1986 redraw_frame (f); | |
1987 } | |
1988 } | 1991 } |
1989 | 1992 |
1990 void | 1993 void |
1991 x_set_cursor_type (f, arg, oldval) | 1994 x_set_cursor_type (f, arg, oldval) |
1992 FRAME_PTR f; | 1995 FRAME_PTR f; |
4916 x_focus_on_frame (check_x_frame (frame)); | 4919 x_focus_on_frame (check_x_frame (frame)); |
4917 return Qnil; | 4920 return Qnil; |
4918 } | 4921 } |
4919 | 4922 |
4920 | 4923 |
4921 /* Load font named FONTNAME of size SIZE for frame F, and return a | 4924 struct font_info *w32_load_bdf_font (struct frame *f, char *fontname, |
4922 pointer to the structure font_info while allocating it dynamically. | 4925 int size, char* filename); |
4923 If loading fails, return NULL. */ | 4926 |
4924 struct font_info * | 4927 struct font_info * |
4925 w32_load_font (f,fontname,size) | 4928 w32_load_system_font (f,fontname,size) |
4926 struct frame *f; | 4929 struct frame *f; |
4927 char * fontname; | 4930 char * fontname; |
4928 int size; | 4931 int size; |
4929 { | 4932 { |
4930 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 4933 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
4931 Lisp_Object font_names; | 4934 Lisp_Object font_names; |
4932 | |
4933 #if 0 /* x_load_font attempts to get a list of fonts - presumably to | |
4934 allow a fuzzier fontname to be specified. w32_list_fonts | |
4935 appears to be a bit too fuzzy for this purpose. */ | |
4936 | 4935 |
4937 /* Get a list of all the fonts that match this name. Once we | 4936 /* Get a list of all the fonts that match this name. Once we |
4938 have a list of matching fonts, we compare them against the fonts | 4937 have a list of matching fonts, we compare them against the fonts |
4939 we already have loaded by comparing names. */ | 4938 we already have loaded by comparing names. */ |
4940 font_names = w32_list_fonts (f, build_string (fontname), size, 100); | 4939 font_names = w32_list_fonts (f, build_string (fontname), size, 100); |
4941 | 4940 |
4942 if (!NILP (font_names)) | 4941 if (!NILP (font_names)) |
4943 { | 4942 { |
4944 Lisp_Object tail; | 4943 Lisp_Object tail; |
4945 int i; | 4944 int i; |
4946 | |
4947 #if 0 /* This code has nasty side effects that cause Emacs to crash. */ | 4945 #if 0 /* This code has nasty side effects that cause Emacs to crash. */ |
4948 | 4946 |
4949 /* First check if any are already loaded, as that is cheaper | 4947 /* First check if any are already loaded, as that is cheaper |
4950 than loading another one. */ | 4948 than loading another one. */ |
4951 for (i = 0; i < dpyinfo->n_fonts; i++) | 4949 for (i = 0; i < dpyinfo->n_fonts; i++) |
4954 XSTRING (XCONS (tail)->car)->data) | 4952 XSTRING (XCONS (tail)->car)->data) |
4955 || !strcmp (dpyinfo->font_table[i].full_name, | 4953 || !strcmp (dpyinfo->font_table[i].full_name, |
4956 XSTRING (XCONS (tail)->car)->data)) | 4954 XSTRING (XCONS (tail)->car)->data)) |
4957 return (dpyinfo->font_table + i); | 4955 return (dpyinfo->font_table + i); |
4958 #endif | 4956 #endif |
4959 | |
4960 fontname = (char *) XSTRING (XCONS (font_names)->car)->data; | 4957 fontname = (char *) XSTRING (XCONS (font_names)->car)->data; |
4961 } | 4958 } |
4959 /* Because we need to support NT 3.x, we can't use EnumFontFamiliesEx | |
4960 so if fonts of the same name are available with several | |
4961 alternative character sets, the w32_list_fonts can fail to find a | |
4962 match even if the font exists. Try loading it anyway. | |
4963 */ | |
4964 #if 0 | |
4962 else | 4965 else |
4963 return NULL; | 4966 return NULL; |
4964 #endif | 4967 #endif |
4965 | 4968 |
4966 /* Load the font and add it to the table. */ | 4969 /* Load the font and add it to the table. */ |
4967 { | 4970 { |
4968 char *full_name; | 4971 char *full_name, *encoding; |
4969 XFontStruct *font; | 4972 XFontStruct *font; |
4970 struct font_info *fontp; | 4973 struct font_info *fontp; |
4971 LOGFONT lf; | 4974 LOGFONT lf; |
4972 BOOL ok; | 4975 BOOL ok; |
4973 | 4976 |
4982 ended up with. */ | 4985 ended up with. */ |
4983 return NULL; | 4986 return NULL; |
4984 | 4987 |
4985 font = (XFontStruct *) xmalloc (sizeof (XFontStruct)); | 4988 font = (XFontStruct *) xmalloc (sizeof (XFontStruct)); |
4986 | 4989 |
4987 if (!font) return (NULL); | 4990 /* Set bdf to NULL to indicate that this is a Windows font. */ |
4991 font->bdf = NULL; | |
4988 | 4992 |
4989 BLOCK_INPUT; | 4993 BLOCK_INPUT; |
4990 | 4994 |
4991 font->hfont = CreateFontIndirect (&lf); | 4995 font->hfont = CreateFontIndirect (&lf); |
4992 | 4996 |
5063 0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, or | 5067 0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, or |
5064 2:0xA020..0xFF7F). For the moment, we don't know which charset | 5068 2:0xA020..0xFF7F). For the moment, we don't know which charset |
5065 uses this font. So, we set informatoin in fontp->encoding[1] | 5069 uses this font. So, we set informatoin in fontp->encoding[1] |
5066 which is never used by any charset. If mapping can't be | 5070 which is never used by any charset. If mapping can't be |
5067 decided, set FONT_ENCODING_NOT_DECIDED. */ | 5071 decided, set FONT_ENCODING_NOT_DECIDED. */ |
5072 | |
5073 /* SJIS fonts need to be set to type 4, all others seem to work as | |
5074 type FONT_ENCODING_NOT_DECIDED. */ | |
5075 encoding = strrchr (fontp->name, '-'); | |
5076 if (encoding && stricmp (encoding+1, "sjis") == 0) | |
5077 fontp->encoding[1] = 4; | |
5078 else | |
5068 fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED; | 5079 fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED; |
5069 | 5080 |
5070 /* The following three values are set to 0 under W32, which is | 5081 /* The following three values are set to 0 under W32, which is |
5071 what they get set to if XGetFontProperty fails under X. */ | 5082 what they get set to if XGetFontProperty fails under X. */ |
5072 fontp->baseline_offset = 0; | 5083 fontp->baseline_offset = 0; |
5073 fontp->relative_compose = 0; | 5084 fontp->relative_compose = 0; |
5074 fontp->default_ascent = FONT_BASE (font); | 5085 fontp->default_ascent = 0; |
5075 | 5086 |
5076 UNBLOCK_INPUT; | 5087 UNBLOCK_INPUT; |
5077 dpyinfo->n_fonts++; | 5088 dpyinfo->n_fonts++; |
5078 | 5089 |
5079 return fontp; | 5090 return fontp; |
5080 } | 5091 } |
5081 } | 5092 } |
5093 | |
5094 /* Load font named FONTNAME of size SIZE for frame F, and return a | |
5095 pointer to the structure font_info while allocating it dynamically. | |
5096 If loading fails, return NULL. */ | |
5097 struct font_info * | |
5098 w32_load_font (f,fontname,size) | |
5099 struct frame *f; | |
5100 char * fontname; | |
5101 int size; | |
5102 { | |
5103 Lisp_Object bdf_fonts; | |
5104 struct font_info *retval = NULL; | |
5105 | |
5106 bdf_fonts = w32_list_bdf_fonts (build_string (fontname)); | |
5107 | |
5108 while (!retval && CONSP (bdf_fonts)) | |
5109 { | |
5110 char *bdf_name, *bdf_file; | |
5111 Lisp_Object bdf_pair; | |
5112 | |
5113 bdf_name = XSTRING (XCONS (bdf_fonts)->car)->data; | |
5114 bdf_pair = Fassoc (XCONS (bdf_fonts)->car, Vw32_bdf_filename_alist); | |
5115 bdf_file = XSTRING (XCONS (bdf_pair)->cdr)->data; | |
5116 | |
5117 retval = w32_load_bdf_font (f, bdf_name, size, bdf_file); | |
5118 | |
5119 bdf_fonts = XCONS (bdf_fonts)->cdr; | |
5120 } | |
5121 | |
5122 if (retval) | |
5123 return retval; | |
5124 | |
5125 return w32_load_system_font(f, fontname, size); | |
5126 } | |
5127 | |
5082 | 5128 |
5083 void | 5129 void |
5084 w32_unload_font (dpyinfo, font) | 5130 w32_unload_font (dpyinfo, font) |
5085 struct w32_display_info *dpyinfo; | 5131 struct w32_display_info *dpyinfo; |
5086 XFontStruct * font; | 5132 XFontStruct * font; |
5087 { | 5133 { |
5088 if (font) | 5134 if (font) |
5089 { | 5135 { |
5136 if (font->bdf) w32_free_bdf_font (font->bdf); | |
5137 | |
5090 if (font->hfont) DeleteObject(font->hfont); | 5138 if (font->hfont) DeleteObject(font->hfont); |
5091 xfree (font); | 5139 xfree (font); |
5092 } | 5140 } |
5093 } | 5141 } |
5094 | 5142 |
5210 { | 5258 { |
5211 if (!lpcs) return (0); | 5259 if (!lpcs) return (0); |
5212 | 5260 |
5213 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; | 5261 if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; |
5214 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; | 5262 else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; |
5215 else if (stricmp (lpcs, "symbol") == 0) return SYMBOL_CHARSET; | 5263 else if (stricmp (lpcs, "ms-symbol") == 0) return SYMBOL_CHARSET; |
5216 else if (stricmp (lpcs, "jis") == 0) return SHIFTJIS_CHARSET; | 5264 else if (stricmp (lpcs, "jis") == 0) return SHIFTJIS_CHARSET; |
5217 else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET; | 5265 else if (stricmp (lpcs, "ksc5601.1987") == 0) return HANGEUL_CHARSET; |
5218 else if (stricmp (lpcs, "gb2312") == 0) return GB2312_CHARSET; | 5266 else if (stricmp (lpcs, "gb2312") == 0) return GB2312_CHARSET; |
5219 else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_CHARSET; | 5267 else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_CHARSET; |
5220 else if (stricmp (lpcs, "oem") == 0) return OEM_CHARSET; | 5268 else if (stricmp (lpcs, "ms-oem") == 0) return OEM_CHARSET; |
5221 | 5269 |
5222 #ifdef EASTEUROPE_CHARSET | 5270 #ifdef EASTEUROPE_CHARSET |
5223 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; | 5271 else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; |
5224 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET; | 5272 else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET; |
5225 else if (stricmp (lpcs, "iso8859-4") == 0) return BALTIC_CHARSET; | 5273 else if (stricmp (lpcs, "iso8859-4") == 0) return BALTIC_CHARSET; |
5231 else if (stricmp (lpcs, "iso8859-9") == 0) return TURKISH_CHARSET; | 5279 else if (stricmp (lpcs, "iso8859-9") == 0) return TURKISH_CHARSET; |
5232 else if (stricmp (lpcs, "viscii") == 0) return VIETNAMESE_CHARSET; | 5280 else if (stricmp (lpcs, "viscii") == 0) return VIETNAMESE_CHARSET; |
5233 else if (stricmp (lpcs, "vscii") == 0) return VIETNAMESE_CHARSET; | 5281 else if (stricmp (lpcs, "vscii") == 0) return VIETNAMESE_CHARSET; |
5234 else if (stricmp (lpcs, "tis620") == 0) return THAI_CHARSET; | 5282 else if (stricmp (lpcs, "tis620") == 0) return THAI_CHARSET; |
5235 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET; | 5283 else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET; |
5284 else if (stricmp (lpcs, "ksc5601.1992") == 0) return JOHAB_CHARSET; | |
5285 /* For backwards compatibility with previous 20.4 pretests. */ | |
5286 else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET; | |
5287 else if (stricmp (lpcs, "johab") == 0) return JOHAB_CHARSET; | |
5236 #endif | 5288 #endif |
5237 | 5289 |
5238 #ifdef UNICODE_CHARSET | 5290 #ifdef UNICODE_CHARSET |
5239 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; | 5291 else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; |
5240 else if (stricmp (lpcs, "unicode") == 0) return UNICODE_CHARSET; | 5292 else if (stricmp (lpcs, "unicode") == 0) return UNICODE_CHARSET; |
5253 switch (fncharset) | 5305 switch (fncharset) |
5254 { | 5306 { |
5255 /* ansi is considered iso8859-1, as most modern ansi fonts are. */ | 5307 /* ansi is considered iso8859-1, as most modern ansi fonts are. */ |
5256 case ANSI_CHARSET: return "iso8859-1"; | 5308 case ANSI_CHARSET: return "iso8859-1"; |
5257 case DEFAULT_CHARSET: return "ascii-*"; | 5309 case DEFAULT_CHARSET: return "ascii-*"; |
5258 case SYMBOL_CHARSET: return "*-symbol"; | 5310 case SYMBOL_CHARSET: return "ms-symbol"; |
5259 case SHIFTJIS_CHARSET: return "jisx0208-sjis"; | 5311 case SHIFTJIS_CHARSET: return "jisx0208-sjis"; |
5260 case HANGEUL_CHARSET: return "ksc5601-*"; | 5312 case HANGEUL_CHARSET: return "ksc5601.1987-*"; |
5261 case GB2312_CHARSET: return "gb2312-*"; | 5313 case GB2312_CHARSET: return "gb2312-*"; |
5262 case CHINESEBIG5_CHARSET: return "big5-*"; | 5314 case CHINESEBIG5_CHARSET: return "big5-*"; |
5263 case OEM_CHARSET: return "*-oem"; | 5315 case OEM_CHARSET: return "ms-oem"; |
5264 | 5316 |
5265 /* More recent versions of Windows (95 and NT4.0) define more | 5317 /* More recent versions of Windows (95 and NT4.0) define more |
5266 character sets. */ | 5318 character sets. */ |
5267 #ifdef EASTEUROPE_CHARSET | 5319 #ifdef EASTEUROPE_CHARSET |
5268 case EASTEUROPE_CHARSET: return "iso8859-2"; | 5320 case EASTEUROPE_CHARSET: return "iso8859-2"; |
5269 case TURKISH_CHARSET: return "iso8859-9"; | 5321 case TURKISH_CHARSET: return "iso8859-9"; |
5270 case BALTIC_CHARSET: return "iso8859-4"; | 5322 case BALTIC_CHARSET: return "iso8859-4"; |
5271 case RUSSIAN_CHARSET: return "koi8-r"; | 5323 |
5324 /* W95 with international support but not IE4 often has the | |
5325 KOI8-R codepage but not ISO8859-5. */ | |
5326 case RUSSIAN_CHARSET: | |
5327 if (!IsValidCodePage(28595) && IsValidCodePage(20886)) | |
5328 return "koi8-r"; | |
5329 else | |
5330 return "iso8859-5"; | |
5272 case ARABIC_CHARSET: return "iso8859-6"; | 5331 case ARABIC_CHARSET: return "iso8859-6"; |
5273 case GREEK_CHARSET: return "iso8859-7"; | 5332 case GREEK_CHARSET: return "iso8859-7"; |
5274 case HEBREW_CHARSET: return "iso8859-8"; | 5333 case HEBREW_CHARSET: return "iso8859-8"; |
5275 case VIETNAMESE_CHARSET: return "viscii1.1-*"; | 5334 case VIETNAMESE_CHARSET: return "viscii1.1-*"; |
5276 case THAI_CHARSET: return "tis620-*"; | 5335 case THAI_CHARSET: return "tis620-*"; |
5277 case MAC_CHARSET: return "*-mac"; | 5336 case MAC_CHARSET: return "mac-*"; |
5278 /* Johab is Korean, but Hangeul is the standard - what is this? */ | 5337 case JOHAB_CHARSET: return "ksc5601.1992-*"; |
5279 case JOHAB_CHARSET: return "*-johab"; | |
5280 | 5338 |
5281 #endif | 5339 #endif |
5282 | 5340 |
5283 #ifdef UNICODE_CHARSET | 5341 #ifdef UNICODE_CHARSET |
5284 case UNICODE_CHARSET: return "iso10646-unicode"; | 5342 case UNICODE_CHARSET: return "iso10646-unicode"; |
5298 char fontname[50]; | 5356 char fontname[50]; |
5299 char height_pixels[8]; | 5357 char height_pixels[8]; |
5300 char height_dpi[8]; | 5358 char height_dpi[8]; |
5301 char width_pixels[8]; | 5359 char width_pixels[8]; |
5302 char *fontname_dash; | 5360 char *fontname_dash; |
5361 int display_resy = one_w32_display_info.height_in; | |
5362 int display_resx = one_w32_display_info.width_in; | |
5303 | 5363 |
5304 if (!lpxstr) abort (); | 5364 if (!lpxstr) abort (); |
5305 | 5365 |
5306 if (!lplogfont) | 5366 if (!lplogfont) |
5307 return FALSE; | 5367 return FALSE; |
5317 | 5377 |
5318 if (lplogfont->lfHeight) | 5378 if (lplogfont->lfHeight) |
5319 { | 5379 { |
5320 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); | 5380 sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); |
5321 sprintf (height_dpi, "%u", | 5381 sprintf (height_dpi, "%u", |
5322 (abs (lplogfont->lfHeight) * 720) / one_w32_display_info.height_in); | 5382 abs (lplogfont->lfHeight) * 720 / display_resy); |
5323 } | 5383 } |
5324 else | 5384 else |
5325 { | 5385 { |
5326 strcpy (height_pixels, "*"); | 5386 strcpy (height_pixels, "*"); |
5327 strcpy (height_dpi, "*"); | 5387 strcpy (height_dpi, "*"); |
5330 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10); | 5390 sprintf (width_pixels, "%u", lplogfont->lfWidth * 10); |
5331 else | 5391 else |
5332 strcpy (width_pixels, "*"); | 5392 strcpy (width_pixels, "*"); |
5333 | 5393 |
5334 _snprintf (lpxstr, len - 1, | 5394 _snprintf (lpxstr, len - 1, |
5335 "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-%s", | 5395 "-*-%s-%s-%c-*-*-%s-%s-%d-%d-%c-%s-%s", |
5336 /* foundry */ | 5396 /* foundry */ |
5337 fontname, /* family */ | 5397 fontname, /* family */ |
5338 w32_to_x_weight (lplogfont->lfWeight), /* weight */ | 5398 w32_to_x_weight (lplogfont->lfWeight), /* weight */ |
5339 lplogfont->lfItalic?'i':'r', /* slant */ | 5399 lplogfont->lfItalic?'i':'r', /* slant */ |
5340 /* setwidth name */ | 5400 /* setwidth name */ |
5341 /* add style name */ | 5401 /* add style name */ |
5342 height_pixels, /* pixel size */ | 5402 height_pixels, /* pixel size */ |
5343 height_dpi, /* point size */ | 5403 height_dpi, /* point size */ |
5344 /* resx */ | 5404 display_resx, /* resx */ |
5345 /* resy */ | 5405 display_resy, /* resy */ |
5346 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) | 5406 ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) |
5347 ? 'p' : 'c', /* spacing */ | 5407 ? 'p' : 'c', /* spacing */ |
5348 width_pixels, /* avg width */ | 5408 width_pixels, /* avg width */ |
5349 w32_to_x_charset (lplogfont->lfCharSet) /* charset registry | 5409 w32_to_x_charset (lplogfont->lfCharSet) /* charset registry |
5350 and encoding*/ | 5410 and encoding*/ |
5388 * "<font name>[:height in pixels[:width in pixels[:weight]]]" | 5448 * "<font name>[:height in pixels[:width in pixels[:weight]]]" |
5389 */ | 5449 */ |
5390 | 5450 |
5391 if (*lpxstr == '-') | 5451 if (*lpxstr == '-') |
5392 { | 5452 { |
5393 int fields; | 5453 int fields, tem; |
5394 char name[50], weight[20], slant, pitch, pixels[10], height[10], width[10], remainder[20]; | 5454 char name[50], weight[20], slant, pitch, pixels[10], height[10], |
5455 width[10], resy[10], remainder[20]; | |
5395 char * encoding; | 5456 char * encoding; |
5457 int dpi = one_w32_display_info.height_in; | |
5396 | 5458 |
5397 fields = sscanf (lpxstr, | 5459 fields = sscanf (lpxstr, |
5398 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%*[^-]-%c-%9[^-]-%19s", | 5460 "-%*[^-]-%49[^-]-%19[^-]-%c-%*[^-]-%*[^-]-%9[^-]-%9[^-]-%*[^-]-%9[^-]-%c-%9[^-]-%19s", |
5399 name, weight, &slant, pixels, height, &pitch, width, remainder); | 5461 name, weight, &slant, pixels, height, resy, &pitch, width, remainder); |
5400 | |
5401 if (fields == EOF) return (FALSE); | 5462 if (fields == EOF) return (FALSE); |
5402 | 5463 |
5403 if (fields > 0 && name[0] != '*') | 5464 if (fields > 0 && name[0] != '*') |
5404 { | 5465 { |
5405 strncpy (lplogfont->lfFaceName,name, LF_FACESIZE); | 5466 strncpy (lplogfont->lfFaceName,name, LF_FACESIZE); |
5423 | 5484 |
5424 if (fields > 0 && pixels[0] != '*') | 5485 if (fields > 0 && pixels[0] != '*') |
5425 lplogfont->lfHeight = atoi (pixels); | 5486 lplogfont->lfHeight = atoi (pixels); |
5426 | 5487 |
5427 fields--; | 5488 fields--; |
5428 | |
5429 if (fields > 0 && lplogfont->lfHeight == 0 && height[0] != '*') | |
5430 lplogfont->lfHeight = (atoi (height) | |
5431 * one_w32_display_info.height_in) / 720; | |
5432 | |
5433 fields--; | 5489 fields--; |
5434 | 5490 if (fields > 0 && resy[0] != '*') |
5491 { | |
5492 tem = atoi (pixels); | |
5493 if (tem > 0) dpi = tem; | |
5494 } | |
5495 | |
5496 if (fields > -1 && lplogfont->lfHeight == 0 && height[0] != '*') | |
5497 lplogfont->lfHeight = atoi (height) * dpi / 720; | |
5498 | |
5499 if (fields > 0) | |
5435 lplogfont->lfPitchAndFamily = | 5500 lplogfont->lfPitchAndFamily = |
5436 (fields > 0 && pitch == 'p') ? VARIABLE_PITCH : FIXED_PITCH; | 5501 (fields > 0 && pitch == 'p') ? VARIABLE_PITCH : FIXED_PITCH; |
5437 | 5502 |
5438 fields--; | 5503 fields--; |
5439 | 5504 |
5499 BOOL | 5564 BOOL |
5500 w32_font_match (lpszfont1, lpszfont2) | 5565 w32_font_match (lpszfont1, lpszfont2) |
5501 char * lpszfont1; | 5566 char * lpszfont1; |
5502 char * lpszfont2; | 5567 char * lpszfont2; |
5503 { | 5568 { |
5504 char * s1 = lpszfont1, *e1; | 5569 char * s1 = lpszfont1, *e1, *w1; |
5505 char * s2 = lpszfont2, *e2; | 5570 char * s2 = lpszfont2, *e2, *w2; |
5506 | 5571 |
5507 if (s1 == NULL || s2 == NULL) return (FALSE); | 5572 if (s1 == NULL || s2 == NULL) return (FALSE); |
5508 | 5573 |
5509 if (*s1 == '-') s1++; | 5574 if (*s1 == '-') s1++; |
5510 if (*s2 == '-') s2++; | 5575 if (*s2 == '-') s2++; |
5511 | 5576 |
5512 while (1) | 5577 while (1) |
5513 { | 5578 { |
5514 int len1, len2; | 5579 int len1, len2, len3=0; |
5515 | 5580 |
5516 e1 = strchr (s1, '-'); | 5581 e1 = strchr (s1, '-'); |
5517 e2 = strchr (s2, '-'); | 5582 e2 = strchr (s2, '-'); |
5518 | 5583 w1 = strchr (s1, '*'); |
5519 if (e1 == NULL || e2 == NULL) return (TRUE); | 5584 w2 = strchr (s2, '*'); |
5520 | 5585 |
5586 if (e1 == NULL) | |
5587 len1 = strlen (s1); | |
5588 else | |
5521 len1 = e1 - s1; | 5589 len1 = e1 - s1; |
5590 if (e2 == NULL) | |
5591 len2 = strlen (s1); | |
5592 else | |
5522 len2 = e2 - s2; | 5593 len2 = e2 - s2; |
5523 | 5594 |
5524 if (*s1 != '*' && *s2 != '*' | 5595 if (w1 && w1 < e1) |
5525 && (len1 != len2 || strnicmp (s1, s2, len1) != 0)) | 5596 len3 = w1 - s1; |
5597 if (w2 && w2 < e2 && ( len3 == 0 || (w2 - s2) < len3)) | |
5598 len3 = w2 - s2; | |
5599 | |
5600 /* Whole field is not a wildcard, and ...*/ | |
5601 if (*s1 != '*' && *s2 != '*' && *s1 != '-' && *s2 != '-' | |
5602 /* Lengths are different and there are no wildcards, or ... */ | |
5603 && ((len1 != len2 && len3 == 0) || | |
5604 /* strings don't match up until first wildcard or end. */ | |
5605 strnicmp (s1, s2, len3 > 0 ? len3 : len1) != 0)) | |
5526 return (FALSE); | 5606 return (FALSE); |
5607 | |
5608 if (e1 == NULL || e2 == NULL) | |
5609 return (TRUE); | |
5527 | 5610 |
5528 s1 = e1 + 1; | 5611 s1 = e1 + 1; |
5529 s2 = e2 + 1; | 5612 s2 = e2 + 1; |
5530 } | 5613 } |
5531 } | 5614 } |
5535 HDC hdc; | 5618 HDC hdc; |
5536 int numFonts; | 5619 int numFonts; |
5537 LOGFONT logfont; | 5620 LOGFONT logfont; |
5538 XFontStruct *size_ref; | 5621 XFontStruct *size_ref; |
5539 Lisp_Object *pattern; | 5622 Lisp_Object *pattern; |
5540 Lisp_Object *head; | |
5541 Lisp_Object *tail; | 5623 Lisp_Object *tail; |
5542 } enumfont_t; | 5624 } enumfont_t; |
5543 | 5625 |
5544 int CALLBACK | 5626 int CALLBACK |
5545 enum_font_cb2 (lplf, lptm, FontType, lpef) | 5627 enum_font_cb2 (lplf, lptm, FontType, lpef) |
5571 | 5653 |
5572 /* The MaxCharWidth is not valid at this stage for scalable fonts. */ | 5654 /* The MaxCharWidth is not valid at this stage for scalable fonts. */ |
5573 if (FontType == RASTER_FONTTYPE) | 5655 if (FontType == RASTER_FONTTYPE) |
5574 width = make_number (lptm->tmMaxCharWidth); | 5656 width = make_number (lptm->tmMaxCharWidth); |
5575 | 5657 |
5576 if (!w32_to_x_font (lplf, buf, 100)) return (0); | 5658 if (!w32_to_x_font (&(lplf->elfLogFont), buf, 100)) |
5577 | 5659 return (0); |
5578 if (NILP (*(lpef->pattern)) || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) | 5660 |
5661 if (NILP (*(lpef->pattern)) || | |
5662 w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) | |
5579 { | 5663 { |
5580 *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); | 5664 *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); |
5581 lpef->tail = &(XCONS (*lpef->tail)->cdr); | 5665 lpef->tail = &(XCONS (*lpef->tail)->cdr); |
5582 lpef->numFonts++; | 5666 lpef->numFonts++; |
5583 } | 5667 } |
5601 | 5685 |
5602 | 5686 |
5603 /* Interface to fontset handler. (adapted from mw32font.c in Meadow | 5687 /* Interface to fontset handler. (adapted from mw32font.c in Meadow |
5604 and xterm.c in Emacs 20.3) */ | 5688 and xterm.c in Emacs 20.3) */ |
5605 | 5689 |
5690 Lisp_Object w32_list_bdf_fonts (Lisp_Object pattern) | |
5691 { | |
5692 char *fontname, *ptnstr; | |
5693 Lisp_Object list, tem, newlist = Qnil; | |
5694 | |
5695 list = Vw32_bdf_filename_alist; | |
5696 ptnstr = XSTRING (pattern)->data; | |
5697 | |
5698 for ( ; CONSP (list); list = XCONS (list)->cdr) | |
5699 { | |
5700 tem = XCONS (list)->car; | |
5701 if (CONSP (tem)) | |
5702 fontname = XSTRING (XCONS (tem)->car)->data; | |
5703 else if (STRINGP (tem)) | |
5704 fontname = XSTRING (tem)->data; | |
5705 else | |
5706 continue; | |
5707 | |
5708 if (w32_font_match (fontname, ptnstr)) | |
5709 newlist = Fcons (XCONS (tem)->car, newlist); | |
5710 } | |
5711 | |
5712 return newlist; | |
5713 } | |
5714 | |
5606 /* Return a list of names of available fonts matching PATTERN on frame | 5715 /* Return a list of names of available fonts matching PATTERN on frame |
5607 F. If SIZE is not 0, it is the size (maximum bound width) of fonts | 5716 F. If SIZE is not 0, it is the size (maximum bound width) of fonts |
5608 to be listed. Frame F NULL means we have not yet created any | 5717 to be listed. Frame F NULL means we have not yet created any |
5609 frame, which means we can't get proper size info, as we don't have | 5718 frame, which means we can't get proper size info, as we don't have |
5610 a device context to use for GetTextMetrics. | 5719 a device context to use for GetTextMetrics. |
5611 MAXNAMES sets a limit on how many fonts to match. */ | 5720 MAXNAMES sets a limit on how many fonts to match. */ |
5612 | 5721 |
5613 Lisp_Object | 5722 Lisp_Object |
5614 w32_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames ) | 5723 w32_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames ) |
5615 { | 5724 { |
5616 Lisp_Object patterns, key, tem; | 5725 Lisp_Object patterns, key, tem, tpat; |
5617 Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil; | 5726 Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil; |
5618 | 5727 struct w32_display_info *dpyinfo = &one_w32_display_info; |
5619 /* If we don't have a frame, we can't use the Windows API to list | |
5620 fonts, as it requires a device context for the Window. This will | |
5621 only happen during startup if the user specifies a font on the | |
5622 command line. Print a message on stderr and return nil. */ | |
5623 if (!f) | |
5624 { | |
5625 char buffer[256]; | |
5626 | |
5627 sprintf (buffer, | |
5628 "Emacs cannot get a list of fonts before the initial frame " | |
5629 "is created.\nThe font specified on the command line may not " | |
5630 "be found.\n"); | |
5631 MessageBox (NULL, buffer, "Emacs Warning Dialog", | |
5632 MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); | |
5633 return Qnil; | |
5634 } | |
5635 | |
5636 | 5728 |
5637 patterns = Fassoc (pattern, Valternate_fontname_alist); | 5729 patterns = Fassoc (pattern, Valternate_fontname_alist); |
5638 if (NILP (patterns)) | 5730 if (NILP (patterns)) |
5639 patterns = Fcons (pattern, Qnil); | 5731 patterns = Fcons (pattern, Qnil); |
5640 | 5732 |
5641 for (; CONSP (patterns); patterns = XCONS (patterns)->cdr) | 5733 for (; CONSP (patterns); patterns = XCONS (patterns)->cdr) |
5642 { | 5734 { |
5643 enumfont_t ef; | 5735 enumfont_t ef; |
5644 | 5736 |
5645 pattern = XCONS (patterns)->car; | 5737 tpat = XCONS (patterns)->car; |
5646 | 5738 |
5647 /* See if we cached the result for this particular query. | 5739 /* See if we cached the result for this particular query. |
5648 The cache is an alist of the form: | 5740 The cache is an alist of the form: |
5649 ((PATTERN (FONTNAME . WIDTH) ...) ...) | 5741 ((PATTERN (FONTNAME . WIDTH) ...) ...) |
5650 */ | 5742 */ |
5651 if ( f && | 5743 if (tem = XCONS (dpyinfo->name_list_element)->cdr, |
5652 (tem = XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr, | 5744 !NILP (list = Fassoc (tpat, tem))) |
5653 !NILP (list = Fassoc (pattern, tem)))) | |
5654 { | 5745 { |
5655 list = Fcdr_safe (list); | 5746 list = Fcdr_safe (list); |
5656 /* We have a cached list. Don't have to get the list again. */ | 5747 /* We have a cached list. Don't have to get the list again. */ |
5657 goto label_cached; | 5748 goto label_cached; |
5658 } | 5749 } |
5659 | 5750 |
5660 BLOCK_INPUT; | 5751 BLOCK_INPUT; |
5661 /* At first, put PATTERN in the cache. */ | 5752 /* At first, put PATTERN in the cache. */ |
5662 list = Qnil; | 5753 list = Qnil; |
5663 ef.pattern = &pattern; | 5754 ef.pattern = &tpat; |
5664 ef.tail = ef.head = &list; | 5755 ef.tail = &list; |
5665 ef.numFonts = 0; | 5756 ef.numFonts = 0; |
5666 x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data : | 5757 |
5758 x_to_w32_font (STRINGP (tpat) ? XSTRING (tpat)->data : | |
5667 NULL, &ef.logfont); | 5759 NULL, &ef.logfont); |
5668 { | 5760 { |
5669 ef.hdc = GetDC (FRAME_W32_WINDOW (f)); | 5761 ef.hdc = GetDC (dpyinfo->root_window); |
5670 | 5762 |
5671 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, | 5763 EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, |
5672 (LPARAM)&ef); | 5764 (LPARAM)&ef); |
5673 | 5765 |
5674 ReleaseDC (FRAME_W32_WINDOW (f), ef.hdc); | 5766 ReleaseDC (dpyinfo->root_window, ef.hdc); |
5675 } | 5767 } |
5676 | 5768 |
5677 UNBLOCK_INPUT; | 5769 UNBLOCK_INPUT; |
5678 | 5770 |
5679 /* Make a list of the fonts we got back. | 5771 /* Make a list of the fonts we got back. |
5680 Store that in the font cache for the display. */ | 5772 Store that in the font cache for the display. */ |
5681 if (f != NULL) | 5773 XCONS (dpyinfo->name_list_element)->cdr |
5682 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr | 5774 = Fcons (Fcons (tpat, list), |
5683 = Fcons (Fcons (pattern, list), | 5775 XCONS (dpyinfo->name_list_element)->cdr); |
5684 XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr); | |
5685 | 5776 |
5686 label_cached: | 5777 label_cached: |
5687 if (NILP (list)) continue; /* Try the remaining alternatives. */ | 5778 if (NILP (list)) continue; /* Try the remaining alternatives. */ |
5688 | 5779 |
5689 newlist = second_best = Qnil; | 5780 newlist = second_best = Qnil; |
5705 } | 5796 } |
5706 if (!INTEGERP (XCONS (tem)->cdr)) | 5797 if (!INTEGERP (XCONS (tem)->cdr)) |
5707 { | 5798 { |
5708 /* Since we don't yet know the size of the font, we must | 5799 /* Since we don't yet know the size of the font, we must |
5709 load it and try GetTextMetrics. */ | 5800 load it and try GetTextMetrics. */ |
5710 struct w32_display_info *dpyinfo | |
5711 = FRAME_W32_DISPLAY_INFO (f); | |
5712 W32FontStruct thisinfo; | 5801 W32FontStruct thisinfo; |
5713 LOGFONT lf; | 5802 LOGFONT lf; |
5714 HDC hdc; | 5803 HDC hdc; |
5715 HANDLE oldobj; | 5804 HANDLE oldobj; |
5716 | 5805 |
5717 if (!x_to_w32_font (XSTRING (XCONS (tem)->car)->data, &lf)) | 5806 if (!x_to_w32_font (XSTRING (XCONS (tem)->car)->data, &lf)) |
5718 continue; | 5807 continue; |
5719 | 5808 |
5720 BLOCK_INPUT; | 5809 BLOCK_INPUT; |
5810 thisinfo.bdf = NULL; | |
5721 thisinfo.hfont = CreateFontIndirect (&lf); | 5811 thisinfo.hfont = CreateFontIndirect (&lf); |
5722 if (thisinfo.hfont == NULL) | 5812 if (thisinfo.hfont == NULL) |
5723 continue; | 5813 continue; |
5724 | 5814 |
5725 hdc = GetDC (dpyinfo->root_window); | 5815 hdc = GetDC (dpyinfo->root_window); |
5765 { | 5855 { |
5766 newlist = Fcons (XCONS (second_best)->car, Qnil); | 5856 newlist = Fcons (XCONS (second_best)->car, Qnil); |
5767 break; | 5857 break; |
5768 } | 5858 } |
5769 } | 5859 } |
5860 | |
5861 /* Include any bdf fonts. */ | |
5862 { | |
5863 Lisp_Object combined[2]; | |
5864 combined[0] = w32_list_bdf_fonts (pattern); | |
5865 combined[1] = newlist; | |
5866 newlist = Fnconc(2, combined); | |
5867 } | |
5770 | 5868 |
5771 return newlist; | 5869 return newlist; |
5772 } | 5870 } |
5773 | 5871 |
5774 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ | 5872 /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ |
5945 | 6043 |
5946 BLOCK_INPUT; | 6044 BLOCK_INPUT; |
5947 | 6045 |
5948 namelist = Qnil; | 6046 namelist = Qnil; |
5949 ef.pattern = &pattern; | 6047 ef.pattern = &pattern; |
5950 ef.tail = ef.head = &namelist; | 6048 ef.tail &namelist; |
5951 ef.numFonts = 0; | 6049 ef.numFonts = 0; |
5952 x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont); | 6050 x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data : NULL, &ef.logfont); |
5953 | 6051 |
5954 { | 6052 { |
5955 ef.hdc = GetDC (FRAME_W32_WINDOW (f)); | 6053 ef.hdc = GetDC (FRAME_W32_WINDOW (f)); |
6006 } | 6104 } |
6007 | 6105 |
6008 return list; | 6106 return list; |
6009 } | 6107 } |
6010 #endif | 6108 #endif |
6109 | |
6110 DEFUN ("w32-find-bdf-fonts", Fw32_find_bdf_fonts, Sw32_find_bdf_fonts, | |
6111 1, 1, 0, | |
6112 "Return a list of BDF fonts in DIR, suitable for appending to\n\ | |
6113 w32-bdf-filename-alist. Fonts which do not contain an xfld description\n\ | |
6114 will not be included in the list. DIR may be a list of directories.") | |
6115 (directory) | |
6116 Lisp_Object directory; | |
6117 { | |
6118 Lisp_Object list = Qnil; | |
6119 struct gcpro gcpro1, gcpro2; | |
6120 | |
6121 if (!CONSP (directory)) | |
6122 return w32_find_bdf_fonts_in_dir (directory); | |
6123 | |
6124 for ( ; CONSP (directory); directory = XCONS (directory)->cdr) | |
6125 { | |
6126 Lisp_Object pair[2]; | |
6127 pair[0] = list; | |
6128 pair[1] = Qnil; | |
6129 GCPRO2 (directory, list); | |
6130 pair[1] = w32_find_bdf_fonts_in_dir( XCONS (directory)->car ); | |
6131 list = Fnconc( 2, pair ); | |
6132 UNGCPRO; | |
6133 } | |
6134 return list; | |
6135 } | |
6136 | |
6137 /* Find BDF files in a specified directory. (use GCPRO when calling, | |
6138 as this calls lisp to get a directory listing). */ | |
6139 Lisp_Object w32_find_bdf_fonts_in_dir( Lisp_Object directory ) | |
6140 { | |
6141 Lisp_Object filelist, list = Qnil; | |
6142 char fontname[100]; | |
6143 | |
6144 if (!STRINGP(directory)) | |
6145 return Qnil; | |
6146 | |
6147 filelist = Fdirectory_files (directory, Qt, | |
6148 build_string (".*\\.[bB][dD][fF]"), Qt); | |
6149 | |
6150 for ( ; CONSP(filelist); filelist = XCONS (filelist)->cdr) | |
6151 { | |
6152 Lisp_Object filename = XCONS (filelist)->car; | |
6153 if (w32_BDF_to_x_font (XSTRING (filename)->data, fontname, 100)) | |
6154 store_in_alist (&list, build_string (fontname), filename); | |
6155 } | |
6156 return list; | |
6157 } | |
6158 | |
6011 | 6159 |
6012 DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, | 6160 DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, |
6013 "Return non-nil if color COLOR is supported on frame FRAME.\n\ | 6161 "Return non-nil if color COLOR is supported on frame FRAME.\n\ |
6014 If FRAME is omitted or nil, use the selected frame.") | 6162 If FRAME is omitted or nil, use the selected frame.") |
6015 (color, frame) | 6163 (color, frame) |
7061 are displayed by converting them to the equivalent multibyte characters\n\ | 7209 are displayed by converting them to the equivalent multibyte characters\n\ |
7062 according to the current language environment. As a result, they are\n\ | 7210 according to the current language environment. As a result, they are\n\ |
7063 displayed according to the current fontset."); | 7211 displayed according to the current fontset."); |
7064 unibyte_display_via_language_environment = 0; | 7212 unibyte_display_via_language_environment = 0; |
7065 | 7213 |
7214 DEFVAR_LISP ("w32-bdf-filename-alist", | |
7215 &Vw32_bdf_filename_alist, | |
7216 "List of bdf fonts and their corresponding filenames."); | |
7217 Vw32_bdf_filename_alist = Qnil; | |
7218 | |
7066 defsubr (&Sx_get_resource); | 7219 defsubr (&Sx_get_resource); |
7067 defsubr (&Sx_list_fonts); | 7220 defsubr (&Sx_list_fonts); |
7068 defsubr (&Sx_display_color_p); | 7221 defsubr (&Sx_display_color_p); |
7069 defsubr (&Sx_display_grayscale_p); | 7222 defsubr (&Sx_display_grayscale_p); |
7070 defsubr (&Sx_color_defined_p); | 7223 defsubr (&Sx_color_defined_p); |
7100 defsubr (&Sw32_register_hot_key); | 7253 defsubr (&Sw32_register_hot_key); |
7101 defsubr (&Sw32_unregister_hot_key); | 7254 defsubr (&Sw32_unregister_hot_key); |
7102 defsubr (&Sw32_registered_hot_keys); | 7255 defsubr (&Sw32_registered_hot_keys); |
7103 defsubr (&Sw32_reconstruct_hot_key); | 7256 defsubr (&Sw32_reconstruct_hot_key); |
7104 defsubr (&Sw32_toggle_lock_key); | 7257 defsubr (&Sw32_toggle_lock_key); |
7258 defsubr (&Sw32_find_bdf_fonts); | |
7105 | 7259 |
7106 /* Setting callback functions for fontset handler. */ | 7260 /* Setting callback functions for fontset handler. */ |
7107 get_font_info_func = w32_get_font_info; | 7261 get_font_info_func = w32_get_font_info; |
7108 list_fonts_func = w32_list_fonts; | 7262 list_fonts_func = w32_list_fonts; |
7109 load_font_func = w32_load_font; | 7263 load_font_func = w32_load_font; |