summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
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 /win/tkWinFont.c
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.
Diffstat (limited to 'win/tkWinFont.c')
-rw-r--r--win/tkWinFont.c22
1 files changed, 19 insertions, 3 deletions
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.