Mercurial > emacs
diff src/w32term.c @ 83331:efa9e4606e7e
Merged from miles@gnu.org--gnu-2005 (patch 83-87, 449-468)
Patches applied:
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-449
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-450
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-451
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-452
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-453
Update from CVS: lisp/subr.el (add-to-ordered-list): Doc fix.
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-454
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-455
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-456
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-457
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-458
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-459
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-460
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-461
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-462
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-463
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-464
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-465
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-466
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-467
Update from CVS
* miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-468
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-83
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-84
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-85
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-86
Update from CVS
* miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-87
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-371
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Tue, 05 Jul 2005 22:12:55 +0000 |
parents | e58cb448e07c 12f374b6c866 |
children | 6c13700d1c13 |
line wrap: on
line diff
--- a/src/w32term.c Sun Jul 03 17:09:22 2005 +0000 +++ b/src/w32term.c Tue Jul 05 22:12:55 2005 +0000 @@ -138,6 +138,9 @@ for Far East languages. */ int w32_enable_unicode_output; +/* Flag to enable Cleartype hack for font metrics. */ +static int cleartype_active; + DWORD dwWindowsThreadId = 0; HANDLE hWindowsThread = NULL; DWORD dwMainThreadId = 0; @@ -507,6 +510,7 @@ struct frame *f = XFRAME (WINDOW_FRAME (w)); RECT r; HDC hdc; + struct face *face; r.left = x; r.right = x + 1; @@ -514,7 +518,12 @@ r.bottom = y1; hdc = get_frame_dc (f); - w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r); + face = FACE_FROM_ID (f, VERTICAL_BORDER_FACE_ID); + if (face) + w32_fill_rect (f, hdc, face->foreground, &r); + else + w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r); + release_frame_dc (f, hdc); } @@ -907,6 +916,16 @@ int real_width; GetCharWidth (hdc, *char2b, *char2b, &real_width); #endif + if (cleartype_active) + { + /* Cleartype antialiasing causes characters to overhang + by a pixel on each side compared with what GetCharABCWidths + reports. */ + char_widths.abcA -= 1; + char_widths.abcC -= 1; + char_widths.abcB += 2; + } + pcm->width = char_widths.abcA + char_widths.abcB + char_widths.abcC; #if 0 /* As far as I can tell, this is the best way to determine what @@ -6404,6 +6423,12 @@ w32_system_caret_x = 0; w32_system_caret_y = 0; + /* Initialize w32_use_visible_system_caret based on whether a screen + reader is in use. */ + if (!SystemParametersInfo (SPI_GETSCREENREADER, 0, + &w32_use_visible_system_caret, 0)) + w32_use_visible_system_caret = 0; + last_tool_bar_item = -1; any_help_event_p = 0; @@ -6448,6 +6473,8 @@ /* Dynamically link to optional system components. */ { HANDLE user_lib = LoadLibrary ("user32.dll"); + UINT smoothing_type; + BOOL smoothing_enabled; #define LOAD_PROC(fn) pfn##fn = (void *) GetProcAddress (user_lib, #fn) @@ -6468,6 +6495,28 @@ effectively form the border of the main scroll bar range. */ vertical_scroll_bar_top_border = vertical_scroll_bar_bottom_border = GetSystemMetrics (SM_CYVSCROLL); + + /* Constants that are not always defined by the system headers + since they only exist on certain versions of Windows. */ +#ifndef SPI_GETFONTSMOOTHING +#define SPI_GETFONTSMOOTHING 0x4A +#endif +#ifndef SPI_GETFONTSMOOTHINGTYPE +#define SPI_GETFONTSMOOTHINGTYPE 0x0200A +#endif +#ifndef FE_FONTSMOOTHINGCLEARTYPE +#define FE_FONTSMOOTHINGCLEARTYPE 0x2 +#endif + + /* Determine if Cleartype is in use. Used to enable a hack in + the char metric calculations which adds extra pixels to + compensate for the "sub-pixels" that are not counted by the + system APIs. */ + cleartype_active = + SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0) + && smoothing_enabled + && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0) + && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE; } } @@ -6537,11 +6586,7 @@ When this variable is set, other variables affecting the appearance of the cursor have no effect. */); - /* Initialize w32_use_visible_system_caret based on whether a screen - reader is in use. */ - if (!SystemParametersInfo (SPI_GETSCREENREADER, 0, - &w32_use_visible_system_caret, 0)) - w32_use_visible_system_caret = 0; + w32_use_visible_system_caret = 0; /* We don't yet support this, but defining this here avoids whining from cus-start.el and other places, like "M-x set-variable". */