summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorpatthoyts@users.sourceforge.net <patthoyts>2008-10-18 11:31:29 (GMT)
committerpatthoyts@users.sourceforge.net <patthoyts>2008-10-18 11:31:29 (GMT)
commit516bc1e137d004e06009d69a01bf8295a9634b9a (patch)
tree0867536c90ab3d98215d58c3706890041f3d0f95 /win
parent50470ff69c686b80146a7badb279d510df112b9e (diff)
downloadtk-516bc1e137d004e06009d69a01bf8295a9634b9a.zip
tk-516bc1e137d004e06009d69a01bf8295a9634b9a.tar.gz
tk-516bc1e137d004e06009d69a01bf8295a9634b9a.tar.bz2
[Bug 1825353] To fix a problem with tiny fonts on Russian versions of
Windows we will avoid removing the internal leading for fixed width fonts. See the bug for more details on why this change is as it is.
Diffstat (limited to 'win')
-rw-r--r--win/tkWinFont.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index b5e6679..a2eae27 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -11,7 +11,7 @@
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tkWinFont.c,v 1.40 2008/10/05 18:22:22 dkf Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.41 2008/10/18 11:31:29 patthoyts Exp $
*/
#include "tkWinInt.h"
@@ -1403,13 +1403,26 @@ InitFont(
fontPtr->font.fid = (Font) fontPtr;
fontPtr->hwnd = hwnd;
- fontPtr->pixelSize = tm.tmHeight - tm.tmInternalLeading;
+ fontPtr->pixelSize = tm.tmHeight;
+
+ /*
+ * The font pixelSize should be the tmHeight - tmInternalLeading
+ * but this causes fonts to appear too small on for instance
+ * Russian systems where there is internal leading in use.
+ * This hack appears to sort things out.
+ * NB: the logic on this flag is reversed - this means if the
+ * font is not fixed then subtract the leading value.
+ */
+
+ if (tm.tmPitchAndFamily & TMPF_FIXED_PITCH) {
+ fontPtr->pixelSize -= tm.tmInternalLeading;
+ }
faPtr = &fontPtr->font.fa;
faPtr->family = Tk_GetUid(Tcl_DStringValue(&faceString));
faPtr->size =
- TkFontGetPoints(tkwin, -(fontPtr->pixelSize));
+ TkFontGetPoints(tkwin, -(fontPtr->pixelSize));
faPtr->weight =
(tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
faPtr->slant = (tm.tmItalic != 0) ? TK_FS_ITALIC : TK_FS_ROMAN;