OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 #ifndef IOS_CHROME_BROWSER_UI_UTIL_MANUAL_TEXT_FRAMER_H_ |
| 6 #define IOS_CHROME_BROWSER_UI_UTIL_MANUAL_TEXT_FRAMER_H_ |
| 7 |
| 8 #import <CoreText/CoreText.h> |
| 9 #import <Foundation/Foundation.h> |
| 10 |
| 11 @protocol TextFrame; |
| 12 |
| 13 // Object encapsulating the manual framing of an attributed string within a |
| 14 // bounding rect. |
| 15 // Known limitations: |
| 16 // - Justified-aligned text is not supported. |
| 17 // - Hyphenation is never attempted, regardless of NSParagraphStyle's |
| 18 // |hyphenationFactor|. |
| 19 @interface ManualTextFramer : NSObject |
| 20 |
| 21 // Creates an instance that frames |string| within |bounds|. |
| 22 - (instancetype)initWithString:(NSAttributedString*)string |
| 23 inBounds:(CGRect)bounds NS_DESIGNATED_INITIALIZER; |
| 24 - (instancetype)init NS_UNAVAILABLE; |
| 25 |
| 26 // Manually Frames the paragraph within the bounds provided upon initialization. |
| 27 // Calling this method populates |textFrame|. |
| 28 - (void)frameText; |
| 29 |
| 30 // The TextFrame created by |-frameText|. Will be nil before |-frameText| is |
| 31 // called. |
| 32 @property(nonatomic, readonly) id<TextFrame> textFrame; |
| 33 |
| 34 @end |
| 35 |
| 36 #endif // IOS_CHROME_BROWSER_UI_UTIL_MANUAL_TEXT_FRAMER_H_ |
OLD | NEW |