diff options
author | patthoyts <patthoyts@noemail.net> | 2009-10-29 10:02:43 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@noemail.net> | 2009-10-29 10:02:43 (GMT) |
commit | 422bacc4cce8862900bd60b56d285b813cb142dc (patch) | |
tree | 91144fb6cfd925a9bfa95bba156208efd3d81d9b /win | |
parent | 3fb0535ed0a7c458eec293030064c253dd332dde (diff) | |
download | tk-422bacc4cce8862900bd60b56d285b813cb142dc.zip tk-422bacc4cce8862900bd60b56d285b813cb142dc.tar.gz tk-422bacc4cce8862900bd60b56d285b813cb142dc.tar.bz2 |
[Bug 1825353]: Backported patch for tiny fixed font on Russian Windows systems.
FossilOrigin-Name: 51dfccf0af4395d55e75e8f5eaaa572446e8345a
Diffstat (limited to 'win')
-rw-r--r-- | win/tkWinFont.c | 22 |
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. |