Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: ui/ios/NSString+CrStringDrawing.mm

Issue 497503004: Add NSString category for providing iOS6-style string drawing APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: split into two methods Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ui/ios/NSString+CrStringDrawing.h"
6
7 #include "base/logging.h"
8
9 @implementation NSString (CrStringDrawing)
10
11 - (CGSize)cr_sizeWithFont:(UIFont*)font {
stuartmorgan 2014/08/28 15:18:14 It's not really clear to me why [foo sizeWithAtt
lliabraa 2014/08/28 19:25:06 As discussed offline, this category should have a
12 DCHECK(font) << "|font| can not be nil; it is used as a NSDictionary value";
13 NSDictionary* attributes = @{ NSFontAttributeName : font };
14 return [self sizeWithAttributes:attributes];
15 }
16
17 - (CGSize)cr_integralSizeWithFont:(UIFont*)font {
18 if (!font)
19 return CGSizeZero;
20 CGSize size = [self cr_sizeWithFont:font];
21 return CGSizeMake(ceil(size.width), ceil(size.height));
22 }
23
24 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698