summaryrefslogtreecommitdiffstats
path: root/win/tkWinFont.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-19 12:56:55 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2017-05-19 12:56:55 (GMT)
commit2ff5fda0fe162179358a1fdd26adefa380b72286 (patch)
tree329065a2785c3d6196bc67333bacb15c8379cce9 /win/tkWinFont.c
parent107e2400ee9876bbfd0b4712307f642290498194 (diff)
parent033e66e96af33c0ea2ee90e7a6eb6a63b9424f01 (diff)
downloadtk-2ff5fda0fe162179358a1fdd26adefa380b72286.zip
tk-2ff5fda0fe162179358a1fdd26adefa380b72286.tar.gz
tk-2ff5fda0fe162179358a1fdd26adefa380b72286.tar.bz2
Change internal field TkFontAttributes.size from type integer to double. This causes less roundings overall in various font calculations.
Hopefully this fixes bug [434d294df], still to be confirmed, and makes Tk work again on modern Linux Mint/Fedora systems.
Diffstat (limited to 'win/tkWinFont.c')
-rw-r--r--win/tkWinFont.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/win/tkWinFont.c b/win/tkWinFont.c
index f342f7c..d67ea66 100644
--- a/win/tkWinFont.c
+++ b/win/tkWinFont.c
@@ -562,7 +562,7 @@ TkpGetFontFromAttributes(
ReleaseDC(hwnd, hdc);
hFont = GetScreenFont(faPtr, faceName,
- TkFontGetPixels(tkwin, faPtr->size), 0.0);
+ (int)(TkFontGetPixels(tkwin, faPtr->size) + 0.5), 0.0);
if (tkFontPtr == NULL) {
fontPtr = ckalloc(sizeof(WinFont));
} else {
@@ -763,7 +763,7 @@ TkpGetFontAttrsForChar(
ReleaseDC(fontPtr->hwnd, hdc);
faPtr->family = familyPtr->faceName;
faPtr->size = TkFontGetPoints(tkwin,
- tm.tmInternalLeading - tm.tmHeight);
+ (double)(tm.tmInternalLeading - tm.tmHeight));
faPtr->weight = (tm.tmWeight > FW_MEDIUM) ? TK_FW_BOLD : TK_FW_NORMAL;
faPtr->slant = tm.tmItalic ? TK_FS_ITALIC : TK_FS_ROMAN;
faPtr->underline = (tm.tmUnderlined != 0);
@@ -1600,7 +1600,7 @@ InitFont(
faPtr->family = Tk_GetUid(Tcl_DStringValue(&faceString));
faPtr->size =
- TkFontGetPoints(tkwin, -(fontPtr->pixelSize));
+ TkFontGetPoints(tkwin, (double)-(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;