aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mackenzie2011-10-28 14:02:04 +0000
committerAlan Mackenzie2011-10-28 14:02:04 +0000
commitbc97a826f8ea89a269f6043be3148930f023e2b2 (patch)
treee927788ae7ba1058100dfb6c211ff57e6440de4c /src
parentc0f13227ab16ad9a87a16182e9d9ace5d2f7a6d9 (diff)
parent9aba60432c25b060680eb7db698b20b05d7b94a0 (diff)
downloademacs-bc97a826f8ea89a269f6043be3148930f023e2b2.tar.gz
emacs-bc97a826f8ea89a269f6043be3148930f023e2b2.zip
Merge
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog33
-rw-r--r--src/emacs.c1
-rw-r--r--src/keyboard.c124
-rw-r--r--src/lisp.h20
-rw-r--r--src/w32.h1
-rw-r--r--src/w32font.c149
6 files changed, 247 insertions, 81 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0d421223228..50fc953024a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,32 @@
12011-10-28 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * lisp.h (struct Lisp_Symbol): Update comments.
4
52011-10-28 Juanma Barranquero <lekktu@gmail.com>
6
7 * w32font.c (w32_load_unicows_or_gdi32): Add missing return.
8
92011-10-28 Eli Zaretskii <eliz@gnu.org>
10
11 Fix Emacs on Windows 9X (bug#8562). Thanks to oslsachem
12 <oslsachem@gmail.com> for helping to debug this.
13
14 * w32font.c (g_b_init_is_w9x, g_b_init_get_outline_metrics_w)
15 (g_b_init_get_text_metrics_w, g_b_init_get_glyph_outline_w)
16 (g_b_init_get_glyph_outline_w): New static variables.
17 (GetOutlineTextMetricsW_Proc, GetTextMetricsW_Proc)
18 (GetGlyphOutlineW_Proc): New typedefs.
19 (w32_load_unicows_or_gdi32, get_outline_metrics_w)
20 (get_text_metrics_w, get_glyph_outline_w, globals_of_w32font):
21 New functions.
22 (w32font_open_internal, compute_metrics):
23 Call get_outline_metrics_w, get_text_metrics_w, and get_glyph_outline_w
24 instead of calling the "wide" APIs directly.
25
26 * emacs.c (main) [HAVE_NTGUI]: Call globals_of_w32font.
27
28 * w32.h (syms_of_w32font): Add prototype.
29
12011-10-27 Juanma Barranquero <lekktu@gmail.com> 302011-10-27 Juanma Barranquero <lekktu@gmail.com>
2 31
3 * window.c (Fframe_root_window, Fframe_first_window, Fwindow_end) 32 * window.c (Fframe_root_window, Fframe_first_window, Fwindow_end)
@@ -18,8 +47,8 @@
18 47
192011-10-27 Chong Yidong <cyd@gnu.org> 482011-10-27 Chong Yidong <cyd@gnu.org>
20 49
21 * gnutls.c (emacs_gnutls_deinit): New function. Deallocate 50 * gnutls.c (emacs_gnutls_deinit): New function.
22 credentials structures as well as calling gnutls_deinit. 51 Deallocate credentials structures as well as calling gnutls_deinit.
23 (Fgnutls_deinit, Fgnutls_boot): Use it. 52 (Fgnutls_deinit, Fgnutls_boot): Use it.
24 53
25 * process.c (make_process): Initialize GnuTLS credentials to NULL. 54 * process.c (make_process): Initialize GnuTLS credentials to NULL.
diff --git a/src/emacs.c b/src/emacs.c
index 073156bb0c9..12be7bc0808 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1591,6 +1591,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
1591 /* Initialization that must be done even if the global variable 1591 /* Initialization that must be done even if the global variable
1592 initialized is non zero. */ 1592 initialized is non zero. */
1593#ifdef HAVE_NTGUI 1593#ifdef HAVE_NTGUI
1594 globals_of_w32font ();
1594 globals_of_w32fns (); 1595 globals_of_w32fns ();
1595 globals_of_w32menu (); 1596 globals_of_w32menu ();
1596 globals_of_w32select (); 1597 globals_of_w32select ();
diff --git a/src/keyboard.c b/src/keyboard.c
index eb316947dcb..95604550c80 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -73,7 +73,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
73#include "nsterm.h" 73#include "nsterm.h"
74#endif 74#endif
75 75
76/* Variables for blockinput.h: */ 76/* Variables for blockinput.h: */
77 77
78/* Non-zero if interrupt input is blocked right now. */ 78/* Non-zero if interrupt input is blocked right now. */
79volatile int interrupt_input_blocked; 79volatile int interrupt_input_blocked;
@@ -338,7 +338,7 @@ static Lisp_Object Qconfig_changed_event;
338Lisp_Object Qevent_kind; 338Lisp_Object Qevent_kind;
339static Lisp_Object Qevent_symbol_elements; 339static Lisp_Object Qevent_symbol_elements;
340 340
341/* menu and tool bar item parts */ 341/* Menu and tool bar item parts. */
342static Lisp_Object Qmenu_enable; 342static Lisp_Object Qmenu_enable;
343static Lisp_Object QCenable, QCvisible, QChelp, QCkeys, QCkey_sequence; 343static Lisp_Object QCenable, QCvisible, QChelp, QCkeys, QCkey_sequence;
344Lisp_Object QCfilter; 344Lisp_Object QCfilter;
@@ -835,7 +835,7 @@ recursive_edit_unwind (Lisp_Object buffer)
835 835
836 836
837#if 0 /* These two functions are now replaced with 837#if 0 /* These two functions are now replaced with
838 temporarily_switch_to_single_kboard. */ 838 temporarily_switch_to_single_kboard. */
839static void 839static void
840any_kboard_state () 840any_kboard_state ()
841{ 841{
@@ -1038,7 +1038,7 @@ cmd_error (Lisp_Object data)
1038 Vquit_flag = Qnil; 1038 Vquit_flag = Qnil;
1039 1039
1040 Vinhibit_quit = Qnil; 1040 Vinhibit_quit = Qnil;
1041#if 0 /* This shouldn't be necessary anymore. --lorentey */ 1041#if 0 /* This shouldn't be necessary anymore. --lorentey */
1042 if (command_loop_level == 0 && minibuf_level == 0) 1042 if (command_loop_level == 0 && minibuf_level == 0)
1043 any_kboard_state (); 1043 any_kboard_state ();
1044#endif 1044#endif
@@ -1131,7 +1131,7 @@ command_loop (void)
1131#if 0 /* This shouldn't be necessary anymore. --lorentey */ 1131#if 0 /* This shouldn't be necessary anymore. --lorentey */
1132 /* Reset single_kboard in case top-level set it while 1132 /* Reset single_kboard in case top-level set it while
1133 evaluating an -f option, or we are stuck there for some 1133 evaluating an -f option, or we are stuck there for some
1134 other reason. */ 1134 other reason. */
1135 any_kboard_state (); 1135 any_kboard_state ();
1136#endif 1136#endif
1137 internal_catch (Qtop_level, command_loop_2, Qnil); 1137 internal_catch (Qtop_level, command_loop_2, Qnil);
@@ -1492,8 +1492,8 @@ command_loop_1 (void)
1492 if (!NILP (Vquit_flag)) 1492 if (!NILP (Vquit_flag))
1493 { 1493 {
1494 Vexecuting_kbd_macro = Qt; 1494 Vexecuting_kbd_macro = Qt;
1495 QUIT; /* Make some noise. */ 1495 QUIT; /* Make some noise. */
1496 /* Will return since macro now empty. */ 1496 /* Will return since macro now empty. */
1497 } 1497 }
1498 } 1498 }
1499 1499
@@ -1512,7 +1512,7 @@ command_loop_1 (void)
1512 Vdisable_point_adjustment = Qnil; 1512 Vdisable_point_adjustment = Qnil;
1513 1513
1514 /* Process filters and timers may have messed with deactivate-mark. 1514 /* Process filters and timers may have messed with deactivate-mark.
1515 reset it before we execute the command. */ 1515 reset it before we execute the command. */
1516 Vdeactivate_mark = Qnil; 1516 Vdeactivate_mark = Qnil;
1517 1517
1518 /* Remap command through active keymaps. */ 1518 /* Remap command through active keymaps. */
@@ -1552,7 +1552,7 @@ command_loop_1 (void)
1552 } 1552 }
1553 else 1553 else
1554 { 1554 {
1555 /* Here for a command that isn't executed directly */ 1555 /* Here for a command that isn't executed directly. */
1556 1556
1557#ifdef HAVE_WINDOW_SYSTEM 1557#ifdef HAVE_WINDOW_SYSTEM
1558 int scount = SPECPDL_INDEX (); 1558 int scount = SPECPDL_INDEX ();
@@ -1960,7 +1960,7 @@ void
1960poll_for_input_1 (void) 1960poll_for_input_1 (void)
1961{ 1961{
1962/* Tell ns_read_socket() it is being called asynchronously so it can avoid 1962/* Tell ns_read_socket() it is being called asynchronously so it can avoid
1963 doing anything dangerous. */ 1963 doing anything dangerous. */
1964#ifdef HAVE_NS 1964#ifdef HAVE_NS
1965 ++handling_signal; 1965 ++handling_signal;
1966#endif 1966#endif
@@ -2000,7 +2000,7 @@ start_polling (void)
2000#ifdef POLL_FOR_INPUT 2000#ifdef POLL_FOR_INPUT
2001 /* XXX This condition was (read_socket_hook && !interrupt_input), 2001 /* XXX This condition was (read_socket_hook && !interrupt_input),
2002 but read_socket_hook is not global anymore. Let's pretend that 2002 but read_socket_hook is not global anymore. Let's pretend that
2003 it's always set. */ 2003 it's always set. */
2004 if (!interrupt_input) 2004 if (!interrupt_input)
2005 { 2005 {
2006 /* Turn alarm handling on unconditionally. It might have 2006 /* Turn alarm handling on unconditionally. It might have
@@ -2037,7 +2037,7 @@ input_polling_used (void)
2037#ifdef POLL_FOR_INPUT 2037#ifdef POLL_FOR_INPUT
2038 /* XXX This condition was (read_socket_hook && !interrupt_input), 2038 /* XXX This condition was (read_socket_hook && !interrupt_input),
2039 but read_socket_hook is not global anymore. Let's pretend that 2039 but read_socket_hook is not global anymore. Let's pretend that
2040 it's always set. */ 2040 it's always set. */
2041 return !interrupt_input; 2041 return !interrupt_input;
2042#else 2042#else
2043 return 0; 2043 return 0;
@@ -2052,7 +2052,7 @@ stop_polling (void)
2052#ifdef POLL_FOR_INPUT 2052#ifdef POLL_FOR_INPUT
2053 /* XXX This condition was (read_socket_hook && !interrupt_input), 2053 /* XXX This condition was (read_socket_hook && !interrupt_input),
2054 but read_socket_hook is not global anymore. Let's pretend that 2054 but read_socket_hook is not global anymore. Let's pretend that
2055 it's always set. */ 2055 it's always set. */
2056 if (!interrupt_input) 2056 if (!interrupt_input)
2057 ++poll_suppress_count; 2057 ++poll_suppress_count;
2058#endif 2058#endif
@@ -2390,7 +2390,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2390 real event came from. Normally, a switch-frame event selects 2390 real event came from. Normally, a switch-frame event selects
2391 internal_last_event_frame after each command is read, but 2391 internal_last_event_frame after each command is read, but
2392 events read from a macro should never cause a new frame to be 2392 events read from a macro should never cause a new frame to be
2393 selected. */ 2393 selected. */
2394 Vlast_event_frame = internal_last_event_frame = Qmacro; 2394 Vlast_event_frame = internal_last_event_frame = Qmacro;
2395 2395
2396 /* Exit the macro if we are at the end. 2396 /* Exit the macro if we are at the end.
@@ -2500,7 +2500,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2500 Try this before the sit-for, because the sit-for 2500 Try this before the sit-for, because the sit-for
2501 would do the wrong thing if we are supposed to do 2501 would do the wrong thing if we are supposed to do
2502 menu prompting. If EVENT_HAS_PARAMETERS then we are reading 2502 menu prompting. If EVENT_HAS_PARAMETERS then we are reading
2503 after a mouse event so don't try a minibuf menu. */ 2503 after a mouse event so don't try a minibuf menu. */
2504 c = Qnil; 2504 c = Qnil;
2505 if (nmaps > 0 && INTERACTIVE 2505 if (nmaps > 0 && INTERACTIVE
2506 && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event) 2506 && !NILP (prev_event) && ! EVENT_HAS_PARAMETERS (prev_event)
@@ -4980,8 +4980,8 @@ static const char *const lispy_function_keys[] =
4980 "break", /* 0xff6b */ 4980 "break", /* 0xff6b */
4981 4981
4982 0, 0, 0, 0, 4982 0, 0, 0, 0,
4983 0, 0, 0, 0, "backtab", 0, 0, 0, /* 0xff70... */ 4983 0, 0, 0, 0, "backtab", 0, 0, 0, /* 0xff70... */
4984 0, 0, 0, 0, 0, 0, 0, "kp-numlock", /* 0xff78... */ 4984 0, 0, 0, 0, 0, 0, 0, "kp-numlock", /* 0xff78... */
4985 "kp-space", /* 0xff80 */ /* IsKeypadKey */ 4985 "kp-space", /* 0xff80 */ /* IsKeypadKey */
4986 0, 0, 0, 0, 0, 0, 0, 0, 4986 0, 0, 0, 0, 0, 0, 0, 0,
4987 "kp-tab", /* 0xff89 */ 4987 "kp-tab", /* 0xff89 */
@@ -5093,14 +5093,14 @@ static Lisp_Object *const scroll_bar_parts[] = {
5093static Lisp_Object button_down_location; 5093static Lisp_Object button_down_location;
5094 5094
5095/* Information about the most recent up-going button event: Which 5095/* Information about the most recent up-going button event: Which
5096 button, what location, and what time. */ 5096 button, what location, and what time. */
5097 5097
5098static int last_mouse_button; 5098static int last_mouse_button;
5099static int last_mouse_x; 5099static int last_mouse_x;
5100static int last_mouse_y; 5100static int last_mouse_y;
5101static Time button_down_time; 5101static Time button_down_time;
5102 5102
5103/* The number of clicks in this multiple-click. */ 5103/* The number of clicks in this multiple-click. */
5104 5104
5105static int double_click_count; 5105static int double_click_count;
5106 5106
@@ -5344,7 +5344,7 @@ make_lispy_event (struct input_event *event)
5344 5344
5345#ifdef HAVE_NS 5345#ifdef HAVE_NS
5346 /* NS_NONKEY_EVENTs are just like NON_ASCII_KEYSTROKE_EVENTs, 5346 /* NS_NONKEY_EVENTs are just like NON_ASCII_KEYSTROKE_EVENTs,
5347 except that they are non-key events (last-nonmenu-event is nil). */ 5347 except that they are non-key events (last-nonmenu-event is nil). */
5348 case NS_NONKEY_EVENT: 5348 case NS_NONKEY_EVENT:
5349#endif 5349#endif
5350 5350
@@ -5830,7 +5830,7 @@ make_lispy_event (struct input_event *event)
5830 Fcons (make_number (event->timestamp), 5830 Fcons (make_number (event->timestamp),
5831 Fcons (part, Qnil))))); 5831 Fcons (part, Qnil)))));
5832 5832
5833 /* Always treat scroll bar events as clicks. */ 5833 /* Always treat scroll bar events as clicks. */
5834 event->modifiers |= click_modifier; 5834 event->modifiers |= click_modifier;
5835 event->modifiers &= ~up_modifier; 5835 event->modifiers &= ~up_modifier;
5836 5836
@@ -6694,7 +6694,7 @@ lucid_event_type_list_p (Lisp_Object object)
6694 If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal 6694 If READABLE_EVENTS_FILTER_EVENTS is set in FLAGS, ignore internal
6695 events (FOCUS_IN_EVENT). 6695 events (FOCUS_IN_EVENT).
6696 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse 6696 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
6697 movements and toolkit scroll bar thumb drags. */ 6697 movements and toolkit scroll bar thumb drags. */
6698 6698
6699static void 6699static void
6700get_input_pending (int *addr, int flags) 6700get_input_pending (int *addr, int flags)
@@ -6728,7 +6728,7 @@ gobble_input (int expected)
6728#ifdef POLL_FOR_INPUT 6728#ifdef POLL_FOR_INPUT
6729 /* XXX This condition was (read_socket_hook && !interrupt_input), 6729 /* XXX This condition was (read_socket_hook && !interrupt_input),
6730 but read_socket_hook is not global anymore. Let's pretend that 6730 but read_socket_hook is not global anymore. Let's pretend that
6731 it's always set. */ 6731 it's always set. */
6732 if (!interrupt_input && poll_suppress_count == 0) 6732 if (!interrupt_input && poll_suppress_count == 0)
6733 { 6733 {
6734 SIGMASKTYPE mask; 6734 SIGMASKTYPE mask;
@@ -6803,7 +6803,7 @@ read_avail_input (int expected)
6803 if (store_user_signal_events ()) 6803 if (store_user_signal_events ())
6804 expected = 0; 6804 expected = 0;
6805 6805
6806 /* Loop through the available terminals, and call their input hooks. */ 6806 /* Loop through the available terminals, and call their input hooks. */
6807 t = terminal_list; 6807 t = terminal_list;
6808 while (t) 6808 while (t)
6809 { 6809 {
@@ -6824,15 +6824,15 @@ read_avail_input (int expected)
6824 expected = 0; 6824 expected = 0;
6825 } 6825 }
6826 6826
6827 if (nr == -1) /* Not OK to read input now. */ 6827 if (nr == -1) /* Not OK to read input now. */
6828 { 6828 {
6829 err = 1; 6829 err = 1;
6830 } 6830 }
6831 else if (nr == -2) /* Non-transient error. */ 6831 else if (nr == -2) /* Non-transient error. */
6832 { 6832 {
6833 /* The terminal device terminated; it should be closed. */ 6833 /* The terminal device terminated; it should be closed. */
6834 6834
6835 /* Kill Emacs if this was our last terminal. */ 6835 /* Kill Emacs if this was our last terminal. */
6836 if (!terminal_list->next_terminal) 6836 if (!terminal_list->next_terminal)
6837 /* Formerly simply reported no input, but that 6837 /* Formerly simply reported no input, but that
6838 sometimes led to a failure of Emacs to terminate. 6838 sometimes led to a failure of Emacs to terminate.
@@ -6844,7 +6844,7 @@ read_avail_input (int expected)
6844 alone in its group. */ 6844 alone in its group. */
6845 kill (getpid (), SIGHUP); 6845 kill (getpid (), SIGHUP);
6846 6846
6847 /* XXX Is calling delete_terminal safe here? It calls delete_frame. */ 6847 /* XXX Is calling delete_terminal safe here? It calls delete_frame. */
6848 { 6848 {
6849 Lisp_Object tmp; 6849 Lisp_Object tmp;
6850 XSETTERMINAL (tmp, t); 6850 XSETTERMINAL (tmp, t);
@@ -6934,7 +6934,7 @@ tty_read_avail_input (struct terminal *terminal,
6934 return 0; 6934 return 0;
6935#endif /* subprocesses */ 6935#endif /* subprocesses */
6936 6936
6937 if (!terminal->name) /* Don't read from a dead terminal. */ 6937 if (!terminal->name) /* Don't read from a dead terminal. */
6938 return 0; 6938 return 0;
6939 6939
6940 if (terminal->type != output_termcap 6940 if (terminal->type != output_termcap
@@ -6942,15 +6942,15 @@ tty_read_avail_input (struct terminal *terminal,
6942 abort (); 6942 abort ();
6943 6943
6944 /* XXX I think the following code should be moved to separate hook 6944 /* XXX I think the following code should be moved to separate hook
6945 functions in system-dependent files. */ 6945 functions in system-dependent files. */
6946#ifdef WINDOWSNT 6946#ifdef WINDOWSNT
6947 return 0; 6947 return 0;
6948#else /* not WINDOWSNT */ 6948#else /* not WINDOWSNT */
6949 if (! tty->term_initted) /* In case we get called during bootstrap. */ 6949 if (! tty->term_initted) /* In case we get called during bootstrap. */
6950 return 0; 6950 return 0;
6951 6951
6952 if (! tty->input) 6952 if (! tty->input)
6953 return 0; /* The terminal is suspended. */ 6953 return 0; /* The terminal is suspended. */
6954 6954
6955#ifdef MSDOS 6955#ifdef MSDOS
6956 n_to_read = dos_keysns (); 6956 n_to_read = dos_keysns ();
@@ -6976,7 +6976,7 @@ tty_read_avail_input (struct terminal *terminal,
6976 Gpm_GetEvent closes gpm_fd and clears it to -1, which is why 6976 Gpm_GetEvent closes gpm_fd and clears it to -1, which is why
6977 we save it in `fd' so close_gpm can remove it from the 6977 we save it in `fd' so close_gpm can remove it from the
6978 select masks. 6978 select masks.
6979 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */ 6979 gpm==-1 if a protocol error or EWOULDBLOCK; the latter is normal. */
6980 while (gpm = Gpm_GetEvent (&event), gpm == 1) { 6980 while (gpm = Gpm_GetEvent (&event), gpm == 1) {
6981 nread += handle_one_term_event (tty, &event, &gpm_hold_quit); 6981 nread += handle_one_term_event (tty, &event, &gpm_hold_quit);
6982 } 6982 }
@@ -6996,7 +6996,7 @@ tty_read_avail_input (struct terminal *terminal,
6996 if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0) 6996 if (ioctl (fileno (tty->input), FIONREAD, &n_to_read) < 0)
6997 { 6997 {
6998 if (! noninteractive) 6998 if (! noninteractive)
6999 return -2; /* Close this terminal. */ 6999 return -2; /* Close this terminal. */
7000 else 7000 else
7001 n_to_read = 0; 7001 n_to_read = 0;
7002 } 7002 }
@@ -7029,16 +7029,16 @@ tty_read_avail_input (struct terminal *terminal,
7029 process group won't get SIGHUP's at logout time. BSDI adheres to 7029 process group won't get SIGHUP's at logout time. BSDI adheres to
7030 this part standard and returns -1 from read (0) with errno==EIO 7030 this part standard and returns -1 from read (0) with errno==EIO
7031 when the control tty is taken away. 7031 when the control tty is taken away.
7032 Jeffrey Honig <jch@bsdi.com> says this is generally safe. */ 7032 Jeffrey Honig <jch@bsdi.com> says this is generally safe. */
7033 if (nread == -1 && errno == EIO) 7033 if (nread == -1 && errno == EIO)
7034 return -2; /* Close this terminal. */ 7034 return -2; /* Close this terminal. */
7035#if defined (AIX) && defined (_BSD) 7035#if defined (AIX) && defined (_BSD)
7036 /* The kernel sometimes fails to deliver SIGHUP for ptys. 7036 /* The kernel sometimes fails to deliver SIGHUP for ptys.
7037 This looks incorrect, but it isn't, because _BSD causes 7037 This looks incorrect, but it isn't, because _BSD causes
7038 O_NDELAY to be defined in fcntl.h as O_NONBLOCK, 7038 O_NDELAY to be defined in fcntl.h as O_NONBLOCK,
7039 and that causes a value other than 0 when there is no input. */ 7039 and that causes a value other than 0 when there is no input. */
7040 if (nread == 0) 7040 if (nread == 0)
7041 return -2; /* Close this terminal. */ 7041 return -2; /* Close this terminal. */
7042#endif 7042#endif
7043 } 7043 }
7044 while ( 7044 while (
@@ -7116,7 +7116,7 @@ tty_read_avail_input (struct terminal *terminal,
7116 buf.code = cbuf[i]; 7116 buf.code = cbuf[i];
7117 /* Set the frame corresponding to the active tty. Note that the 7117 /* Set the frame corresponding to the active tty. Note that the
7118 value of selected_frame is not reliable here, redisplay tends 7118 value of selected_frame is not reliable here, redisplay tends
7119 to temporarily change it. */ 7119 to temporarily change it. */
7120 buf.frame_or_window = tty->top_frame; 7120 buf.frame_or_window = tty->top_frame;
7121 buf.arg = Qnil; 7121 buf.arg = Qnil;
7122 7122
@@ -7139,7 +7139,7 @@ handle_async_input (void)
7139 pending_signals = pending_atimers; 7139 pending_signals = pending_atimers;
7140#endif 7140#endif
7141/* Tell ns_read_socket() it is being called asynchronously so it can avoid 7141/* Tell ns_read_socket() it is being called asynchronously so it can avoid
7142 doing anything dangerous. */ 7142 doing anything dangerous. */
7143#ifdef HAVE_NS 7143#ifdef HAVE_NS
7144 ++handling_signal; 7144 ++handling_signal;
7145#endif 7145#endif
@@ -7197,7 +7197,7 @@ input_available_signal (int signo)
7197 This function exists so that the UNBLOCK_INPUT macro in 7197 This function exists so that the UNBLOCK_INPUT macro in
7198 blockinput.h can have some way to take care of input we put off 7198 blockinput.h can have some way to take care of input we put off
7199 dealing with, without assuming that every file which uses 7199 dealing with, without assuming that every file which uses
7200 UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */ 7200 UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */
7201void 7201void
7202reinvoke_input_signal (void) 7202reinvoke_input_signal (void)
7203{ 7203{
@@ -7224,7 +7224,7 @@ struct user_signal_info
7224 struct user_signal_info *next; 7224 struct user_signal_info *next;
7225}; 7225};
7226 7226
7227/* List of user signals. */ 7227/* List of user signals. */
7228static struct user_signal_info *user_signals = NULL; 7228static struct user_signal_info *user_signals = NULL;
7229 7229
7230void 7230void
@@ -7761,7 +7761,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
7761 { 7761 {
7762 tem = XCAR (item); 7762 tem = XCAR (item);
7763 if (SYMBOLP (tem) || STRINGP (tem) || VECTORP (tem)) 7763 if (SYMBOLP (tem) || STRINGP (tem) || VECTORP (tem))
7764 /* Be GC protected. Set keyhint to item instead of tem. */ 7764 /* Be GC protected. Set keyhint to item instead of tem. */
7765 keyhint = item; 7765 keyhint = item;
7766 } 7766 }
7767 else if (EQ (tem, QCkeys)) 7767 else if (EQ (tem, QCkeys))
@@ -7844,7 +7844,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
7844 if (inmenubar > 0) 7844 if (inmenubar > 0)
7845 return 1; 7845 return 1;
7846 7846
7847 { /* This is a command. See if there is an equivalent key binding. */ 7847 { /* This is a command. See if there is an equivalent key binding. */
7848 Lisp_Object keyeq = AREF (item_properties, ITEM_PROPERTY_KEYEQ); 7848 Lisp_Object keyeq = AREF (item_properties, ITEM_PROPERTY_KEYEQ);
7849 7849
7850 /* The previous code preferred :key-sequence to :keys, so we 7850 /* The previous code preferred :key-sequence to :keys, so we
@@ -8400,7 +8400,7 @@ append_tool_bar_item (void)
8400 These are done in different ways, depending on how the input will be read. 8400 These are done in different ways, depending on how the input will be read.
8401 Menus using X are done after auto-saving in read-char, getting the input 8401 Menus using X are done after auto-saving in read-char, getting the input
8402 event from Fx_popup_menu; menus using the minibuf use read_char recursively 8402 event from Fx_popup_menu; menus using the minibuf use read_char recursively
8403 and do auto-saving in the inner call of read_char. */ 8403 and do auto-saving in the inner call of read_char. */
8404 8404
8405static Lisp_Object 8405static Lisp_Object
8406read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps, 8406read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps,
@@ -8620,14 +8620,14 @@ read_char_minibuf_menu_prompt (int commandflag,
8620 tem 8620 tem
8621 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ]; 8621 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_KEYEQ];
8622 if (!NILP (tem)) 8622 if (!NILP (tem))
8623 /* Insert equivalent keybinding. */ 8623 /* Insert equivalent keybinding. */
8624 s = concat2 (s, tem); 8624 s = concat2 (s, tem);
8625#endif 8625#endif
8626 tem 8626 tem
8627 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE]; 8627 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_TYPE];
8628 if (EQ (tem, QCradio) || EQ (tem, QCtoggle)) 8628 if (EQ (tem, QCradio) || EQ (tem, QCtoggle))
8629 { 8629 {
8630 /* Insert button prefix. */ 8630 /* Insert button prefix. */
8631 Lisp_Object selected 8631 Lisp_Object selected
8632 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED]; 8632 = XVECTOR (item_properties)->contents[ITEM_PROPERTY_SELECTED];
8633 if (EQ (tem, QCradio)) 8633 if (EQ (tem, QCradio))
@@ -8861,7 +8861,7 @@ keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
8861 8861
8862 /* If keybuf[fkey->start..fkey->end] is bound in the 8862 /* If keybuf[fkey->start..fkey->end] is bound in the
8863 map and we're in a position to do the key remapping, replace it with 8863 map and we're in a position to do the key remapping, replace it with
8864 the binding and restart with fkey->start at the end. */ 8864 the binding and restart with fkey->start at the end. */
8865 if ((VECTORP (next) || STRINGP (next)) && doit) 8865 if ((VECTORP (next) || STRINGP (next)) && doit)
8866 { 8866 {
8867 int len = XFASTINT (Flength (next)); 8867 int len = XFASTINT (Flength (next));
@@ -9025,7 +9025,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9025 9025
9026 /* Non-zero if we are trying to map a key by changing an upper-case 9026 /* Non-zero if we are trying to map a key by changing an upper-case
9027 letter to lower case, or a shifted function key to an unshifted 9027 letter to lower case, or a shifted function key to an unshifted
9028 one. */ 9028 one. */
9029 int shift_translated = 0; 9029 int shift_translated = 0;
9030 9030
9031 /* If we receive a `switch-frame' or `select-window' event in the middle of 9031 /* If we receive a `switch-frame' or `select-window' event in the middle of
@@ -9033,7 +9033,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9033 While we're reading, we keep the event here. */ 9033 While we're reading, we keep the event here. */
9034 Lisp_Object delayed_switch_frame; 9034 Lisp_Object delayed_switch_frame;
9035 9035
9036 /* See the comment below... */ 9036 /* See the comment below... */
9037#if defined (GOBBLE_FIRST_EVENT) 9037#if defined (GOBBLE_FIRST_EVENT)
9038 Lisp_Object first_event; 9038 Lisp_Object first_event;
9039#endif 9039#endif
@@ -9308,7 +9308,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9308 if (!found) 9308 if (!found)
9309 { 9309 {
9310 /* Don't touch interrupted_kboard when it's been 9310 /* Don't touch interrupted_kboard when it's been
9311 deleted. */ 9311 deleted. */
9312 delayed_switch_frame = Qnil; 9312 delayed_switch_frame = Qnil;
9313 goto replay_entire_sequence; 9313 goto replay_entire_sequence;
9314 } 9314 }
@@ -9416,7 +9416,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9416 { 9416 {
9417 /* If we're at the beginning of a key sequence, and the caller 9417 /* If we're at the beginning of a key sequence, and the caller
9418 says it's okay, go ahead and return this event. If we're 9418 says it's okay, go ahead and return this event. If we're
9419 in the midst of a key sequence, delay it until the end. */ 9419 in the midst of a key sequence, delay it until the end. */
9420 if (t > 0 || !can_return_switch_frame) 9420 if (t > 0 || !can_return_switch_frame)
9421 { 9421 {
9422 delayed_switch_frame = key; 9422 delayed_switch_frame = key;
@@ -9713,7 +9713,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9713 Down-clicks are eliminated. 9713 Down-clicks are eliminated.
9714 Double-downs reduce to downs, then are eliminated. 9714 Double-downs reduce to downs, then are eliminated.
9715 Triple-downs reduce to double-downs, then to downs, 9715 Triple-downs reduce to double-downs, then to downs,
9716 then are eliminated. */ 9716 then are eliminated. */
9717 if (modifiers & (down_modifier | drag_modifier 9717 if (modifiers & (down_modifier | drag_modifier
9718 | double_modifier | triple_modifier)) 9718 | double_modifier | triple_modifier))
9719 { 9719 {
@@ -10822,7 +10822,7 @@ set_waiting_for_input (struct timeval *time_to_clear)
10822 waiting_for_input = 1; 10822 waiting_for_input = 1;
10823 10823
10824 /* If handle_interrupt was called before and buffered a C-g, 10824 /* If handle_interrupt was called before and buffered a C-g,
10825 make it run again now, to avoid timing error. */ 10825 make it run again now, to avoid timing error. */
10826 if (!NILP (Vquit_flag)) 10826 if (!NILP (Vquit_flag))
10827 quit_throw_to_read_char (); 10827 quit_throw_to_read_char ();
10828} 10828}
@@ -10843,7 +10843,7 @@ clear_waiting_for_input (void)
10843 10843
10844static void 10844static void
10845interrupt_signal (int signalnum) /* If we don't have an argument, some */ 10845interrupt_signal (int signalnum) /* If we don't have an argument, some */
10846 /* compilers complain in signal calls. */ 10846 /* compilers complain in signal calls. */
10847{ 10847{
10848 /* Must preserve main program's value of errno. */ 10848 /* Must preserve main program's value of errno. */
10849 int old_errno = errno; 10849 int old_errno = errno;
@@ -10851,12 +10851,12 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10851 10851
10852 SIGNAL_THREAD_CHECK (signalnum); 10852 SIGNAL_THREAD_CHECK (signalnum);
10853 10853
10854 /* See if we have an active terminal on our controlling tty. */ 10854 /* See if we have an active terminal on our controlling tty. */
10855 terminal = get_named_tty ("/dev/tty"); 10855 terminal = get_named_tty ("/dev/tty");
10856 if (!terminal) 10856 if (!terminal)
10857 { 10857 {
10858 /* If there are no frames there, let's pretend that we are a 10858 /* If there are no frames there, let's pretend that we are a
10859 well-behaving UN*X program and quit. */ 10859 well-behaving UN*X program and quit. */
10860 Fkill_emacs (Qnil); 10860 Fkill_emacs (Qnil);
10861 } 10861 }
10862 else 10862 else
@@ -10884,7 +10884,7 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */
10884 10884
10885 Otherwise it sets the Lisp variable quit-flag not-nil. This causes 10885 Otherwise it sets the Lisp variable quit-flag not-nil. This causes
10886 eval to throw, when it gets a chance. If quit-flag is already 10886 eval to throw, when it gets a chance. If quit-flag is already
10887 non-nil, it stops the job right away. */ 10887 non-nil, it stops the job right away. */
10888 10888
10889static void 10889static void
10890handle_interrupt (void) 10890handle_interrupt (void)
@@ -10893,7 +10893,7 @@ handle_interrupt (void)
10893 10893
10894 cancel_echoing (); 10894 cancel_echoing ();
10895 10895
10896 /* XXX This code needs to be revised for multi-tty support. */ 10896 /* XXX This code needs to be revised for multi-tty support. */
10897 if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty")) 10897 if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty"))
10898 { 10898 {
10899 /* If SIGINT isn't blocked, don't let us be interrupted by 10899 /* If SIGINT isn't blocked, don't let us be interrupted by
@@ -11003,7 +11003,7 @@ handle_interrupt (void)
11003 wait_reading_process_output() under HAVE_NS because of the call 11003 wait_reading_process_output() under HAVE_NS because of the call
11004 to ns_select there (needed because otherwise events aren't picked up 11004 to ns_select there (needed because otherwise events aren't picked up
11005 outside of polling since we don't get SIGIO like X and we don't have a 11005 outside of polling since we don't get SIGIO like X and we don't have a
11006 separate event loop thread like W32. */ 11006 separate event loop thread like W32. */
11007#ifndef HAVE_NS 11007#ifndef HAVE_NS
11008 if (waiting_for_input && !echoing) 11008 if (waiting_for_input && !echoing)
11009 quit_throw_to_read_char (); 11009 quit_throw_to_read_char ();
@@ -11452,7 +11452,7 @@ init_keyboard (void)
11452 session may have multiple display types, so we always handle 11452 session may have multiple display types, so we always handle
11453 SIGINT. There is special code in interrupt_signal to exit 11453 SIGINT. There is special code in interrupt_signal to exit
11454 Emacs on SIGINT when there are no termcap frames on the 11454 Emacs on SIGINT when there are no termcap frames on the
11455 controlling terminal. */ 11455 controlling terminal. */
11456 signal (SIGINT, interrupt_signal); 11456 signal (SIGINT, interrupt_signal);
11457#ifndef DOS_NT 11457#ifndef DOS_NT
11458 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and 11458 /* For systems with SysV TERMIO, C-g is set up for both SIGINT and
@@ -12249,7 +12249,7 @@ Currently, the only supported values for this
12249variable are `sigusr1' and `sigusr2'. */); 12249variable are `sigusr1' and `sigusr2'. */);
12250 Vdebug_on_event = intern_c_string ("sigusr2"); 12250 Vdebug_on_event = intern_c_string ("sigusr2");
12251 12251
12252 /* Create the initial keyboard. */ 12252 /* Create the initial keyboard. */
12253 initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 12253 initial_kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
12254 init_kboard (initial_kboard); 12254 init_kboard (initial_kboard);
12255 /* Vwindow_system is left at t for now. */ 12255 /* Vwindow_system is left at t for now. */
diff --git a/src/lisp.h b/src/lisp.h
index 1bbb5633fe5..df8812f73b7 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -162,7 +162,7 @@ extern int suppress_checking EXTERNALLY_VISIBLE;
162 162
163/* First, try and define DECL_ALIGN(type,var) which declares a static 163/* First, try and define DECL_ALIGN(type,var) which declares a static
164 variable VAR of type TYPE with the added requirement that it be 164 variable VAR of type TYPE with the added requirement that it be
165 TYPEBITS-aligned. */ 165 TYPEBITS-aligned. */
166#ifndef NO_DECL_ALIGN 166#ifndef NO_DECL_ALIGN
167# ifndef DECL_ALIGN 167# ifndef DECL_ALIGN
168# if HAVE_ATTRIBUTE_ALIGNED 168# if HAVE_ATTRIBUTE_ALIGNED
@@ -1084,11 +1084,9 @@ enum symbol_redirect
1084 SYMBOL_PLAINVAL = 4, 1084 SYMBOL_PLAINVAL = 4,
1085 SYMBOL_VARALIAS = 1, 1085 SYMBOL_VARALIAS = 1,
1086 SYMBOL_LOCALIZED = 2, 1086 SYMBOL_LOCALIZED = 2,
1087 SYMBOL_FORWARDED = 3 1087 SYMBOL_FORWARDED = 3
1088}; 1088};
1089 1089
1090/* In a symbol, the markbit of the plist is used as the gc mark bit */
1091
1092struct Lisp_Symbol 1090struct Lisp_Symbol
1093{ 1091{
1094 unsigned gcmarkbit : 1; 1092 unsigned gcmarkbit : 1;
@@ -1097,8 +1095,7 @@ struct Lisp_Symbol
1097 0 : it's a plain var, the value is in the `value' field. 1095 0 : it's a plain var, the value is in the `value' field.
1098 1 : it's a varalias, the value is really in the `alias' symbol. 1096 1 : it's a varalias, the value is really in the `alias' symbol.
1099 2 : it's a localized var, the value is in the `blv' object. 1097 2 : it's a localized var, the value is in the `blv' object.
1100 3 : it's a forwarding variable, the value is in `forward'. 1098 3 : it's a forwarding variable, the value is in `forward'. */
1101 */
1102 enum symbol_redirect redirect : 3; 1099 enum symbol_redirect redirect : 3;
1103 1100
1104 /* Non-zero means symbol is constant, i.e. changing its value 1101 /* Non-zero means symbol is constant, i.e. changing its value
@@ -1115,15 +1112,12 @@ struct Lisp_Symbol
1115 unsigned declared_special : 1; 1112 unsigned declared_special : 1;
1116 1113
1117 /* The symbol's name, as a Lisp string. 1114 /* The symbol's name, as a Lisp string.
1118
1119 The name "xname" is used to intentionally break code referring to 1115 The name "xname" is used to intentionally break code referring to
1120 the old field "name" of type pointer to struct Lisp_String. */ 1116 the old field "name" of type pointer to struct Lisp_String. */
1121 Lisp_Object xname; 1117 Lisp_Object xname;
1122 1118
1123 /* Value of the symbol or Qunbound if unbound. If this symbol is a 1119 /* Value of the symbol or Qunbound if unbound. Which alternative of the
1124 defvaralias, `alias' contains the symbol for which it is an 1120 union is used depends on the `redirect' field above. */
1125 alias. Use the SYMBOL_VALUE and SET_SYMBOL_VALUE macros to get
1126 and set a symbol's value, to take defvaralias into account. */
1127 union { 1121 union {
1128 Lisp_Object value; 1122 Lisp_Object value;
1129 struct Lisp_Symbol *alias; 1123 struct Lisp_Symbol *alias;
@@ -1318,7 +1312,7 @@ struct Lisp_Misc_Any /* Supertype of all Misc types. */
1318 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */ 1312 enum Lisp_Misc_Type type : 16; /* = Lisp_Misc_??? */
1319 unsigned gcmarkbit : 1; 1313 unsigned gcmarkbit : 1;
1320 int spacer : 15; 1314 int spacer : 15;
1321 /* Make it as long as "Lisp_Free without padding". */ 1315 /* Make it as long as "Lisp_Free without padding". */
1322 void *fill; 1316 void *fill;
1323}; 1317};
1324 1318
@@ -3603,7 +3597,7 @@ extern void init_system_name (void);
3603 3597
3604#define SWITCH_ENUM_CAST(x) (x) 3598#define SWITCH_ENUM_CAST(x) (x)
3605 3599
3606/* Use this to suppress gcc's warnings. */ 3600/* Use this to suppress gcc's warnings. */
3607#ifdef lint 3601#ifdef lint
3608 3602
3609/* Use CODE only if lint checking is in effect. */ 3603/* Use CODE only if lint checking is in effect. */
diff --git a/src/w32.h b/src/w32.h
index f1915125c90..a3ca1130ce6 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -139,6 +139,7 @@ extern void term_w32select (void);
139extern void syms_of_w32menu (void); 139extern void syms_of_w32menu (void);
140extern void globals_of_w32menu (void); 140extern void globals_of_w32menu (void);
141extern void syms_of_fontset (void); 141extern void syms_of_fontset (void);
142extern void syms_of_w32font (void);
142 143
143extern int _sys_read_ahead (int fd); 144extern int _sys_read_ahead (int fd);
144extern int _sys_wait_accept (int fd); 145extern int _sys_wait_accept (int fd);
diff --git a/src/w32font.c b/src/w32font.c
index f47b7a46b1e..6c1b4d0bc20 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -145,6 +145,138 @@ struct font_callback_data
145 style variations if the font name is not specified. */ 145 style variations if the font name is not specified. */
146static void list_all_matching_fonts (struct font_callback_data *); 146static void list_all_matching_fonts (struct font_callback_data *);
147 147
148static BOOL g_b_init_is_w9x;
149static BOOL g_b_init_get_outline_metrics_w;
150static BOOL g_b_init_get_text_metrics_w;
151static BOOL g_b_init_get_glyph_outline_w;
152static BOOL g_b_init_get_glyph_outline_w;
153
154typedef UINT (WINAPI * GetOutlineTextMetricsW_Proc) (
155 HDC hdc,
156 UINT cbData,
157 LPOUTLINETEXTMETRICW lpotmw);
158typedef BOOL (WINAPI * GetTextMetricsW_Proc) (
159 HDC hdc,
160 LPTEXTMETRICW lptmw);
161typedef DWORD (WINAPI * GetGlyphOutlineW_Proc) (
162 HDC hdc,
163 UINT uChar,
164 UINT uFormat,
165 LPGLYPHMETRICS lpgm,
166 DWORD cbBuffer,
167 LPVOID lpvBuffer,
168 const MAT2 *lpmat2);
169
170/* Several "wide" functions we use to support the font backends are
171 unavailable on Windows 9X, unless UNICOWS.DLL is installed (their
172 versions in the default libraries are non-functional stubs). On NT
173 and later systems, these functions are in GDI32.DLL. The following
174 helper function attempts to load UNICOWS.DLL on Windows 9X, and
175 refuses to let Emacs start up if that library is not found. On NT
176 and later versions, it simply loads GDI32.DLL, which should always
177 be available. */
178static HMODULE
179w32_load_unicows_or_gdi32 (void)
180{
181 static BOOL is_9x = 0;
182 OSVERSIONINFO os_ver;
183 HMODULE ret;
184 if (g_b_init_is_w9x == 0)
185 {
186 g_b_init_is_w9x = 1;
187 ZeroMemory (&os_ver, sizeof (OSVERSIONINFO));
188 os_ver.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
189 if (GetVersionEx (&os_ver))
190 is_9x = (os_ver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS);
191 }
192 if (is_9x)
193 {
194 ret = LoadLibrary ("Unicows.dll");
195 if (!ret)
196 {
197 int button;
198
199 button = MessageBox (NULL,
200 "Emacs cannot load the UNICOWS.DLL library.\n"
201 "This library is essential for using Emacs\n"
202 "on this system. You need to install it.\n\n"
203 "However, you can still use Emacs by invoking\n"
204 "it with the '-nw' command-line option.\n\n"
205 "Emacs will exit when you click OK.",
206 "Emacs cannot load UNICOWS.DLL",
207 MB_ICONERROR | MB_TASKMODAL
208 | MB_SETFOREGROUND | MB_OK);
209 switch (button)
210 {
211 case IDOK:
212 default:
213 exit (1);
214 }
215 }
216 }
217 else
218 ret = LoadLibrary ("Gdi32.dll");
219 return ret;
220}
221
222/* The following 3 functions call the problematic "wide" APIs via
223 function pointers, to avoid linking against the non-standard
224 libunicows on W9X. */
225static UINT WINAPI
226get_outline_metrics_w(HDC hdc, UINT cbData, LPOUTLINETEXTMETRICW lpotmw)
227{
228 static GetOutlineTextMetricsW_Proc s_pfn_Get_Outline_Text_MetricsW = NULL;
229 HMODULE hm_unicows = NULL;
230 if (g_b_init_get_outline_metrics_w == 0)
231 {
232 g_b_init_get_outline_metrics_w = 1;
233 hm_unicows = w32_load_unicows_or_gdi32 ();
234 if (hm_unicows)
235 s_pfn_Get_Outline_Text_MetricsW = (GetOutlineTextMetricsW_Proc)
236 GetProcAddress (hm_unicows, "GetOutlineTextMetricsW");
237 }
238 if (s_pfn_Get_Outline_Text_MetricsW == NULL)
239 abort (); /* cannot happen */
240 return s_pfn_Get_Outline_Text_MetricsW (hdc, cbData, lpotmw);
241}
242
243static BOOL WINAPI
244get_text_metrics_w(HDC hdc, LPTEXTMETRICW lptmw)
245{
246 static GetTextMetricsW_Proc s_pfn_Get_Text_MetricsW = NULL;
247 HMODULE hm_unicows = NULL;
248 if (g_b_init_get_text_metrics_w == 0)
249 {
250 g_b_init_get_text_metrics_w = 1;
251 hm_unicows = w32_load_unicows_or_gdi32 ();
252 if (hm_unicows)
253 s_pfn_Get_Text_MetricsW = (GetTextMetricsW_Proc)
254 GetProcAddress (hm_unicows, "GetTextMetricsW");
255 }
256 if (s_pfn_Get_Text_MetricsW == NULL)
257 abort (); /* cannot happen */
258 return s_pfn_Get_Text_MetricsW (hdc, lptmw);
259}
260
261static DWORD WINAPI
262get_glyph_outline_w (HDC hdc, UINT uChar, UINT uFormat, LPGLYPHMETRICS lpgm,
263 DWORD cbBuffer, LPVOID lpvBuffer, const MAT2 *lpmat2)
264{
265 static GetGlyphOutlineW_Proc s_pfn_Get_Glyph_OutlineW = NULL;
266 HMODULE hm_unicows = NULL;
267 if (g_b_init_get_glyph_outline_w == 0)
268 {
269 g_b_init_get_glyph_outline_w = 1;
270 hm_unicows = w32_load_unicows_or_gdi32 ();
271 if (hm_unicows)
272 s_pfn_Get_Glyph_OutlineW = (GetGlyphOutlineW_Proc)
273 GetProcAddress (hm_unicows, "GetGlyphOutlineW");
274 }
275 if (s_pfn_Get_Glyph_OutlineW == NULL)
276 abort (); /* cannot happen */
277 return s_pfn_Get_Glyph_OutlineW (hdc, uChar, uFormat, lpgm, cbBuffer,
278 lpvBuffer, lpmat2);
279}
148 280
149static int 281static int
150memq_no_quit (Lisp_Object elt, Lisp_Object list) 282memq_no_quit (Lisp_Object elt, Lisp_Object list)
@@ -816,11 +948,11 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
816 old_font = SelectObject (dc, hfont); 948 old_font = SelectObject (dc, hfont);
817 949
818 /* Try getting the outline metrics (only works for truetype fonts). */ 950 /* Try getting the outline metrics (only works for truetype fonts). */
819 len = GetOutlineTextMetricsW (dc, 0, NULL); 951 len = get_outline_metrics_w (dc, 0, NULL);
820 if (len) 952 if (len)
821 { 953 {
822 metrics = (OUTLINETEXTMETRICW *) alloca (len); 954 metrics = (OUTLINETEXTMETRICW *) alloca (len);
823 if (GetOutlineTextMetricsW (dc, len, metrics)) 955 if (get_outline_metrics_w (dc, len, metrics))
824 memcpy (&w32_font->metrics, &metrics->otmTextMetrics, 956 memcpy (&w32_font->metrics, &metrics->otmTextMetrics,
825 sizeof (TEXTMETRICW)); 957 sizeof (TEXTMETRICW));
826 else 958 else
@@ -828,7 +960,7 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity,
828 } 960 }
829 961
830 if (!metrics) 962 if (!metrics)
831 GetTextMetricsW (dc, &w32_font->metrics); 963 get_text_metrics_w (dc, &w32_font->metrics);
832 964
833 w32_font->cached_metrics = NULL; 965 w32_font->cached_metrics = NULL;
834 w32_font->n_cache_blocks = 0; 966 w32_font->n_cache_blocks = 0;
@@ -2306,7 +2438,7 @@ compute_metrics (HDC dc, struct w32font_info *w32_font, unsigned int code,
2306 transform.eM11.value = 1; 2438 transform.eM11.value = 1;
2307 transform.eM22.value = 1; 2439 transform.eM22.value = 1;
2308 2440
2309 if (GetGlyphOutlineW (dc, code, options, &gm, 0, NULL, &transform) 2441 if (get_glyph_outline_w (dc, code, options, &gm, 0, NULL, &transform)
2310 != GDI_ERROR) 2442 != GDI_ERROR)
2311 { 2443 {
2312 metrics->lbearing = gm.gmptGlyphOrigin.x; 2444 metrics->lbearing = gm.gmptGlyphOrigin.x;
@@ -2581,3 +2713,12 @@ versions of Windows) characters. */);
2581 w32font_driver.type = Qgdi; 2713 w32font_driver.type = Qgdi;
2582 register_font_driver (&w32font_driver, NULL); 2714 register_font_driver (&w32font_driver, NULL);
2583} 2715}
2716
2717void
2718globals_of_w32font (void)
2719{
2720 g_b_init_is_w9x = 0;
2721 g_b_init_get_outline_metrics_w = 0;
2722 g_b_init_get_text_metrics_w = 0;
2723 g_b_init_get_glyph_outline_w = 0;
2724}