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.
This commit is contained in:
Antoine Mercadal committed 2014-09-04 17:35:03 -07:00
1 parent 57f2d3e26a
commit 48276f989f
2 files changed
+1 -7

No files matched your search

+1 -1
View File
@@ -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
-6
View File
@@ -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)
{