mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
80 lines
4 KiB
Objective-C
80 lines
4 KiB
Objective-C
/***********************************************************************************
|
|
*
|
|
* Copyright (c) 2010 Olivier Halligon
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
* THE SOFTWARE.
|
|
*
|
|
***********************************************************************************
|
|
*
|
|
* Created by Olivier Halligon (AliSoftware) on 20 Jul. 2010.
|
|
*
|
|
* Any comment or suggestion welcome. Please contact me before using this class in
|
|
* your projects. Referencing this project in your AboutBox/Credits is appreciated.
|
|
*
|
|
***********************************************************************************/
|
|
|
|
|
|
#import <Foundation/Foundation.h>
|
|
#import <CoreText/CoreText.h>
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// MARK: -
|
|
// MARK: NSAttributedString Additions
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
@interface NSAttributedString (OHCommodityConstructors)
|
|
+(id)attributedStringWithString:(NSString*)string;
|
|
+(id)attributedStringWithAttributedString:(NSAttributedString*)attrStr;
|
|
|
|
//! Commodity method that call the following sizeConstrainedToSize:fitRange: method with NULL for the fitRange parameter
|
|
-(CGSize)sizeConstrainedToSize:(CGSize)maxSize;
|
|
//! if fitRange is not NULL, on return it will contain the used range that actually fits the constrained size.
|
|
//! Note: Use CGFLOAT_MAX for the CGSize's height if you don't want a constraint for the height.
|
|
-(CGSize)sizeConstrainedToSize:(CGSize)maxSize fitRange:(NSRange*)fitRange;
|
|
@end
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// MARK: -
|
|
// MARK: NSMutableAttributedString Additions
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
@interface NSMutableAttributedString (OHCommodityStyleModifiers)
|
|
-(void)setFont:(UIFont*)font;
|
|
-(void)setFont:(UIFont*)font range:(NSRange)range;
|
|
-(void)setFontName:(NSString*)fontName size:(CGFloat)size;
|
|
-(void)setFontName:(NSString*)fontName size:(CGFloat)size range:(NSRange)range;
|
|
-(void)setFontFamily:(NSString*)fontFamily size:(CGFloat)size bold:(BOOL)isBold italic:(BOOL)isItalic range:(NSRange)range;
|
|
|
|
-(void)setTextColor:(UIColor*)color;
|
|
-(void)setTextColor:(UIColor*)color range:(NSRange)range;
|
|
-(void)setTextIsUnderlined:(BOOL)underlined;
|
|
-(void)setTextIsUnderlined:(BOOL)underlined range:(NSRange)range;
|
|
-(void)setTextUnderlineStyle:(int32_t)style range:(NSRange)range; //!< style is a combination of CTUnderlineStyle & CTUnderlineStyleModifiers
|
|
-(void)setTextBold:(BOOL)isBold range:(NSRange)range;
|
|
|
|
-(void)setTextAlignment:(CTTextAlignment)alignment lineBreakMode:(CTLineBreakMode)lineBreakMode;
|
|
-(void)setTextAlignment:(CTTextAlignment)alignment lineBreakMode:(CTLineBreakMode)lineBreakMode lineHeight:(CGFloat)lineHeight;
|
|
-(void)setTextAlignment:(CTTextAlignment)alignment lineBreakMode:(CTLineBreakMode)lineBreakMode range:(NSRange)range;
|
|
-(void)setTextAlignment:(CTTextAlignment)alignment lineBreakMode:(CTLineBreakMode)lineBreakMode range:(NSRange)range lineHeight:(CGFloat)lineHeight;
|
|
@end
|
|
|
|
|