Skip to content

Commit

Permalink
Merge pull request #23 from davidjelliott/FixedDepreciationWarnings
Browse files Browse the repository at this point in the history
UIFont depreciation warnings fixed in BFKit compile.
  • Loading branch information
FabrizioBrancati committed Jan 28, 2016
2 parents 0036972 + 12069ab commit 36c9e0a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 57 deletions.
2 changes: 1 addition & 1 deletion BFKitDemo/BFKitDemo/DetailViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ - (void)prepareForDetail:(DetailType)detailType {
UILabel *fontLabel = [UILabel initWithFrame:CGRectMake(20, 20, SCREEN_WIDTH - 40, 25) text:@"Use a font with just an ENUM ^_^" font:FontNameNoteworthyLight size:16 color:[UIColor blackColor] alignment:NSTextAlignmentLeft lines:1];
[_scrollView addSubview:fontLabel];

UILabel *otherFontLabel = [UILabel initWithFrame:CGRectMake(20, 60, SCREEN_WIDTH - 40, 25) text:@"It's awesome!" font:FontNameSuperclarendonBold size:16 color:[UIColor randomColor] alignment:NSTextAlignmentLeft lines:1];
UILabel *otherFontLabel = [UILabel initWithFrame:CGRectMake(20, 60, SCREEN_WIDTH - 40, 25) text:@"It's awesome!" font:FontNamePapyrus size:16 color:[UIColor randomColor] alignment:NSTextAlignmentLeft lines:1];
[_scrollView addSubview:otherFontLabel];

break;
Expand Down
118 changes: 62 additions & 56 deletions Source/Additions/UIKit/UIFont+BFKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ + (NSArray * _Nonnull)fontsNameForFamilyName:(FamilyFontName)familyFontName {
NSArray *fontNames;

switch (familyFontName) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
case FamilyFontNameBanglaSangamMN:
fontNames = [UIFont fontNamesForFamilyName:@"Bangla Sangam MN"];
break;
case FamilyFontNameDINAlternate:
fontNames = [UIFont fontNamesForFamilyName:@"DIN Alternate"];
break;
case FamilyFontNameDINCondensed:
fontNames = [UIFont fontNamesForFamilyName:@"DIN Condensed"];
break;
case FamilyFontNameIowanOldStyle:
fontNames = [UIFont fontNamesForFamilyName:@"Iowan Old Style"];
break;
case FamilyFontNameMarion:
fontNames = [UIFont fontNamesForFamilyName:@"Marion"];
break;
case FamilyFontNameSuperclarendon:
fontNames = [UIFont fontNamesForFamilyName:@"Superclarendon"];
break;
#pragma clang diagnostic pop
case FamilyFontNameAcademyEngravedLET:
fontNames = [UIFont fontNamesForFamilyName:@"Academy Engraved LET"];
break;
Expand Down Expand Up @@ -112,9 +133,6 @@ + (NSArray * _Nonnull)fontsNameForFamilyName:(FamilyFontName)familyFontName {
case FamilyFontNameAvenirNextCondensed:
fontNames = [UIFont fontNamesForFamilyName:@"Avenir Next Condensed"];
break;
case FamilyFontNameBanglaSangamMN:
fontNames = [UIFont fontNamesForFamilyName:@"Bangla Sangam MN"];
break;
case FamilyFontNameBaskerville:
fontNames = [UIFont fontNamesForFamilyName:@"Baskerville"];
break;
Expand Down Expand Up @@ -160,12 +178,6 @@ + (NSArray * _Nonnull)fontsNameForFamilyName:(FamilyFontName)familyFontName {
case FamilyFontNameDidot:
fontNames = [UIFont fontNamesForFamilyName:@"Didot"];
break;
case FamilyFontNameDINAlternate:
fontNames = [UIFont fontNamesForFamilyName:@"DIN Alternate"];
break;
case FamilyFontNameDINCondensed:
fontNames = [UIFont fontNamesForFamilyName:@"DIN Condensed"];
break;
case FamilyFontNameEuphemiaUCAS:
fontNames = [UIFont fontNamesForFamilyName:@"Euphemia UCAS"];
break;
Expand Down Expand Up @@ -211,9 +223,6 @@ + (NSArray * _Nonnull)fontsNameForFamilyName:(FamilyFontName)familyFontName {
case FamilyFontNameHoeflerText:
fontNames = [UIFont fontNamesForFamilyName:@"Hoefler Text"];
break;
case FamilyFontNameIowanOldStyle:
fontNames = [UIFont fontNamesForFamilyName:@"Iowan Old Style"];
break;
case FamilyFontNameKailasa:
fontNames = [UIFont fontNamesForFamilyName:@"Kailasa"];
break;
Expand All @@ -235,9 +244,6 @@ + (NSArray * _Nonnull)fontsNameForFamilyName:(FamilyFontName)familyFontName {
case FamilyFontNameMalayamSangamMN:
fontNames = [UIFont fontNamesForFamilyName:@"Malayalam Sangam MN"];
break;
case FamilyFontNameMarion:
fontNames = [UIFont fontNamesForFamilyName:@"Marion"];
break;
case FamilyFontNameMarkerFelt:
fontNames = [UIFont fontNamesForFamilyName:@"Marker Felt"];
break;
Expand Down Expand Up @@ -274,9 +280,6 @@ + (NSArray * _Nonnull)fontsNameForFamilyName:(FamilyFontName)familyFontName {
case FamilyFontNameSnellRoundhand:
fontNames = [UIFont fontNamesForFamilyName:@"Snell Roundhand"];
break;
case FamilyFontNameSuperclarendon:
fontNames = [UIFont fontNamesForFamilyName:@"Superclarendon"];
break;
case FamilyFontNameSymbol:
fontNames = [UIFont fontNamesForFamilyName:@"Symbol"];
break;
Expand Down Expand Up @@ -313,6 +316,47 @@ + (NSArray * _Nonnull)fontsNameForFamilyName:(FamilyFontName)familyFontName {

+ (UIFont * _Nonnull)fontForFontName:(FontName)fontName size:(CGFloat)fontSize {
switch (fontName) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
case FontNameBanglaSangamMN:
return [UIFont fontWithName:@"BanglaSangamMN" size:fontSize];
case FontNameBanglaSangamMNBold:
return [UIFont fontWithName:@"BanglaSangamMN-Bold" size:fontSize];
case FontNameDINAlternateBold:
return [UIFont fontWithName:@"DINAlternate-Bold" size:fontSize];
case FontNameDINCondensedBold:
return [UIFont fontWithName:@"DINCondensed-Bold" size:fontSize];
case FontNameIowanOldStyleBold:
return [UIFont fontWithName:@"IowanOldStyle-Bold" size:fontSize];
case FontNameIowanOldStyleBoldItalic:
return [UIFont fontWithName:@"IowanOldStyle-BoldItalic" size:fontSize];
case FontNameIowanOldStyleItalic:
return [UIFont fontWithName:@"IowanOldStyle-Italic" size:fontSize];
case FontNameIowanOldStyleRoman:
return [UIFont fontWithName:@"IowanOldStyle-Roman" size:fontSize];
case FontNameMarionBold:
return [UIFont fontWithName:@"Marion-Bold" size:fontSize];
case FontNameMarionItalic:
return [UIFont fontWithName:@"Marion-Italic" size:fontSize];
case FontNameMarionRegular:
return [UIFont fontWithName:@"Marion-Regular" size:fontSize];
case FontNameSuperclarendonBlack:
return [UIFont fontWithName:@"Superclarendon-Black" size:fontSize];
case FontNameSuperclarendonBlackItalic:
return [UIFont fontWithName:@"Superclarendon-BalckItalic" size:fontSize];
case FontNameSuperclarendonBold:
return [UIFont fontWithName:@"Superclarendon-Bold" size:fontSize];
case FontNameSuperclarendonBoldItalic:
return [UIFont fontWithName:@"Superclarendon-BoldItalic" size:fontSize];
case FontNameSuperclarendonItalic:
return [UIFont fontWithName:@"Superclarendon-Italic" size:fontSize];
case FontNameSuperclarendonLight:
return [UIFont fontWithName:@"Superclarendon-Light" size:fontSize];
case FontNameSuperclarendonLightItalic:
return [UIFont fontWithName:@"Superclarendon-LightItalic" size:fontSize];
case FontNameSuperclarendonRegular:
return [UIFont fontWithName:@"Superclarendon-Regular" size:fontSize];
#pragma clang diagnostic pop
case FontNameAcademyEngravedLetPlain:
return [UIFont fontWithName:@"AcademyEngravedLetPlain" size:fontSize];
case FontNameAlNile:
Expand Down Expand Up @@ -437,10 +481,6 @@ + (UIFont * _Nonnull)fontForFontName:(FontName)fontName size:(CGFloat)fontSize {
return [UIFont fontWithName:@"Avenir-Oblique" size:fontSize];
case FontNameAvenirRoman:
return [UIFont fontWithName:@"Avenir-Roman" size:fontSize];
case FontNameBanglaSangamMN:
return [UIFont fontWithName:@"BanglaSangamMN" size:fontSize];
case FontNameBanglaSangamMNBold:
return [UIFont fontWithName:@"BanglaSangamMN-Bold" size:fontSize];
case FontNameBaskerville:
return [UIFont fontWithName:@"Baskerville" size:fontSize];
case FontNameBaskervilleBold:
Expand Down Expand Up @@ -527,10 +567,6 @@ + (UIFont * _Nonnull)fontForFontName:(FontName)fontName size:(CGFloat)fontSize {
return [UIFont fontWithName:@"Didot-Bold" size:fontSize];
case FontNameDidotItalic:
return [UIFont fontWithName:@"Didot-Italic" size:fontSize];
case FontNameDINAlternateBold:
return [UIFont fontWithName:@"DINAlternate-Bold" size:fontSize];
case FontNameDINCondensedBold:
return [UIFont fontWithName:@"DINCondensed-Bold" size:fontSize];
case FontNameDiwanMishafi:
return [UIFont fontWithName:@"DiwanMishafi" size:fontSize];
case FontNameEuphemiaUCAS:
Expand Down Expand Up @@ -637,14 +673,6 @@ + (UIFont * _Nonnull)fontForFontName:(FontName)fontName size:(CGFloat)fontSize {
return [UIFont fontWithName:@"HoeflerText-Italic" size:fontSize];
case FontNameHoeflerTextRegular:
return [UIFont fontWithName:@"HoeflerText-Regular" size:fontSize];
case FontNameIowanOldStyleBold:
return [UIFont fontWithName:@"IowanOldStyle-Bold" size:fontSize];
case FontNameIowanOldStyleBoldItalic:
return [UIFont fontWithName:@"IowanOldStyle-BoldItalic" size:fontSize];
case FontNameIowanOldStyleItalic:
return [UIFont fontWithName:@"IowanOldStyle-Italic" size:fontSize];
case FontNameIowanOldStyleRoman:
return [UIFont fontWithName:@"IowanOldStyle-Roman" size:fontSize];
case FontNameKailasa:
return [UIFont fontWithName:@"Kailasa" size:fontSize];
case FontNameKailasaBold:
Expand Down Expand Up @@ -673,12 +701,6 @@ + (UIFont * _Nonnull)fontForFontName:(FontName)fontName size:(CGFloat)fontSize {
return [UIFont fontWithName:@"MalayalamSangamMN" size:fontSize];
case FontNameMalayalamSangamMNBold:
return [UIFont fontWithName:@"MalayalamSangamMN-Bold" size:fontSize];
case FontNameMarionBold:
return [UIFont fontWithName:@"Marion-Bold" size:fontSize];
case FontNameMarionItalic:
return [UIFont fontWithName:@"Marion-Italic" size:fontSize];
case FontNameMarionRegular:
return [UIFont fontWithName:@"Marion-Regular" size:fontSize];
case FontNameMarkerFeltThin:
return [UIFont fontWithName:@"MarkerFelt-Thin" size:fontSize];
case FontNameMarkerFeltWide:
Expand Down Expand Up @@ -743,22 +765,6 @@ + (UIFont * _Nonnull)fontForFontName:(FontName)fontName size:(CGFloat)fontSize {
return [UIFont fontWithName:@"STHeitiTC-Light" size:fontSize];
case FontNameSTHeitiTCMedium:
return [UIFont fontWithName:@"STHeitiTC-Medium" size:fontSize];
case FontNameSuperclarendonBlack:
return [UIFont fontWithName:@"Superclarendon-Black" size:fontSize];
case FontNameSuperclarendonBlackItalic:
return [UIFont fontWithName:@"Superclarendon-BalckItalic" size:fontSize];
case FontNameSuperclarendonBold:
return [UIFont fontWithName:@"Superclarendon-Bold" size:fontSize];
case FontNameSuperclarendonBoldItalic:
return [UIFont fontWithName:@"Superclarendon-BoldItalic" size:fontSize];
case FontNameSuperclarendonItalic:
return [UIFont fontWithName:@"Superclarendon-Italic" size:fontSize];
case FontNameSuperclarendonLight:
return [UIFont fontWithName:@"Superclarendon-Light" size:fontSize];
case FontNameSuperclarendonLightItalic:
return [UIFont fontWithName:@"Superclarendon-LightItalic" size:fontSize];
case FontNameSuperclarendonRegular:
return [UIFont fontWithName:@"Superclarendon-Regular" size:fontSize];
case FontNameSymbol:
return [UIFont fontWithName:@"Symbol" size:fontSize];
case FontNameTamilSangamMN:
Expand Down

0 comments on commit 36c9e0a

Please sign in to comment.