OLD | NEW |
---|---|
(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 | |
OLD | NEW |