From ce82534d5c94d852ec68426e7cfd45c29f72e5c9 Mon Sep 17 00:00:00 2001 From: patthoyts Date: Sat, 18 Oct 2008 11:31:29 +0000 Subject: [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. --- ChangeLog | 6 ++++++ win/tkWinFont.c | 19 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3c6e535..9216c61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-10-18 Pat Thoyts + + * win/tkWinFont.c: [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. + 2008-10-15 Jan Nijtmans * generic/tk.h: Add "const" to many internal 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; -- cgit v0.12