summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2008-10-18 11:31:29 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2008-10-18 11:31:29 (GMT)
commitce82534d5c94d852ec68426e7cfd45c29f72e5c9 (patch)
tree0867536c90ab3d98215d58c3706890041f3d0f95 /win/tkWinFont.c
parentbcf7fd1a54e31d4921b57dff7aa66ff154d6e4f5 (diff)
downloadtk-ce82534d5c94d852ec68426e7cfd45c29f72e5c9.zip
tk-ce82534d5c94d852ec68426e7cfd45c29f72e5c9.tar.gz
tk-ce82534d5c94d852ec68426e7cfd45c29f72e5c9.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/tkWinFont.c')
-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;