summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatthoyts <patthoyts@users.sourceforge.net>2009-10-29 10:02:44 (GMT)
committerpatthoyts <patthoyts@users.sourceforge.net>2009-10-29 10:02:44 (GMT)
commit6058f062ccea01dfc37cfd3a7c4f62f6ba52faa3 (patch)
tree91144fb6cfd925a9bfa95bba156208efd3d81d9b
parent6e7b94ca0f4eff59ad06a5995e5f4a599bb09bd8 (diff)
downloadtk-6058f062ccea01dfc37cfd3a7c4f62f6ba52faa3.zip
tk-6058f062ccea01dfc37cfd3a7c4f62f6ba52faa3.tar.gz
tk-6058f062ccea01dfc37cfd3a7c4f62f6ba52faa3.tar.bz2
[Bug 1825353]: Backported patch for tiny fixed font on Russian Windows systems.
-rw-r--r--ChangeLog5
-rw-r--r--win/tkWinFont.c22
2 files changed, 24 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ee84954..cfb2d9f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-10-29 Pat Thoyts <patthoyts@users.sourceforge.net>
+
+ * win/tkWinFont.c: [Bug 1825353]: Backported patch for tiny
+ fixed font on Russian Windows systems.
+
2009-10-25 Donal K. Fellows <dkf@users.sf.net>
* unix/tkUnixColor.c (TkpGetColor): [Bug 2809525]: Impose a maximum
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index 29e5fff..815f41c 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.38 2007/12/13 15:28:55 dgp Exp $
+ * RCS: @(#) $Id: tkWinFont.c,v 1.38.2.1 2009/10/29 10:02:44 patthoyts Exp $
*/
#include "tkWinInt.h"
@@ -440,8 +440,24 @@ TkWinSetupSystemFonts(TkMainInfo *mainPtr)
&iconMetrics.lfFont);
}
- hFont = (HFONT)GetStockObject(ANSI_FIXED_FONT);
- CreateNamedSystemFont(interp, tkwin, "TkFixedFont", hFont);
+ /*
+ * Identify an available fixed font. Equivalent to ANSI_FIXED_FONT but
+ * more reliable on Russian Windows.
+ */
+
+ {
+ LOGFONTA lfFixed = {
+ 0, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
+ 0, 0, DEFAULT_QUALITY, FIXED_PITCH | FF_MODERN, ""
+ };
+ long pointSize, dpi;
+ HDC hdc = GetDC(NULL);
+ dpi = GetDeviceCaps(hdc, LOGPIXELSY);
+ pointSize = -MulDiv(ncMetrics.lfMessageFont.lfHeight, 72, dpi);
+ lfFixed.lfHeight = -MulDiv(pointSize+1, dpi, 72);
+ ReleaseDC(NULL, hdc);
+ CreateNamedSystemLogFont(interp, tkwin, "TkFixedFont", &lfFixed);
+ }
/*
* Setup the remaining standard Tk font names as named fonts.