mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			112 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Objective-C
		
	
			
		
		
	
	
			112 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			Objective-C
		
	
//
 | 
						|
//  Copyright (c) 2018 Open Whisper Systems. All rights reserved.
 | 
						|
//
 | 
						|
 | 
						|
#import "UIFont+OWS.h"
 | 
						|
 | 
						|
NS_ASSUME_NONNULL_BEGIN
 | 
						|
 | 
						|
@implementation UIFont (OWS)
 | 
						|
 | 
						|
+ (UIFont *)ows_thinFontWithSize:(CGFloat)size
 | 
						|
{
 | 
						|
    if (@available(iOS 8.2, *)) {
 | 
						|
        return [UIFont systemFontOfSize:size weight:UIFontWeightThin];
 | 
						|
    } else {
 | 
						|
        return [UIFont fontWithName:@"HelveticaNeue-Thin" size:size];
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_lightFontWithSize:(CGFloat)size
 | 
						|
{
 | 
						|
    if (@available(iOS 8.2, *)) {
 | 
						|
        return [UIFont systemFontOfSize:size weight:UIFontWeightLight];
 | 
						|
    } else {
 | 
						|
        return [UIFont fontWithName:@"HelveticaNeue-Light" size:size];
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_regularFontWithSize:(CGFloat)size
 | 
						|
{
 | 
						|
    if (@available(iOS 8.2, *)) {
 | 
						|
        return [UIFont systemFontOfSize:size weight:UIFontWeightRegular];
 | 
						|
    } else {
 | 
						|
        return [UIFont fontWithName:@"HelveticaNeue" size:size];
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_mediumFontWithSize:(CGFloat)size
 | 
						|
{
 | 
						|
    if (@available(iOS 8.2, *)) {
 | 
						|
        return [UIFont systemFontOfSize:size weight:UIFontWeightMedium];
 | 
						|
    } else {
 | 
						|
        return [UIFont fontWithName:@"HelveticaNeue-Medium" size:size];
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_boldFontWithSize:(CGFloat)size
 | 
						|
{
 | 
						|
    return [UIFont boldSystemFontOfSize:size];
 | 
						|
}
 | 
						|
 | 
						|
#pragma mark - Icon Fonts
 | 
						|
 | 
						|
+ (UIFont *)ows_fontAwesomeFont:(CGFloat)size
 | 
						|
{
 | 
						|
    return [UIFont fontWithName:@"FontAwesome" size:size];
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_dripIconsFont:(CGFloat)size
 | 
						|
{
 | 
						|
    return [UIFont fontWithName:@"dripicons-v2" size:size];
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_elegantIconsFont:(CGFloat)size
 | 
						|
{
 | 
						|
    return [UIFont fontWithName:@"ElegantIcons" size:size];
 | 
						|
}
 | 
						|
 | 
						|
#pragma mark - Dynamic Type
 | 
						|
 | 
						|
+ (UIFont *)ows_dynamicTypeBodyFont
 | 
						|
{
 | 
						|
    return [UIFont preferredFontForTextStyle:UIFontTextStyleBody];
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_infoMessageFont
 | 
						|
{
 | 
						|
    return [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline];
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_footnoteFont
 | 
						|
{
 | 
						|
    return [UIFont preferredFontForTextStyle:UIFontTextStyleFootnote];
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_dynamicTypeTitle2Font
 | 
						|
{
 | 
						|
    if (@available(iOS 9.0, *)) {
 | 
						|
        return [UIFont preferredFontForTextStyle:UIFontTextStyleTitle2];
 | 
						|
    } else {
 | 
						|
        // Dynamic title font for ios8 defaults to bold 12.0 pt, whereas ios9+ it's 22.0pt regular weight.
 | 
						|
        // Here we chose to break dynamic font, in order to have uniform style across versions.
 | 
						|
        // It's already huge, so it's unlikely to present a usability issue.
 | 
						|
        // Handy font translations: http://swiftiostutorials.com/comparison-of-system-fonts-on-ios-8-and-ios-9/
 | 
						|
        return [self ows_regularFontWithSize:22.0];
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
+ (UIFont *)ows_dynamicTypeHeadlineFont
 | 
						|
{
 | 
						|
    if (@available(iOS 9.0, *)) {
 | 
						|
        return [UIFont preferredFontForTextStyle:UIFontTextStyleHeadline];
 | 
						|
    } else {
 | 
						|
        // See ows_dynamicTypeTitle2Font.
 | 
						|
        return [self ows_regularFontWithSize:17.0];
 | 
						|
    }
 | 
						|
}
 | 
						|
 | 
						|
@end
 | 
						|
 | 
						|
NS_ASSUME_NONNULL_END
 |