From 48276f989fe1a3f6f6f66cb4cfdda35bd295f318 Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Thu, 4 Sep 2014 17:35:03 -0700 Subject: [PATCH] Fixed: - (CGSize)sizeWithFont:(CPFont)aFont inWidth:(float)aWidth adjust +1 to the computed size The width computing of a string is always a little random, and that led to truncated labels. This patch adds a pixel in width in order to fix any rounding errors. --- AppKit/Platform/DOM/CPPlatformString.j | 2 +- AppKit/_CPToolTip.j | 6 ------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/AppKit/Platform/DOM/CPPlatformString.j b/AppKit/Platform/DOM/CPPlatformString.j index 93b44f113..1e520dd7f 100644 --- a/AppKit/Platform/DOM/CPPlatformString.j +++ b/AppKit/Platform/DOM/CPPlatformString.j @@ -151,7 +151,7 @@ var DOMFixedWidthSpanElement = nil, else if (CPFeatureIsCompatible(CPJavaScriptTextContentFeature)) span.textContent = aString; - return CGSizeMake(span.clientWidth, span.clientHeight); + return CGSizeMake(span.clientWidth + 1, span.clientHeight); } + (CPDictionary)metricsOfFont:(CPFont)aFont diff --git a/AppKit/_CPToolTip.j b/AppKit/_CPToolTip.j index 24aa8dfc4..6268f8ab4 100644 --- a/AppKit/_CPToolTip.j +++ b/AppKit/_CPToolTip.j @@ -118,12 +118,6 @@ var _CPToolTipHeight = 24.0, textFrameSizeSingleLine = [aText sizeWithFont:font], textFrameSize = [aText sizeWithFont:font inWidth:(aToolTipSize.width)]; - // this small adjustement seems to fix all - // tooltips sizing issues. Now I'm not sure why - // we need this. - textFrameSizeSingleLine.width += 1; - textFrameSize.width += 1; - // If the text fully fits within the maximum width, shrink to fit. if (textFrameSizeSingleLine.width < aToolTipSize.width) {