diff options
| author | Geoff Voelker | 1998-10-20 22:13:14 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1998-10-20 22:13:14 +0000 |
| commit | 4587b02635dd8a7fe39cc899b61ffb65d548f8a3 (patch) | |
| tree | a2cb4942f1e6e059060221d6383ac51f00cc4129 /src | |
| parent | 30a231e64dddc201b698a69ab1e59a181bf1eb0c (diff) | |
| download | emacs-4587b02635dd8a7fe39cc899b61ffb65d548f8a3.tar.gz emacs-4587b02635dd8a7fe39cc899b61ffb65d548f8a3.zip | |
(Vx_pixel_size_width): New global variable.
(unibyte_display_via_language_environment): New global variable.
(x_set_font): Add support for setting fontsets.
(Fx_create_frame): Add check_w32(). Initialize fontsets. Fix
font names to match xlfd-tight-regexp.
(w32_load_font): Rewrite based on x_load_font.
(x_to_w32_charset, w32_to_x_charset): Add character sets. Use
`iso8859-1' rather than `ansi'.
(w32_to_x_font): Remove `-' from font name. Remove the `-' off the
end. Move charset into `charset registry' field.
(enum_font_cb2): Check charsets match. Include width in font list.
(w32_list_fonts): Rewrite based on x_list_fonts.
Moved from w32term.c to have access to enumfont_t struct.
(Fx_list_fonts): w32 specific version eliminated. Include
`x-list-fonts.c'.
(w32_get_font_info, w32_query_font, w32_find_ccl_program): New
functions for fontset support - adapted from x_ equivalents.
(syms_of_w32fns): New lisp variables initialised. Function
pointers for fontset.c set up.
Diffstat (limited to 'src')
| -rw-r--r-- | src/w32fns.c | 559 |
1 files changed, 517 insertions, 42 deletions
diff --git a/src/w32fns.c b/src/w32fns.c index 0221dd290e4..8c0d93b0e66 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -28,6 +28,8 @@ Boston, MA 02111-1307, USA. */ | |||
| 28 | #include <errno.h> | 28 | #include <errno.h> |
| 29 | 29 | ||
| 30 | #include "lisp.h" | 30 | #include "lisp.h" |
| 31 | #include "charset.h" | ||
| 32 | #include "fontset.h" | ||
| 31 | #include "w32term.h" | 33 | #include "w32term.h" |
| 32 | #include "frame.h" | 34 | #include "frame.h" |
| 33 | #include "window.h" | 35 | #include "window.h" |
| @@ -38,6 +40,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 38 | #include "paths.h" | 40 | #include "paths.h" |
| 39 | #include "w32heap.h" | 41 | #include "w32heap.h" |
| 40 | #include "termhooks.h" | 42 | #include "termhooks.h" |
| 43 | #include "coding.h" | ||
| 41 | 44 | ||
| 42 | #include <commdlg.h> | 45 | #include <commdlg.h> |
| 43 | #include <shellapi.h> | 46 | #include <shellapi.h> |
| @@ -97,6 +100,12 @@ static int w32_in_use; | |||
| 97 | /* Search path for bitmap files. */ | 100 | /* Search path for bitmap files. */ |
| 98 | Lisp_Object Vx_bitmap_file_path; | 101 | Lisp_Object Vx_bitmap_file_path; |
| 99 | 102 | ||
| 103 | /* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */ | ||
| 104 | Lisp_Object Vx_pixel_size_width_font_regexp; | ||
| 105 | |||
| 106 | /* A flag to control how to display unibyte 8-bit character. */ | ||
| 107 | int unibyte_display_via_language_environment; | ||
| 108 | |||
| 100 | /* Evaluate this expression to rebuild the section of syms_of_w32fns | 109 | /* Evaluate this expression to rebuild the section of syms_of_w32fns |
| 101 | that initializes and staticpros the symbols declared below. Note | 110 | that initializes and staticpros the symbols declared below. Note |
| 102 | that Emacs 18 has a bug that keeps C-x C-e from being able to | 111 | that Emacs 18 has a bug that keeps C-x C-e from being able to |
| @@ -2111,6 +2120,7 @@ x_set_icon_name (f, arg, oldval) | |||
| 2111 | } | 2120 | } |
| 2112 | 2121 | ||
| 2113 | extern Lisp_Object x_new_font (); | 2122 | extern Lisp_Object x_new_font (); |
| 2123 | extern Lisp_Object x_new_fontset(); | ||
| 2114 | 2124 | ||
| 2115 | void | 2125 | void |
| 2116 | x_set_font (f, arg, oldval) | 2126 | x_set_font (f, arg, oldval) |
| @@ -2118,12 +2128,17 @@ x_set_font (f, arg, oldval) | |||
| 2118 | Lisp_Object arg, oldval; | 2128 | Lisp_Object arg, oldval; |
| 2119 | { | 2129 | { |
| 2120 | Lisp_Object result; | 2130 | Lisp_Object result; |
| 2131 | Lisp_Object fontset_name; | ||
| 2121 | Lisp_Object frame; | 2132 | Lisp_Object frame; |
| 2122 | 2133 | ||
| 2123 | CHECK_STRING (arg, 1); | 2134 | CHECK_STRING (arg, 1); |
| 2124 | 2135 | ||
| 2136 | fontset_name = Fquery_fontset (arg, Qnil); | ||
| 2137 | |||
| 2125 | BLOCK_INPUT; | 2138 | BLOCK_INPUT; |
| 2126 | result = x_new_font (f, XSTRING (arg)->data); | 2139 | result = (STRINGP (fontset_name) |
| 2140 | ? x_new_fontset (f, XSTRING (fontset_name)->data) | ||
| 2141 | : x_new_font (f, XSTRING (arg)->data)); | ||
| 2127 | UNBLOCK_INPUT; | 2142 | UNBLOCK_INPUT; |
| 2128 | 2143 | ||
| 2129 | if (EQ (result, Qnil)) | 2144 | if (EQ (result, Qnil)) |
| @@ -2904,7 +2919,7 @@ w32_init_class (hinst) | |||
| 2904 | wc.hInstance = hinst; | 2919 | wc.hInstance = hinst; |
| 2905 | wc.hIcon = LoadIcon (hinst, EMACS_CLASS); | 2920 | wc.hIcon = LoadIcon (hinst, EMACS_CLASS); |
| 2906 | wc.hCursor = LoadCursor (NULL, IDC_ARROW); | 2921 | wc.hCursor = LoadCursor (NULL, IDC_ARROW); |
| 2907 | wc.hbrBackground = NULL; // GetStockObject (WHITE_BRUSH); | 2922 | wc.hbrBackground = NULL; /* GetStockObject (WHITE_BRUSH); */ |
| 2908 | wc.lpszMenuName = NULL; | 2923 | wc.lpszMenuName = NULL; |
| 2909 | wc.lpszClassName = EMACS_CLASS; | 2924 | wc.lpszClassName = EMACS_CLASS; |
| 2910 | 2925 | ||
| @@ -4149,6 +4164,8 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 4149 | Lisp_Object parent; | 4164 | Lisp_Object parent; |
| 4150 | struct kboard *kb; | 4165 | struct kboard *kb; |
| 4151 | 4166 | ||
| 4167 | check_w32 (); | ||
| 4168 | |||
| 4152 | /* Use this general default value to start with | 4169 | /* Use this general default value to start with |
| 4153 | until we know if this frame has a specified name. */ | 4170 | until we know if this frame has a specified name. */ |
| 4154 | Vx_resource_name = Vinvocation_name; | 4171 | Vx_resource_name = Vinvocation_name; |
| @@ -4208,6 +4225,8 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 4208 | f->output_data.w32 = (struct w32_output *) xmalloc (sizeof (struct w32_output)); | 4225 | f->output_data.w32 = (struct w32_output *) xmalloc (sizeof (struct w32_output)); |
| 4209 | bzero (f->output_data.w32, sizeof (struct w32_output)); | 4226 | bzero (f->output_data.w32, sizeof (struct w32_output)); |
| 4210 | 4227 | ||
| 4228 | FRAME_FONTSET (f) = -1; | ||
| 4229 | |||
| 4211 | f->icon_name | 4230 | f->icon_name |
| 4212 | = x_get_arg (parms, Qicon_name, "iconName", "Title", string); | 4231 | = x_get_arg (parms, Qicon_name, "iconName", "Title", string); |
| 4213 | if (! STRINGP (f->icon_name)) | 4232 | if (! STRINGP (f->icon_name)) |
| @@ -4249,6 +4268,10 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 4249 | specbind (Qx_resource_name, name); | 4268 | specbind (Qx_resource_name, name); |
| 4250 | } | 4269 | } |
| 4251 | 4270 | ||
| 4271 | /* Create fontsets from `global_fontset_alist' before handling fonts. */ | ||
| 4272 | for (tem = Vglobal_fontset_alist; CONSP (tem); tem = XCONS (tem)->cdr) | ||
| 4273 | fs_register_fontset (f, XCONS (tem)->car); | ||
| 4274 | |||
| 4252 | /* Extract the window parameters from the supplied values | 4275 | /* Extract the window parameters from the supplied values |
| 4253 | that are needed to determine window geometry. */ | 4276 | that are needed to determine window geometry. */ |
| 4254 | { | 4277 | { |
| @@ -4258,15 +4281,21 @@ This function is an internal primitive--use `make-frame' instead.") | |||
| 4258 | BLOCK_INPUT; | 4281 | BLOCK_INPUT; |
| 4259 | /* First, try whatever font the caller has specified. */ | 4282 | /* First, try whatever font the caller has specified. */ |
| 4260 | if (STRINGP (font)) | 4283 | if (STRINGP (font)) |
| 4284 | { | ||
| 4285 | tem = Fquery_fontset (font, Qnil); | ||
| 4286 | if (STRINGP (tem)) | ||
| 4287 | font = x_new_fontset (f, XSTRING (tem)->data); | ||
| 4288 | else | ||
| 4261 | font = x_new_font (f, XSTRING (font)->data); | 4289 | font = x_new_font (f, XSTRING (font)->data); |
| 4290 | } | ||
| 4262 | /* Try out a font which we hope has bold and italic variations. */ | 4291 | /* Try out a font which we hope has bold and italic variations. */ |
| 4263 | if (!STRINGP (font)) | 4292 | if (!STRINGP (font)) |
| 4264 | font = x_new_font (f, "-*-Courier New-normal-r-*-*-13-97-*-*-c-*-*-ansi-"); | 4293 | font = x_new_font (f, "-*-Courier New-normal-r-*-*-13-*-*-*-c-*-iso8859-1"); |
| 4265 | if (! STRINGP (font)) | 4294 | if (! STRINGP (font)) |
| 4266 | font = x_new_font (f, "-*-Courier-normal-r-*-*-13-97-*-*-c-*-*-ansi-"); | 4295 | font = x_new_font (f, "-*-Courier-normal-r-*-*-*-97-*-*-c-*-iso8859-1"); |
| 4267 | /* If those didn't work, look for something which will at least work. */ | 4296 | /* If those didn't work, look for something which will at least work. */ |
| 4268 | if (! STRINGP (font)) | 4297 | if (! STRINGP (font)) |
| 4269 | font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-13-97-*-*-c-*-*-ansi-"); | 4298 | font = x_new_font (f, "-*-Fixedsys-normal-r-*-*-*-*-90-*-c-*-iso8859-1"); |
| 4270 | UNBLOCK_INPUT; | 4299 | UNBLOCK_INPUT; |
| 4271 | if (! STRINGP (font)) | 4300 | if (! STRINGP (font)) |
| 4272 | font = build_string ("Fixedsys"); | 4301 | font = build_string ("Fixedsys"); |
| @@ -4433,20 +4462,70 @@ DEFUN ("w32-focus-frame", Fw32_focus_frame, Sw32_focus_frame, 1, 1, 0, | |||
| 4433 | } | 4462 | } |
| 4434 | 4463 | ||
| 4435 | 4464 | ||
| 4436 | XFontStruct * | 4465 | /* Load font named FONTNAME of size SIZE for frame F, and return a |
| 4437 | w32_load_font (dpyinfo,name) | 4466 | pointer to the structure font_info while allocating it dynamically. |
| 4438 | struct w32_display_info *dpyinfo; | 4467 | If loading fails, return NULL. */ |
| 4439 | char * name; | 4468 | struct font_info * |
| 4469 | w32_load_font (f,fontname,size) | ||
| 4470 | struct frame *f; | ||
| 4471 | char * fontname; | ||
| 4472 | int size; | ||
| 4440 | { | 4473 | { |
| 4441 | XFontStruct * font = NULL; | 4474 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
| 4442 | BOOL ok; | 4475 | Lisp_Object font_names; |
| 4476 | |||
| 4477 | #if 0 /* x_load_font attempts to get a list of fonts - presumably to | ||
| 4478 | allow a fuzzier fontname to be specified. w32_list_fonts | ||
| 4479 | appears to be a bit too fuzzy for this purpose. */ | ||
| 4443 | 4480 | ||
| 4481 | /* Get a list of all the fonts that match this name. Once we | ||
| 4482 | have a list of matching fonts, we compare them against the fonts | ||
| 4483 | we already have loaded by comparing names. */ | ||
| 4484 | font_names = w32_list_fonts (f, build_string (fontname), size, 100); | ||
| 4485 | |||
| 4486 | if (!NILP (font_names)) | ||
| 4444 | { | 4487 | { |
| 4488 | Lisp_Object tail; | ||
| 4489 | int i; | ||
| 4490 | |||
| 4491 | #if 0 /* This code has nasty side effects that cause Emacs to crash. */ | ||
| 4492 | |||
| 4493 | /* First check if any are already loaded, as that is cheaper | ||
| 4494 | than loading another one. */ | ||
| 4495 | for (i = 0; i < dpyinfo->n_fonts; i++) | ||
| 4496 | for (tail = font_names; CONSP (tail); tail = XCONS (tail)->cdr) | ||
| 4497 | if (!strcmp (dpyinfo->font_table[i].name, | ||
| 4498 | XSTRING (XCONS (tail)->car)->data) | ||
| 4499 | || !strcmp (dpyinfo->font_table[i].full_name, | ||
| 4500 | XSTRING (XCONS (tail)->car)->data)) | ||
| 4501 | return (dpyinfo->font_table + i); | ||
| 4502 | #endif | ||
| 4503 | |||
| 4504 | fontname = (char *) XSTRING (XCONS (font_names)->car)->data; | ||
| 4505 | } | ||
| 4506 | else | ||
| 4507 | return NULL; | ||
| 4508 | #endif | ||
| 4509 | |||
| 4510 | /* Load the font and add it to the table. */ | ||
| 4511 | { | ||
| 4512 | char *full_name; | ||
| 4513 | XFontStruct *font; | ||
| 4514 | struct font_info *fontp; | ||
| 4445 | LOGFONT lf; | 4515 | LOGFONT lf; |
| 4516 | BOOL ok; | ||
| 4446 | 4517 | ||
| 4447 | if (!name || !x_to_w32_font (name, &lf)) | 4518 | if (!fontname || !x_to_w32_font (fontname, &lf)) |
| 4448 | return (NULL); | 4519 | return (NULL); |
| 4449 | 4520 | ||
| 4521 | if (!*lf.lfFaceName) | ||
| 4522 | /* If no name was specified for the font, we get a random font | ||
| 4523 | from CreateFontIndirect - this is not particularly | ||
| 4524 | desirable, especially since CreateFontIndirect does not | ||
| 4525 | fill out the missing name in lf, so we never know what we | ||
| 4526 | ended up with. */ | ||
| 4527 | return NULL; | ||
| 4528 | |||
| 4450 | font = (XFontStruct *) xmalloc (sizeof (XFontStruct)); | 4529 | font = (XFontStruct *) xmalloc (sizeof (XFontStruct)); |
| 4451 | 4530 | ||
| 4452 | if (!font) return (NULL); | 4531 | if (!font) return (NULL); |
| @@ -4454,7 +4533,6 @@ char * name; | |||
| 4454 | BLOCK_INPUT; | 4533 | BLOCK_INPUT; |
| 4455 | 4534 | ||
| 4456 | font->hfont = CreateFontIndirect (&lf); | 4535 | font->hfont = CreateFontIndirect (&lf); |
| 4457 | } | ||
| 4458 | 4536 | ||
| 4459 | if (font->hfont == NULL) | 4537 | if (font->hfont == NULL) |
| 4460 | { | 4538 | { |
| @@ -4474,12 +4552,78 @@ char * name; | |||
| 4474 | 4552 | ||
| 4475 | UNBLOCK_INPUT; | 4553 | UNBLOCK_INPUT; |
| 4476 | 4554 | ||
| 4477 | if (ok) return (font); | 4555 | if (!ok) |
| 4478 | 4556 | { | |
| 4479 | w32_unload_font (dpyinfo, font); | 4557 | w32_unload_font (dpyinfo, font); |
| 4480 | return (NULL); | 4558 | return (NULL); |
| 4481 | } | 4559 | } |
| 4482 | 4560 | ||
| 4561 | /* Do we need to create the table? */ | ||
| 4562 | if (dpyinfo->font_table_size == 0) | ||
| 4563 | { | ||
| 4564 | dpyinfo->font_table_size = 16; | ||
| 4565 | dpyinfo->font_table | ||
| 4566 | = (struct font_info *) xmalloc (dpyinfo->font_table_size | ||
| 4567 | * sizeof (struct font_info)); | ||
| 4568 | } | ||
| 4569 | /* Do we need to grow the table? */ | ||
| 4570 | else if (dpyinfo->n_fonts | ||
| 4571 | >= dpyinfo->font_table_size) | ||
| 4572 | { | ||
| 4573 | dpyinfo->font_table_size *= 2; | ||
| 4574 | dpyinfo->font_table | ||
| 4575 | = (struct font_info *) xrealloc (dpyinfo->font_table, | ||
| 4576 | (dpyinfo->font_table_size | ||
| 4577 | * sizeof (struct font_info))); | ||
| 4578 | } | ||
| 4579 | |||
| 4580 | fontp = dpyinfo->font_table + dpyinfo->n_fonts; | ||
| 4581 | |||
| 4582 | /* Now fill in the slots of *FONTP. */ | ||
| 4583 | BLOCK_INPUT; | ||
| 4584 | fontp->font = font; | ||
| 4585 | fontp->font_idx = dpyinfo->n_fonts; | ||
| 4586 | fontp->name = (char *) xmalloc (strlen (fontname) + 1); | ||
| 4587 | bcopy (fontname, fontp->name, strlen (fontname) + 1); | ||
| 4588 | |||
| 4589 | /* Work out the font's full name. */ | ||
| 4590 | full_name = (char *)xmalloc (100); | ||
| 4591 | if (full_name && w32_to_x_font (&lf, full_name, 100)) | ||
| 4592 | fontp->full_name = full_name; | ||
| 4593 | else | ||
| 4594 | { | ||
| 4595 | /* If all else fails - just use the name we used to load it. */ | ||
| 4596 | xfree (full_name); | ||
| 4597 | fontp->full_name = fontp->name; | ||
| 4598 | } | ||
| 4599 | |||
| 4600 | fontp->size = FONT_WIDTH (font); | ||
| 4601 | fontp->height = FONT_HEIGHT (font); | ||
| 4602 | |||
| 4603 | /* The slot `encoding' specifies how to map a character | ||
| 4604 | code-points (0x20..0x7F or 0x2020..0x7F7F) of each charset to | ||
| 4605 | the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, 0:0x2020..0x7F7F, | ||
| 4606 | the font code-points (0:0x20..0x7F, 1:0xA0..0xFF, | ||
| 4607 | 0:0x2020..0x7F7F, 1:0xA0A0..0xFFFF, 3:0x20A0..0x7FFF, or | ||
| 4608 | 2:0xA020..0xFF7F). For the moment, we don't know which charset | ||
| 4609 | uses this font. So, we set informatoin in fontp->encoding[1] | ||
| 4610 | which is never used by any charset. If mapping can't be | ||
| 4611 | decided, set FONT_ENCODING_NOT_DECIDED. */ | ||
| 4612 | fontp->encoding[1] = FONT_ENCODING_NOT_DECIDED; | ||
| 4613 | |||
| 4614 | /* The following three values are set to 0 under W32, which is | ||
| 4615 | what they get set to if XGetFontProperty fails under X. */ | ||
| 4616 | fontp->baseline_offset = 0; | ||
| 4617 | fontp->relative_compose = 0; | ||
| 4618 | fontp->default_ascent = FONT_BASE (font); | ||
| 4619 | |||
| 4620 | UNBLOCK_INPUT; | ||
| 4621 | dpyinfo->n_fonts++; | ||
| 4622 | |||
| 4623 | return fontp; | ||
| 4624 | } | ||
| 4625 | } | ||
| 4626 | |||
| 4483 | void | 4627 | void |
| 4484 | w32_unload_font (dpyinfo, font) | 4628 | w32_unload_font (dpyinfo, font) |
| 4485 | struct w32_display_info *dpyinfo; | 4629 | struct w32_display_info *dpyinfo; |
| @@ -4612,11 +4756,31 @@ x_to_w32_charset (lpcs) | |||
| 4612 | 4756 | ||
| 4613 | if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; | 4757 | if (stricmp (lpcs,"ansi") == 0) return ANSI_CHARSET; |
| 4614 | else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; | 4758 | else if (stricmp (lpcs,"iso8859-1") == 0) return ANSI_CHARSET; |
| 4615 | else if (stricmp (lpcs,"iso8859") == 0) return ANSI_CHARSET; | 4759 | else if (stricmp (lpcs, "symbol") >= 0) return SYMBOL_CHARSET; |
| 4616 | else if (stricmp (lpcs,"oem") == 0) return OEM_CHARSET; | 4760 | else if (stricmp (lpcs, "jis") >= 0) return SHIFTJIS_CHARSET; |
| 4761 | else if (stricmp (lpcs, "ksc5601") == 0) return HANGEUL_CHARSET; | ||
| 4762 | else if (stricmp (lpcs, "gb2312") == 0) return GB2312_CHARSET; | ||
| 4763 | else if (stricmp (lpcs, "big5") == 0) return CHINESEBIG5_CHARSET; | ||
| 4764 | else if (stricmp (lpcs, "oem") >= 0) return OEM_CHARSET; | ||
| 4765 | |||
| 4766 | #ifdef EASTEUROPE_CHARSET | ||
| 4767 | else if (stricmp (lpcs, "iso8859-2") == 0) return EASTEUROPE_CHARSET; | ||
| 4768 | else if (stricmp (lpcs, "iso8859-3") == 0) return TURKISH_CHARSET; | ||
| 4769 | else if (stricmp (lpcs, "iso8859-4") == 0) return BALTIC_CHARSET; | ||
| 4770 | else if (stricmp (lpcs, "iso8859-5") == 0) return RUSSIAN_CHARSET; | ||
| 4771 | else if (stricmp (lpcs, "koi8") == 0) return RUSSIAN_CHARSET; | ||
| 4772 | else if (stricmp (lpcs, "iso8859-6") == 0) return ARABIC_CHARSET; | ||
| 4773 | else if (stricmp (lpcs, "iso8859-7") == 0) return GREEK_CHARSET; | ||
| 4774 | else if (stricmp (lpcs, "iso8859-8") == 0) return HEBREW_CHARSET; | ||
| 4775 | else if (stricmp (lpcs, "viscii") == 0) return VIETNAMESE_CHARSET; | ||
| 4776 | else if (stricmp (lpcs, "vscii") == 0) return VIETNAMESE_CHARSET; | ||
| 4777 | else if (stricmp (lpcs, "tis620") == 0) return THAI_CHARSET; | ||
| 4778 | else if (stricmp (lpcs, "mac") == 0) return MAC_CHARSET; | ||
| 4779 | #endif | ||
| 4780 | |||
| 4617 | #ifdef UNICODE_CHARSET | 4781 | #ifdef UNICODE_CHARSET |
| 4618 | else if (stricmp (lpcs,"unicode") == 0) return UNICODE_CHARSET; | ||
| 4619 | else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; | 4782 | else if (stricmp (lpcs,"iso10646") == 0) return UNICODE_CHARSET; |
| 4783 | else if (stricmp (lpcs, "unicode") >= 0) return UNICODE_CHARSET; | ||
| 4620 | #endif | 4784 | #endif |
| 4621 | else if (lpcs[0] == '#') return atoi (lpcs + 1); | 4785 | else if (lpcs[0] == '#') return atoi (lpcs + 1); |
| 4622 | else | 4786 | else |
| @@ -4631,15 +4795,38 @@ w32_to_x_charset (fncharset) | |||
| 4631 | 4795 | ||
| 4632 | switch (fncharset) | 4796 | switch (fncharset) |
| 4633 | { | 4797 | { |
| 4634 | case ANSI_CHARSET: return "ansi"; | 4798 | /* ansi is considered iso8859-1, as most modern ansi fonts are. */ |
| 4635 | case OEM_CHARSET: return "oem"; | 4799 | case ANSI_CHARSET: return "iso8859-1"; |
| 4636 | case SYMBOL_CHARSET: return "symbol"; | 4800 | case DEFAULT_CHARSET: return "ascii-*"; |
| 4801 | case SYMBOL_CHARSET: return "*-symbol"; | ||
| 4802 | case SHIFTJIS_CHARSET: return "jisx0212-sjis"; | ||
| 4803 | case HANGEUL_CHARSET: return "ksc5601-*"; | ||
| 4804 | case GB2312_CHARSET: return "gb2312-*"; | ||
| 4805 | case CHINESEBIG5_CHARSET: return "big5-*"; | ||
| 4806 | case OEM_CHARSET: return "*-oem"; | ||
| 4807 | |||
| 4808 | /* More recent versions of Windows (95 and NT4.0) define more | ||
| 4809 | character sets. */ | ||
| 4810 | #ifdef EASTEUROPE_CHARSET | ||
| 4811 | case EASTEUROPE_CHARSET: return "iso8859-2"; | ||
| 4812 | case TURKISH_CHARSET: return "iso8859-3"; | ||
| 4813 | case BALTIC_CHARSET: return "iso8859-4"; | ||
| 4814 | case RUSSIAN_CHARSET: return "iso8859-5"; | ||
| 4815 | case ARABIC_CHARSET: return "iso8859-6"; | ||
| 4816 | case GREEK_CHARSET: return "iso8859-7"; | ||
| 4817 | case HEBREW_CHARSET: return "iso8859-8"; | ||
| 4818 | case VIETNAMESE_CHARSET: return "viscii1.1-*"; | ||
| 4819 | case THAI_CHARSET: return "tis620-*"; | ||
| 4820 | case MAC_CHARSET: return "*-mac"; | ||
| 4821 | case JOHAB_CHARSET: break; /* What is this? Latin-9? */ | ||
| 4822 | #endif | ||
| 4823 | |||
| 4637 | #ifdef UNICODE_CHARSET | 4824 | #ifdef UNICODE_CHARSET |
| 4638 | case UNICODE_CHARSET: return "unicode"; | 4825 | case UNICODE_CHARSET: return "iso10646-unicode"; |
| 4639 | #endif | 4826 | #endif |
| 4640 | } | 4827 | } |
| 4641 | /* Encode numerical value of unknown charset. */ | 4828 | /* Encode numerical value of unknown charset. */ |
| 4642 | sprintf (buf, "#%u", fncharset); | 4829 | sprintf (buf, "*-#%u", fncharset); |
| 4643 | return buf; | 4830 | return buf; |
| 4644 | } | 4831 | } |
| 4645 | 4832 | ||
| @@ -4649,15 +4836,26 @@ w32_to_x_font (lplogfont, lpxstr, len) | |||
| 4649 | char * lpxstr; | 4836 | char * lpxstr; |
| 4650 | int len; | 4837 | int len; |
| 4651 | { | 4838 | { |
| 4839 | char fontname[50]; | ||
| 4652 | char height_pixels[8]; | 4840 | char height_pixels[8]; |
| 4653 | char height_dpi[8]; | 4841 | char height_dpi[8]; |
| 4654 | char width_pixels[8]; | 4842 | char width_pixels[8]; |
| 4843 | char *fontname_dash; | ||
| 4655 | 4844 | ||
| 4656 | if (!lpxstr) abort (); | 4845 | if (!lpxstr) abort (); |
| 4657 | 4846 | ||
| 4658 | if (!lplogfont) | 4847 | if (!lplogfont) |
| 4659 | return FALSE; | 4848 | return FALSE; |
| 4660 | 4849 | ||
| 4850 | strncpy (fontname, lplogfont->lfFaceName, 50); | ||
| 4851 | fontname[49] = '\0'; /* Just in case */ | ||
| 4852 | |||
| 4853 | /* Replace dashes with underscores so the dashes are not | ||
| 4854 | misinterpreted */ | ||
| 4855 | fontname_dash = fontname; | ||
| 4856 | while (fontname_dash = strchr (fontname_dash, '-')) | ||
| 4857 | *fontname_dash = '_'; | ||
| 4858 | |||
| 4661 | if (lplogfont->lfHeight) | 4859 | if (lplogfont->lfHeight) |
| 4662 | { | 4860 | { |
| 4663 | sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); | 4861 | sprintf (height_pixels, "%u", abs (lplogfont->lfHeight)); |
| @@ -4675,15 +4873,22 @@ w32_to_x_font (lplogfont, lpxstr, len) | |||
| 4675 | strcpy (width_pixels, "*"); | 4873 | strcpy (width_pixels, "*"); |
| 4676 | 4874 | ||
| 4677 | _snprintf (lpxstr, len - 1, | 4875 | _snprintf (lpxstr, len - 1, |
| 4678 | "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-*-%s-", | 4876 | "-*-%s-%s-%c-*-*-%s-%s-*-*-%c-%s-%s", |
| 4679 | lplogfont->lfFaceName, | 4877 | /* foundry */ |
| 4680 | w32_to_x_weight (lplogfont->lfWeight), | 4878 | fontname, /* family */ |
| 4681 | lplogfont->lfItalic?'i':'r', | 4879 | w32_to_x_weight (lplogfont->lfWeight), /* weight */ |
| 4682 | height_pixels, | 4880 | lplogfont->lfItalic?'i':'r', /* slant */ |
| 4683 | height_dpi, | 4881 | /* setwidth name */ |
| 4684 | ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) ? 'p' : 'c', | 4882 | /* add style name */ |
| 4685 | width_pixels, | 4883 | height_pixels, /* pixel size */ |
| 4686 | w32_to_x_charset (lplogfont->lfCharSet) | 4884 | height_dpi, /* point size */ |
| 4885 | /* resx */ | ||
| 4886 | /* resy */ | ||
| 4887 | ((lplogfont->lfPitchAndFamily & 0x3) == VARIABLE_PITCH) | ||
| 4888 | ? 'p' : 'c', /* spacing */ | ||
| 4889 | width_pixels, /* avg width */ | ||
| 4890 | w32_to_x_charset (lplogfont->lfCharSet) /* charset registry | ||
| 4891 | and encoding*/ | ||
| 4687 | ); | 4892 | ); |
| 4688 | 4893 | ||
| 4689 | lpxstr[len - 1] = 0; /* just to be sure */ | 4894 | lpxstr[len - 1] = 0; /* just to be sure */ |
| @@ -4773,9 +4978,8 @@ x_to_w32_font (lpxstr, lplogfont) | |||
| 4773 | 4978 | ||
| 4774 | fields--; | 4979 | fields--; |
| 4775 | 4980 | ||
| 4776 | /* Not all font specs include the registry field, so we allow for an | 4981 | /* Strip the trailing '-' if present. (it shouldn't be, as it |
| 4777 | optional registry field before the encoding when parsing | 4982 | fails the test against xlfn-tight-regexp in fontset.el). */ |
| 4778 | remainder. Also we strip the trailing '-' if present. */ | ||
| 4779 | { | 4983 | { |
| 4780 | int len = strlen (remainder); | 4984 | int len = strlen (remainder); |
| 4781 | if (len > 0 && remainder[len-1] == '-') | 4985 | if (len > 0 && remainder[len-1] == '-') |
| @@ -4883,22 +5087,34 @@ enum_font_cb2 (lplf, lptm, FontType, lpef) | |||
| 4883 | if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline) | 5087 | if (lplf->elfLogFont.lfStrikeOut || lplf->elfLogFont.lfUnderline) |
| 4884 | return (1); | 5088 | return (1); |
| 4885 | 5089 | ||
| 5090 | /* Check that the character set matches if it was specified */ | ||
| 5091 | if (lpef->logfont.lfCharSet != DEFAULT_CHARSET && | ||
| 5092 | lplf->elfLogFont.lfCharSet != lpef->logfont.lfCharSet) | ||
| 5093 | return (1); | ||
| 5094 | |||
| 5095 | /* We want all fonts cached, so don't compare sizes just yet */ | ||
| 4886 | /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */ | 5096 | /* if (!lpef->size_ref || lptm->tmMaxCharWidth == FONT_WIDTH (lpef->size_ref)) */ |
| 4887 | { | 5097 | { |
| 4888 | char buf[100]; | 5098 | char buf[100]; |
| 5099 | Lisp_Object width = Qnil; | ||
| 4889 | 5100 | ||
| 4890 | if (!NILP (*(lpef->pattern)) && FontType != RASTER_FONTTYPE) | 5101 | if (!NILP (*(lpef->pattern)) && FontType != RASTER_FONTTYPE) |
| 4891 | { | 5102 | { |
| 5103 | /* Scalable fonts are as big as you want them to be. */ | ||
| 4892 | lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; | 5104 | lplf->elfLogFont.lfHeight = lpef->logfont.lfHeight; |
| 4893 | lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; | 5105 | lplf->elfLogFont.lfWidth = lpef->logfont.lfWidth; |
| 4894 | } | 5106 | } |
| 4895 | 5107 | ||
| 5108 | /* The MaxCharWidth is not valid at this stage for scalable fonts. */ | ||
| 5109 | if (FontType == RASTER_FONTTYPE) | ||
| 5110 | width = make_number (lptm->tmMaxCharWidth); | ||
| 5111 | |||
| 4896 | if (!w32_to_x_font (lplf, buf, 100)) return (0); | 5112 | if (!w32_to_x_font (lplf, buf, 100)) return (0); |
| 4897 | 5113 | ||
| 4898 | if (NILP (*(lpef->pattern)) || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) | 5114 | if (NILP (*(lpef->pattern)) || w32_font_match (buf, XSTRING (*(lpef->pattern))->data)) |
| 4899 | { | 5115 | { |
| 4900 | *lpef->tail = Fcons (build_string (buf), Qnil); | 5116 | *lpef->tail = Fcons (Fcons (build_string (buf), width), Qnil); |
| 4901 | lpef->tail = &XCONS (*lpef->tail)->cdr; | 5117 | lpef->tail = &(XCONS (*lpef->tail)->cdr); |
| 4902 | lpef->numFonts++; | 5118 | lpef->numFonts++; |
| 4903 | } | 5119 | } |
| 4904 | } | 5120 | } |
| @@ -4920,6 +5136,231 @@ enum_font_cb1 (lplf, lptm, FontType, lpef) | |||
| 4920 | } | 5136 | } |
| 4921 | 5137 | ||
| 4922 | 5138 | ||
| 5139 | /* Interface to fontset handler. (adapted from mw32font.c in Meadow | ||
| 5140 | and xterm.c in Emacs 20.3) */ | ||
| 5141 | |||
| 5142 | /* Return a list of names of available fonts matching PATTERN on frame | ||
| 5143 | F. If SIZE is not 0, it is the size (maximum bound width) of fonts | ||
| 5144 | to be listed. Frame F NULL means we have not yet created any | ||
| 5145 | frame, which means we can't get proper size info, as we don't have | ||
| 5146 | a device context to use for GetTextMetrics. | ||
| 5147 | MAXNAMES sets a limit on how many fonts to match. */ | ||
| 5148 | |||
| 5149 | Lisp_Object | ||
| 5150 | w32_list_fonts (FRAME_PTR f, Lisp_Object pattern, int size, int maxnames ) | ||
| 5151 | { | ||
| 5152 | Lisp_Object patterns, key, tem; | ||
| 5153 | Lisp_Object list = Qnil, newlist = Qnil, second_best = Qnil; | ||
| 5154 | |||
| 5155 | patterns = Fassoc (pattern, Valternate_fontname_alist); | ||
| 5156 | if (NILP (patterns)) | ||
| 5157 | patterns = Fcons (pattern, Qnil); | ||
| 5158 | |||
| 5159 | for (; CONSP (patterns); patterns = XCONS (patterns)->cdr) | ||
| 5160 | { | ||
| 5161 | enumfont_t ef; | ||
| 5162 | |||
| 5163 | pattern = XCONS (patterns)->car; | ||
| 5164 | |||
| 5165 | /* See if we cached the result for this particular query. | ||
| 5166 | The cache is an alist of the form: | ||
| 5167 | ((PATTERN (FONTNAME . WIDTH) ...) ...) | ||
| 5168 | */ | ||
| 5169 | if ( f && | ||
| 5170 | (tem = XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr, | ||
| 5171 | !NILP (list = Fassoc (pattern, tem)))) | ||
| 5172 | { | ||
| 5173 | list = Fcdr_safe (list); | ||
| 5174 | /* We have a cached list. Don't have to get the list again. */ | ||
| 5175 | goto label_cached; | ||
| 5176 | } | ||
| 5177 | |||
| 5178 | BLOCK_INPUT; | ||
| 5179 | /* At first, put PATTERN in the cache. */ | ||
| 5180 | list = Qnil; | ||
| 5181 | ef.pattern = &pattern; | ||
| 5182 | ef.tail = ef.head = &list; | ||
| 5183 | ef.numFonts = 0; | ||
| 5184 | x_to_w32_font (STRINGP (pattern) ? XSTRING (pattern)->data : | ||
| 5185 | NULL, &ef.logfont); | ||
| 5186 | { | ||
| 5187 | ef.hdc = GetDC (FRAME_W32_WINDOW (f)); | ||
| 5188 | |||
| 5189 | EnumFontFamilies (ef.hdc, NULL, (FONTENUMPROC) enum_font_cb1, | ||
| 5190 | (LPARAM)&ef); | ||
| 5191 | |||
| 5192 | ReleaseDC (FRAME_W32_WINDOW (f), ef.hdc); | ||
| 5193 | } | ||
| 5194 | |||
| 5195 | UNBLOCK_INPUT; | ||
| 5196 | |||
| 5197 | /* Make a list of the fonts we got back. | ||
| 5198 | Store that in the font cache for the display. */ | ||
| 5199 | if (f != NULL) | ||
| 5200 | XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr | ||
| 5201 | = Fcons (Fcons (pattern, list), | ||
| 5202 | XCONS (FRAME_W32_DISPLAY_INFO (f)->name_list_element)->cdr); | ||
| 5203 | |||
| 5204 | label_cached: | ||
| 5205 | if (NILP (list)) continue; /* Try the remaining alternatives. */ | ||
| 5206 | |||
| 5207 | newlist = second_best = Qnil; | ||
| 5208 | |||
| 5209 | /* Make a list of the fonts that have the right width. */ | ||
| 5210 | for (; CONSP (list); list = XCONS (list)->cdr) | ||
| 5211 | { | ||
| 5212 | int found_size; | ||
| 5213 | tem = XCONS (list)->car; | ||
| 5214 | |||
| 5215 | if (!CONSP (tem)) | ||
| 5216 | continue; | ||
| 5217 | if (NILP (XCONS (tem)->car)) | ||
| 5218 | continue; | ||
| 5219 | if (!size) | ||
| 5220 | { | ||
| 5221 | newlist = Fcons (XCONS (tem)->car, newlist); | ||
| 5222 | continue; | ||
| 5223 | } | ||
| 5224 | if (!INTEGERP (XCONS (tem)->cdr)) | ||
| 5225 | { | ||
| 5226 | /* Since we don't yet know the size of the font, we must | ||
| 5227 | load it and try GetTextMetrics. */ | ||
| 5228 | struct w32_display_info *dpyinfo | ||
| 5229 | = FRAME_W32_DISPLAY_INFO (f); | ||
| 5230 | W32FontStruct thisinfo; | ||
| 5231 | LOGFONT lf; | ||
| 5232 | HDC hdc; | ||
| 5233 | HANDLE oldobj; | ||
| 5234 | |||
| 5235 | if (!x_to_w32_font (XSTRING (XCONS (tem)->car)->data, &lf)) | ||
| 5236 | continue; | ||
| 5237 | |||
| 5238 | BLOCK_INPUT; | ||
| 5239 | thisinfo.hfont = CreateFontIndirect (&lf); | ||
| 5240 | if (thisinfo.hfont == NULL) | ||
| 5241 | continue; | ||
| 5242 | |||
| 5243 | hdc = GetDC (dpyinfo->root_window); | ||
| 5244 | oldobj = SelectObject (hdc, thisinfo.hfont); | ||
| 5245 | if (GetTextMetrics (hdc, &thisinfo.tm)) | ||
| 5246 | XCONS (tem)->cdr = make_number (FONT_WIDTH (&thisinfo)); | ||
| 5247 | else | ||
| 5248 | XCONS (tem)->cdr = make_number (0); | ||
| 5249 | SelectObject (hdc, oldobj); | ||
| 5250 | ReleaseDC (dpyinfo->root_window, hdc); | ||
| 5251 | DeleteObject(thisinfo.hfont); | ||
| 5252 | UNBLOCK_INPUT; | ||
| 5253 | } | ||
| 5254 | found_size = XINT (XCONS (tem)->cdr); | ||
| 5255 | if (found_size == size) | ||
| 5256 | newlist = Fcons (XCONS (tem)->car, newlist); | ||
| 5257 | |||
| 5258 | /* keep track of the closest matching size in case | ||
| 5259 | no exact match is found. */ | ||
| 5260 | else if (found_size > 0) | ||
| 5261 | { | ||
| 5262 | if (NILP (second_best)) | ||
| 5263 | second_best = tem; | ||
| 5264 | else if (found_size < size) | ||
| 5265 | { | ||
| 5266 | if (XINT (XCONS (second_best)->cdr) > size | ||
| 5267 | || XINT (XCONS (second_best)->cdr) < found_size) | ||
| 5268 | second_best = tem; | ||
| 5269 | } | ||
| 5270 | else | ||
| 5271 | { | ||
| 5272 | if (XINT (XCONS (second_best)->cdr) > size | ||
| 5273 | && XINT (XCONS (second_best)->cdr) > | ||
| 5274 | found_size) | ||
| 5275 | second_best = tem; | ||
| 5276 | } | ||
| 5277 | } | ||
| 5278 | } | ||
| 5279 | |||
| 5280 | if (!NILP (newlist)) | ||
| 5281 | break; | ||
| 5282 | else if (!NILP (second_best)) | ||
| 5283 | { | ||
| 5284 | newlist = Fcons (XCONS (second_best)->car, Qnil); | ||
| 5285 | break; | ||
| 5286 | } | ||
| 5287 | } | ||
| 5288 | |||
| 5289 | return newlist; | ||
| 5290 | } | ||
| 5291 | |||
| 5292 | /* Return a pointer to struct font_info of font FONT_IDX of frame F. */ | ||
| 5293 | struct font_info * | ||
| 5294 | w32_get_font_info (f, font_idx) | ||
| 5295 | FRAME_PTR f; | ||
| 5296 | int font_idx; | ||
| 5297 | { | ||
| 5298 | return (FRAME_W32_FONT_TABLE (f) + font_idx); | ||
| 5299 | } | ||
| 5300 | |||
| 5301 | |||
| 5302 | struct font_info* | ||
| 5303 | w32_query_font (struct frame *f, char *fontname) | ||
| 5304 | { | ||
| 5305 | int i; | ||
| 5306 | struct font_info *pfi; | ||
| 5307 | |||
| 5308 | pfi = FRAME_W32_FONT_TABLE (f); | ||
| 5309 | |||
| 5310 | for (i = 0; i < one_w32_display_info.n_fonts ;i++, pfi++) | ||
| 5311 | { | ||
| 5312 | if (strcmp(pfi->name, fontname) == 0) return pfi; | ||
| 5313 | } | ||
| 5314 | |||
| 5315 | return NULL; | ||
| 5316 | } | ||
| 5317 | |||
| 5318 | /* Find a CCL program for a font specified by FONTP, and set the member | ||
| 5319 | `encoder' of the structure. */ | ||
| 5320 | |||
| 5321 | void | ||
| 5322 | w32_find_ccl_program (fontp) | ||
| 5323 | struct font_info *fontp; | ||
| 5324 | { | ||
| 5325 | extern Lisp_Object Vfont_ccl_encoder_alist, Vccl_program_table; | ||
| 5326 | extern Lisp_Object Qccl_program_idx; | ||
| 5327 | extern Lisp_Object resolve_symbol_ccl_program (); | ||
| 5328 | Lisp_Object list, elt, ccl_prog, ccl_id; | ||
| 5329 | |||
| 5330 | for (list = Vfont_ccl_encoder_alist; CONSP (list); list = XCONS (list)->cdr) | ||
| 5331 | { | ||
| 5332 | elt = XCONS (list)->car; | ||
| 5333 | if (CONSP (elt) | ||
| 5334 | && STRINGP (XCONS (elt)->car) | ||
| 5335 | && (fast_c_string_match_ignore_case (XCONS (elt)->car, fontp->name) | ||
| 5336 | >= 0)) | ||
| 5337 | { | ||
| 5338 | if (SYMBOLP (XCONS (elt)->cdr) && | ||
| 5339 | (!NILP (ccl_id = Fget (XCONS (elt)->cdr, Qccl_program_idx)))) | ||
| 5340 | { | ||
| 5341 | ccl_prog = XVECTOR (Vccl_program_table)->contents[XUINT (ccl_id)]; | ||
| 5342 | if (!CONSP (ccl_prog)) continue; | ||
| 5343 | ccl_prog = XCONS (ccl_prog)->cdr; | ||
| 5344 | } | ||
| 5345 | else | ||
| 5346 | { | ||
| 5347 | ccl_prog = XCONS (elt)->cdr; | ||
| 5348 | if (!VECTORP (ccl_prog)) continue; | ||
| 5349 | } | ||
| 5350 | |||
| 5351 | fontp->font_encoder | ||
| 5352 | = (struct ccl_program *) xmalloc (sizeof (struct ccl_program)); | ||
| 5353 | setup_ccl_program (fontp->font_encoder, | ||
| 5354 | resolve_symbol_ccl_program (ccl_prog)); | ||
| 5355 | break; | ||
| 5356 | } | ||
| 5357 | } | ||
| 5358 | } | ||
| 5359 | |||
| 5360 | |||
| 5361 | #if 1 | ||
| 5362 | #include "x-list-font.c" | ||
| 5363 | #else | ||
| 4923 | DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 4, 0, | 5364 | DEFUN ("x-list-fonts", Fx_list_fonts, Sx_list_fonts, 1, 4, 0, |
| 4924 | "Return a list of the names of available fonts matching PATTERN.\n\ | 5365 | "Return a list of the names of available fonts matching PATTERN.\n\ |
| 4925 | If optional arguments FACE and FRAME are specified, return only fonts\n\ | 5366 | If optional arguments FACE and FRAME are specified, return only fonts\n\ |
| @@ -5003,10 +5444,12 @@ fonts to match. The first MAXIMUM fonts are reported.") | |||
| 5003 | newlist = Qnil; | 5444 | newlist = Qnil; |
| 5004 | for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr) | 5445 | for (tem = list; CONSP (tem); tem = XCONS (tem)->cdr) |
| 5005 | { | 5446 | { |
| 5006 | XFontStruct *thisinfo; | 5447 | struct font_info *fontinf; |
| 5007 | 5448 | XFontStruct *thisinfo = NULL; | |
| 5008 | thisinfo = w32_load_font (FRAME_W32_DISPLAY_INFO (f), XSTRING (XCONS (tem)->car)->data); | ||
| 5009 | 5449 | ||
| 5450 | fontinf = w32_load_font (f, XSTRING (XCONS (tem)->car)->data, 0); | ||
| 5451 | if (fontinf) | ||
| 5452 | thisinfo = (XFontStruct *)fontinf->font; | ||
| 5010 | if (thisinfo && same_size_fonts (thisinfo, size_ref)) | 5453 | if (thisinfo && same_size_fonts (thisinfo, size_ref)) |
| 5011 | newlist = Fcons (XCONS (tem)->car, newlist); | 5454 | newlist = Fcons (XCONS (tem)->car, newlist); |
| 5012 | 5455 | ||
| @@ -5058,10 +5501,13 @@ fonts to match. The first MAXIMUM fonts are reported.") | |||
| 5058 | keeper = 1; | 5501 | keeper = 1; |
| 5059 | else | 5502 | else |
| 5060 | { | 5503 | { |
| 5061 | XFontStruct *thisinfo; | 5504 | struct font_info *fontinf; |
| 5505 | XFontStruct *thisinfo = NULL; | ||
| 5062 | 5506 | ||
| 5063 | BLOCK_INPUT; | 5507 | BLOCK_INPUT; |
| 5064 | thisinfo = w32_load_font (FRAME_W32_DISPLAY_INFO (f), XSTRING (Fcar (cur))->data); | 5508 | fontinf = w32_load_font (f, XSTRING (Fcar (cur))->data, 0); |
| 5509 | if (fontinf) | ||
| 5510 | thisinfo = (XFontStruct *)fontinf->font; | ||
| 5065 | 5511 | ||
| 5066 | keeper = thisinfo && same_size_fonts (thisinfo, size_ref); | 5512 | keeper = thisinfo && same_size_fonts (thisinfo, size_ref); |
| 5067 | 5513 | ||
| @@ -5079,6 +5525,7 @@ fonts to match. The first MAXIMUM fonts are reported.") | |||
| 5079 | 5525 | ||
| 5080 | return list; | 5526 | return list; |
| 5081 | } | 5527 | } |
| 5528 | #endif | ||
| 5082 | 5529 | ||
| 5083 | DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, | 5530 | DEFUN ("x-color-defined-p", Fx_color_defined_p, Sx_color_defined_p, 1, 2, 0, |
| 5084 | "Return non-nil if color COLOR is supported on frame FRAME.\n\ | 5531 | "Return non-nil if color COLOR is supported on frame FRAME.\n\ |
| @@ -5823,6 +6270,25 @@ unless you set it to something else."); | |||
| 5823 | and maybe the user would like to set it to t. */ | 6270 | and maybe the user would like to set it to t. */ |
| 5824 | Vx_no_window_manager = Qnil; | 6271 | Vx_no_window_manager = Qnil; |
| 5825 | 6272 | ||
| 6273 | DEFVAR_LISP ("x-pixel-size-width-font-regexp", | ||
| 6274 | &Vx_pixel_size_width_font_regexp, | ||
| 6275 | "Regexp matching a font name whose width is the same as `PIXEL_SIZE'.\n\ | ||
| 6276 | \n\ | ||
| 6277 | Since Emacs gets width of a font matching with this regexp from\n\ | ||
| 6278 | PIXEL_SIZE field of the name, font finding mechanism gets faster for\n\ | ||
| 6279 | such a font. This is especially effective for such large fonts as\n\ | ||
| 6280 | Chinese, Japanese, and Korean."); | ||
| 6281 | Vx_pixel_size_width_font_regexp = Qnil; | ||
| 6282 | |||
| 6283 | DEFVAR_BOOL ("unibyte-display-via-language-environment", | ||
| 6284 | &unibyte_display_via_language_environment, | ||
| 6285 | "*Non-nil means display unibyte text according to language environment.\n\ | ||
| 6286 | Specifically this means that unibyte non-ASCII characters\n\ | ||
| 6287 | are displayed by converting them to the equivalent multibyte characters\n\ | ||
| 6288 | according to the current language environment. As a result, they are\n\ | ||
| 6289 | displayed according to the current fontset."); | ||
| 6290 | unibyte_display_via_language_environment = 0; | ||
| 6291 | |||
| 5826 | defsubr (&Sx_get_resource); | 6292 | defsubr (&Sx_get_resource); |
| 5827 | defsubr (&Sx_list_fonts); | 6293 | defsubr (&Sx_list_fonts); |
| 5828 | defsubr (&Sx_display_color_p); | 6294 | defsubr (&Sx_display_color_p); |
| @@ -5857,6 +6323,15 @@ unless you set it to something else."); | |||
| 5857 | defsubr (&Sw32_default_color_map); | 6323 | defsubr (&Sw32_default_color_map); |
| 5858 | defsubr (&Sw32_load_color_file); | 6324 | defsubr (&Sw32_load_color_file); |
| 5859 | defsubr (&Sw32_send_sys_command); | 6325 | defsubr (&Sw32_send_sys_command); |
| 6326 | |||
| 6327 | /* Setting callback functions for fontset handler. */ | ||
| 6328 | get_font_info_func = w32_get_font_info; | ||
| 6329 | list_fonts_func = w32_list_fonts; | ||
| 6330 | load_font_func = w32_load_font; | ||
| 6331 | find_ccl_program_func = w32_find_ccl_program; | ||
| 6332 | query_font_func = w32_query_font; | ||
| 6333 | set_frame_fontset_func = x_set_font; | ||
| 6334 | check_window_system_func = check_w32; | ||
| 5860 | } | 6335 | } |
| 5861 | 6336 | ||
| 5862 | #undef abort | 6337 | #undef abort |