diff options
| author | Jason Rumney | 2005-07-01 21:28:08 +0000 |
|---|---|---|
| committer | Jason Rumney | 2005-07-01 21:28:08 +0000 |
| commit | c2baa2b65bf9492c0a23a31816a561a187039ae9 (patch) | |
| tree | 901dd874f670b60fd029d38e9af232bf554e4c76 /src | |
| parent | 64f72ae1be6377a34420542246868fdbdcf57e63 (diff) | |
| download | emacs-c2baa2b65bf9492c0a23a31816a561a187039ae9.tar.gz emacs-c2baa2b65bf9492c0a23a31816a561a187039ae9.zip | |
* w32term.c (cleartype_active): New flag for enabling sub-pixel
workaround.
(w32_initialize): Initialize it.
(w32_native_per_char_metric): Allow a couple of extra pixels when
Cleartype is active.
* w32term.c (w32_initialize): Move check for screen reader here
from syms_of_w32term.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/w32term.c | 49 |
2 files changed, 55 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3752b58c831..950a0414047 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2005-07-01 Jason Rumney <jasonr@gnu.org> | ||
| 2 | |||
| 3 | * w32term.c (cleartype_active): New flag for enabling sub-pixel | ||
| 4 | workaround. | ||
| 5 | (w32_initialize): Initialize it. | ||
| 6 | (w32_native_per_char_metric): Allow a couple of extra pixels when | ||
| 7 | Cleartype is active. | ||
| 8 | |||
| 9 | * w32term.c (w32_initialize): Move check for screen reader here | ||
| 10 | from syms_of_w32term. | ||
| 11 | |||
| 1 | 2005-06-30 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | 12 | 2005-06-30 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> |
| 2 | 13 | ||
| 3 | * xterm.c (handle_one_xevent): bzero compose_status when nbytes | 14 | * xterm.c (handle_one_xevent): bzero compose_status when nbytes |
diff --git a/src/w32term.c b/src/w32term.c index 1caa1313df4..24c03a001e6 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -138,6 +138,9 @@ int w32_use_visible_system_caret; | |||
| 138 | for Far East languages. */ | 138 | for Far East languages. */ |
| 139 | int w32_enable_unicode_output; | 139 | int w32_enable_unicode_output; |
| 140 | 140 | ||
| 141 | /* Flag to enable Cleartype hack for font metrics. */ | ||
| 142 | static int cleartype_active; | ||
| 143 | |||
| 141 | DWORD dwWindowsThreadId = 0; | 144 | DWORD dwWindowsThreadId = 0; |
| 142 | HANDLE hWindowsThread = NULL; | 145 | HANDLE hWindowsThread = NULL; |
| 143 | DWORD dwMainThreadId = 0; | 146 | DWORD dwMainThreadId = 0; |
| @@ -907,6 +910,16 @@ w32_native_per_char_metric (font, char2b, font_type, pcm) | |||
| 907 | int real_width; | 910 | int real_width; |
| 908 | GetCharWidth (hdc, *char2b, *char2b, &real_width); | 911 | GetCharWidth (hdc, *char2b, *char2b, &real_width); |
| 909 | #endif | 912 | #endif |
| 913 | if (cleartype_active) | ||
| 914 | { | ||
| 915 | /* Cleartype antialiasing causes characters to overhang | ||
| 916 | by a pixel on each side compared with what GetCharABCWidths | ||
| 917 | reports. */ | ||
| 918 | char_widths.abcA -= 1; | ||
| 919 | char_widths.abcC -= 1; | ||
| 920 | char_widths.abcB += 2; | ||
| 921 | } | ||
| 922 | |||
| 910 | pcm->width = char_widths.abcA + char_widths.abcB + char_widths.abcC; | 923 | pcm->width = char_widths.abcA + char_widths.abcB + char_widths.abcC; |
| 911 | #if 0 | 924 | #if 0 |
| 912 | /* As far as I can tell, this is the best way to determine what | 925 | /* As far as I can tell, this is the best way to determine what |
| @@ -6403,6 +6416,12 @@ w32_initialize () | |||
| 6403 | w32_system_caret_x = 0; | 6416 | w32_system_caret_x = 0; |
| 6404 | w32_system_caret_y = 0; | 6417 | w32_system_caret_y = 0; |
| 6405 | 6418 | ||
| 6419 | /* Initialize w32_use_visible_system_caret based on whether a screen | ||
| 6420 | reader is in use. */ | ||
| 6421 | if (!SystemParametersInfo (SPI_GETSCREENREADER, 0, | ||
| 6422 | &w32_use_visible_system_caret, 0)) | ||
| 6423 | w32_use_visible_system_caret = 0; | ||
| 6424 | |||
| 6406 | last_tool_bar_item = -1; | 6425 | last_tool_bar_item = -1; |
| 6407 | any_help_event_p = 0; | 6426 | any_help_event_p = 0; |
| 6408 | 6427 | ||
| @@ -6447,6 +6466,8 @@ w32_initialize () | |||
| 6447 | /* Dynamically link to optional system components. */ | 6466 | /* Dynamically link to optional system components. */ |
| 6448 | { | 6467 | { |
| 6449 | HANDLE user_lib = LoadLibrary ("user32.dll"); | 6468 | HANDLE user_lib = LoadLibrary ("user32.dll"); |
| 6469 | UINT smoothing_type; | ||
| 6470 | BOOL smoothing_enabled; | ||
| 6450 | 6471 | ||
| 6451 | #define LOAD_PROC(fn) pfn##fn = (void *) GetProcAddress (user_lib, #fn) | 6472 | #define LOAD_PROC(fn) pfn##fn = (void *) GetProcAddress (user_lib, #fn) |
| 6452 | 6473 | ||
| @@ -6467,6 +6488,28 @@ w32_initialize () | |||
| 6467 | effectively form the border of the main scroll bar range. */ | 6488 | effectively form the border of the main scroll bar range. */ |
| 6468 | vertical_scroll_bar_top_border = vertical_scroll_bar_bottom_border | 6489 | vertical_scroll_bar_top_border = vertical_scroll_bar_bottom_border |
| 6469 | = GetSystemMetrics (SM_CYVSCROLL); | 6490 | = GetSystemMetrics (SM_CYVSCROLL); |
| 6491 | |||
| 6492 | /* Constants that are not always defined by the system headers | ||
| 6493 | since they only exist on certain versions of Windows. */ | ||
| 6494 | #ifndef SPI_GETFONTSMOOTHING | ||
| 6495 | #define SPI_GETFONTSMOOTHING 0x4A | ||
| 6496 | #endif | ||
| 6497 | #ifndef SPI_GETFONTSMOOTHINGTYPE | ||
| 6498 | #define SPI_GETFONTSMOOTHINGTYPE 0x0200A | ||
| 6499 | #endif | ||
| 6500 | #ifndef FE_FONTSMOOTHINGCLEARTYPE | ||
| 6501 | #define FE_FONTSMOOTHINGCLEARTYPE 0x2 | ||
| 6502 | #endif | ||
| 6503 | |||
| 6504 | /* Determine if Cleartype is in use. Used to enable a hack in | ||
| 6505 | the char metric calculations which adds extra pixels to | ||
| 6506 | compensate for the "sub-pixels" that are not counted by the | ||
| 6507 | system APIs. */ | ||
| 6508 | cleartype_active = | ||
| 6509 | SystemParametersInfo (SPI_GETFONTSMOOTHING, 0, &smoothing_enabled, 0) | ||
| 6510 | && smoothing_enabled | ||
| 6511 | && SystemParametersInfo (SPI_GETFONTSMOOTHINGTYPE, 0, &smoothing_type, 0) | ||
| 6512 | && smoothing_type == FE_FONTSMOOTHINGCLEARTYPE; | ||
| 6470 | } | 6513 | } |
| 6471 | } | 6514 | } |
| 6472 | 6515 | ||
| @@ -6536,11 +6579,7 @@ software is running as it starts up. | |||
| 6536 | When this variable is set, other variables affecting the appearance of | 6579 | When this variable is set, other variables affecting the appearance of |
| 6537 | the cursor have no effect. */); | 6580 | the cursor have no effect. */); |
| 6538 | 6581 | ||
| 6539 | /* Initialize w32_use_visible_system_caret based on whether a screen | 6582 | w32_use_visible_system_caret = 0; |
| 6540 | reader is in use. */ | ||
| 6541 | if (!SystemParametersInfo (SPI_GETSCREENREADER, 0, | ||
| 6542 | &w32_use_visible_system_caret, 0)) | ||
| 6543 | w32_use_visible_system_caret = 0; | ||
| 6544 | 6583 | ||
| 6545 | /* We don't yet support this, but defining this here avoids whining | 6584 | /* We don't yet support this, but defining this here avoids whining |
| 6546 | from cus-start.el and other places, like "M-x set-variable". */ | 6585 | from cus-start.el and other places, like "M-x set-variable". */ |