From 47f6692eca6c29231fa4063157fc30b95fdf8db0 Mon Sep 17 00:00:00 2001 From: Anton Schukin Date: Thu, 5 May 2016 16:33:01 +0100 Subject: [PATCH] Revert "Merge pull request #122 from AntonPalich/Fix_text_size_calculation" This reverts commit 06655cdd7743e4ac5bf929f3be4bd9765ae39bac, reversing changes made to acc9900c9832e88f25964690223a27f28578cfb1. --- .../TextMessages/Views/TextBubbleView.swift | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/ChattoAdditions/Source/Chat Items/TextMessages/Views/TextBubbleView.swift b/ChattoAdditions/Source/Chat Items/TextMessages/Views/TextBubbleView.swift index c060288..a2427a1 100644 --- a/ChattoAdditions/Source/Chat Items/TextMessages/Views/TextBubbleView.swift +++ b/ChattoAdditions/Source/Chat Items/TextMessages/Views/TextBubbleView.swift @@ -234,14 +234,11 @@ private final class TextBubbleLayoutModel { } private func textSizeThatFitsWidth(width: CGFloat) -> CGSize { - let maxSize = CGSize(width: width, height: CGFloat.max) - let options: NSStringDrawingOptions = [.UsesLineFragmentOrigin, .UsesFontLeading] - let attributes = [NSFontAttributeName: self.layoutContext.font] - var size = self.layoutContext.text.boundingRectWithSize(maxSize, options: options, attributes: attributes, context: nil).size.bma_round() - // Added to prevent: https://github.com/badoo/Chatto/issues/121 - size.width += 1 - size.height += 1 - return size + return self.layoutContext.text.boundingRectWithSize( + CGSize(width: width, height: CGFloat.max), + options: [.UsesLineFragmentOrigin, .UsesFontLeading], + attributes: [NSFontAttributeName: self.layoutContext.font], context: nil + ).size.bma_round() } }