diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-03-24 09:00:13 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2011-03-24 09:00:13 (GMT) |
commit | 2d43f302babfefbdcacdd9855d22ca66f64978bc (patch) | |
tree | 5acee400ee1f7acb934372459477b1b64eb95fd0 | |
parent | a11d2888f9486a0d049373fb81beebe3f438f93f (diff) | |
parent | 14f8dd18221e49047e35cab7dd25fc1a8b3d0e18 (diff) | |
download | tk-2d43f302babfefbdcacdd9855d22ca66f64978bc.zip tk-2d43f302babfefbdcacdd9855d22ca66f64978bc.tar.gz tk-2d43f302babfefbdcacdd9855d22ca66f64978bc.tar.bz2 |
[Bug #3239768] tk8.4.19 (and later) WIN32 menu font support.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | win/tkWinMenu.c | 24 |
2 files changed, 25 insertions, 6 deletions
@@ -1,3 +1,8 @@ +2011-03-24 Jan Nijtmans <nijtmans@users.sf.net> + + * win/tkWinMenu.c: [Bug #3239768] tk8.4.19 (and later) WIN32 + menu font support. + 2011-03-16 Jan Nijtmans <nijtmans@users.sf.net> * unix/tcl.m4: Make SHLIB_LD_LIBS='${LIBS}' the default and @@ -50,7 +55,7 @@ 2011-01-22 Joe English <jenglish@users.sourceforge.net> - * generic/ttk/ttkEntry.c(ttk::combobox): Add missing + * generic/ttk/ttkEntry.c(ttk::combobox): Add missing 'validate' command (reported by schelte). 2011-01-13 Jan Nijtmans <nijtmans@users.sf.net> diff --git a/win/tkWinMenu.c b/win/tkWinMenu.c index 2ced640..6dd56d4 100644 --- a/win/tkWinMenu.c +++ b/win/tkWinMenu.c @@ -3189,7 +3189,14 @@ SetDefaults( TEXTMETRICA tm; int pointSize; HFONT menuFont; - NONCLIENTMETRICSA ncMetrics; + /* See: [Bug #3239768] tk8.4.19 (and later) WIN32 menu font support */ + struct { + NONCLIENTMETRICS metrics; +#if (WINVER < 0x0600) + int padding; +#endif + } nc; + OSVERSIONINFO os; /* * Set all of the default options. The loop will terminate when we run out @@ -3207,10 +3214,17 @@ SetDefaults( } Tcl_DStringInit(&menuFontDString); - ncMetrics.cbSize = sizeof(ncMetrics); - SystemParametersInfoA(SPI_GETNONCLIENTMETRICS, sizeof(ncMetrics), - &ncMetrics, 0); - menuFont = CreateFontIndirectA(&ncMetrics.lfMenuFont); + nc.metrics.cbSize = sizeof(nc); + + os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&os); + if (os.dwMajorVersion < 6) { + nc.metrics.cbSize -= sizeof(int); + } + + SystemParametersInfo(SPI_GETNONCLIENTMETRICS, nc.metrics.cbSize, + &nc.metrics, 0); + menuFont = CreateFontIndirect(&nc.metrics.lfMenuFont); SelectObject(scratchDC, menuFont); GetTextMetricsA(scratchDC, &tm); GetTextFaceA(scratchDC, LF_FACESIZE, faceName); |