summaryrefslogtreecommitdiffstats
path: root/macosx/tkMacOSXFont.c
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-01-04 21:13:37 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-01-04 21:13:37 (GMT)
commit9fb30afdb0bfdb85c350bd487569d83e8cb4e0ff (patch)
treea66a1953d59689358591afb564f2c63cd8475c7e /macosx/tkMacOSXFont.c
parent007786784d3f2018825b57a9381dc0f5862b64bd (diff)
downloadtk-9fb30afdb0bfdb85c350bd487569d83e8cb4e0ff.zip
tk-9fb30afdb0bfdb85c350bd487569d83e8cb4e0ff.tar.gz
tk-9fb30afdb0bfdb85c350bd487569d83e8cb4e0ff.tar.bz2
code cleanup (no functional change)
Diffstat (limited to 'macosx/tkMacOSXFont.c')
-rw-r--r--macosx/tkMacOSXFont.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/macosx/tkMacOSXFont.c b/macosx/tkMacOSXFont.c
index c2c884f..5e980d6 100644
--- a/macosx/tkMacOSXFont.c
+++ b/macosx/tkMacOSXFont.c
@@ -205,7 +205,7 @@ GetTkFontAttributesForNSFont(
NSFontTraitMask traits = [[NSFontManager sharedFontManager]
traitsOfFont:nsFont];
faPtr->family = Tk_GetUid([[nsFont familyName] UTF8String]);
-#define FACTOR (3.0/4.0)
+#define FACTOR 0.75
faPtr->size = [nsFont pointSize] * FACTOR;
faPtr->weight = (traits & NSBoldFontMask ? TK_FW_BOLD : TK_FW_NORMAL);
faPtr->slant = (traits & NSItalicFontMask ? TK_FS_ITALIC : TK_FS_ROMAN);
@@ -716,7 +716,7 @@ TkpGetFontFromAttributes(
/* Set of attributes to match. */
{
MacFont *fontPtr;
- int points = (int) (TkFontGetPoints(tkwin, faPtr->size) * 4.0 / 3.0 + 0.5);
+ CGFloat points = floor(TkFontGetPoints(tkwin, faPtr->size / FACTOR) + 0.5);
NSFontTraitMask traits = GetNSFontTraitsFromTkFontAttributes(faPtr);
NSInteger weight = (faPtr->weight == TK_FW_BOLD ? 9 : 5);
NSFont *nsFont;
@@ -738,7 +738,7 @@ TkpGetFontFromAttributes(
if (tkFontPtr == NULL) {
fontPtr = (MacFont *)ckalloc(sizeof(MacFont));
} else {
- fontPtr = (MacFont *) tkFontPtr;
+ fontPtr = (MacFont *)tkFontPtr;
TkpDeleteFont(tkFontPtr);
}
CFRetain(nsFont); /* Always needed to allow unconditional CFRelease below */