Change Font Device Wise

#define PROPORTIONAL_FONT_SIZE(s)
(s + (IS_IPHONE_4_OR_LESS ? -3 : 0) + (IS_IPHONE_5 ? -2 : 0) +
(IS_IPHONE_6 ? -1 : 0) + (IS_IPHONE_6P ? 0 : 0))
DEVICE TYPE
#pragma mark - DEVICE TYPE MACROS
#pragma mark -

#define IS_IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
#define IS_IPHONE (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
#define IS_RETINA ([[UIScreen mainScreen] scale] >= 2.0)

DEVICE DIMENSION

#pragma mark - DEVICE DIMENSION MACROS
#pragma mark -

#define SCREEN_WIDTH ([[UIScreen mainScreen] bounds].size.width)
#define SCREEN_HEIGHT ([[UIScreen mainScreen] bounds].size.height)
#define SCREEN_MAX_LENGTH (MAX(SCREEN_WIDTH, SCREEN_HEIGHT))
#define SCREEN_MIN_LENGTH (MIN(SCREEN_WIDTH, SCREEN_HEIGHT))

#define IS_IPHONE_4_OR_LESS (IS_IPHONE && SCREEN_MAX_LENGTH < 568.0)
#define IS_IPHONE_5 (IS_IPHONE && SCREEN_MAX_LENGTH == 568.0)
#define IS_IPHONE_6 (IS_IPHONE && SCREEN_MAX_LENGTH == 667.0)
#define IS_IPHONE_6P (IS_IPHONE && SCREEN_MAX_LENGTH == 736.0)

FONT MACROS

#pragma mark - FONT MACROS
#pragma mark -

#define FONT_FAMILY_REGULAR @"CenturyGothic"
#define FONT_FAMILY_BOLD @"CenturyGothic-Bold"
#define FONT_FAMILY_SEMIBOLD @""

#define REGULAR_FONT(s)                                                        \
[UIFont fontWithName:FONT_FAMILY_REGULAR size:PROPORTIONAL_FONT_SIZE(s)]
#define BOLD_FONT(s)                                                           \
[UIFont fontWithName:FONT_FAMILY_BOLD size:PROPORTIONAL_FONT_SIZE(s)]
#define SEMI_BOLD_FONT(s)                                                      \
[UIFont fontWithName:FONT_FAMILY_SEMIBOLD size:PROPORTIONAL_FONT_SIZE(s)]

#define PROPORTIONAL_FONT_SIZE(s)                                              \
(s + (IS_IPHONE_4_OR_LESS ? -3 : 0) + (IS_IPHONE_5 ? -2 : 0) +                \
(IS_IPHONE_6 ? -1 : 0) + (IS_IPHONE_6P ? 0 : 0))

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s