add error log
This commit is contained in:
parent
a96427b793
commit
6efbd196a8
@ -10,6 +10,7 @@
|
||||
#import <CoreText/CoreText.h>
|
||||
#import "MVMCoreUIUtility.h"
|
||||
@import MVMCore.MVMCoreLoggingHandler;
|
||||
@import MVMCore.MVMCoreErrorConstants;
|
||||
|
||||
NSString * const DSBold = @"VerizonNHGeDS-Bold";
|
||||
NSString * const DSRegular = @"VerizonNHGeDS-Regular";
|
||||
@ -48,19 +49,27 @@ NSString * const TXRegular = @"VerizonNHGeTX-Regular";
|
||||
}
|
||||
|
||||
+ (nonnull UIFont *)mfFontDSBold:(CGFloat)size {
|
||||
return [UIFont fontWithName:DSBold size:size];
|
||||
UIFont *font = [UIFont fontWithName:DSBold size:size];
|
||||
[self validFont:font fontName:DSBold];
|
||||
return font ?: [UIFont boldSystemFontOfSize:size];
|
||||
}
|
||||
|
||||
+ (nonnull UIFont *)mfFontDSRegular:(CGFloat)size {
|
||||
return [UIFont fontWithName:DSRegular size:size];
|
||||
UIFont *font = [UIFont fontWithName:DSRegular size:size];
|
||||
[self validFont:font fontName:DSRegular];
|
||||
return font ?: [UIFont systemFontOfSize:size];
|
||||
}
|
||||
|
||||
+ (nonnull UIFont *)mfFontTXBold:(CGFloat)size {
|
||||
return [UIFont fontWithName:TXBold size:size];
|
||||
UIFont *font = [UIFont fontWithName:TXBold size:size];
|
||||
[self validFont:font fontName:TXBold];
|
||||
return font ?: [UIFont boldSystemFontOfSize:size];
|
||||
}
|
||||
|
||||
+ (nonnull UIFont *)mfFontTXRegular:(CGFloat)size {
|
||||
return [UIFont fontWithName:TXRegular size:size];
|
||||
UIFont *font = [UIFont fontWithName:TXRegular size:size];
|
||||
[self validFont:font fontName:TXRegular];
|
||||
return font ?: [UIFont systemFontOfSize:size];
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +81,7 @@ NSString * const TXRegular = @"VerizonNHGeTX-Regular";
|
||||
} else {
|
||||
font = [self mfFontTXBold:size];
|
||||
}
|
||||
return font ?: [UIFont boldSystemFontOfSize:size];
|
||||
return font;
|
||||
}
|
||||
|
||||
+ (UIFont *)mfFont55Rg:(CGFloat)size {
|
||||
@ -83,16 +92,26 @@ NSString * const TXRegular = @"VerizonNHGeTX-Regular";
|
||||
} else {
|
||||
font = [self mfFontTXRegular:size];
|
||||
}
|
||||
return font ?: [UIFont systemFontOfSize:size];
|
||||
return font;
|
||||
}
|
||||
|
||||
+ (nullable UIFont *)mfFontOcratxt:(CGFloat)size {
|
||||
[self loadMVMFonts];
|
||||
return [UIFont fontWithName:@"OCRAExtended" size:size];
|
||||
UIFont *font = [UIFont fontWithName:@"OCRAExtended" size:size];
|
||||
[self validFont:font fontName:@"OCRAExtended"];
|
||||
return font;
|
||||
}
|
||||
|
||||
+ (UIFont *)mfFontWithName:(nonnull NSString *)name size:(CGFloat)size {
|
||||
return [UIFont fontWithName:name size:size] ?: [self mfFont55Rg:size];
|
||||
UIFont *font = [UIFont fontWithName:name size:size];
|
||||
[self validFont:font fontName:name];
|
||||
return font ?: [self mfFont55Rg:size];
|
||||
}
|
||||
|
||||
+ (void)validFont:(UIFont *)font fontName:(NSString *)fontName {
|
||||
if (font == nil) {
|
||||
MVMCoreErrorObject *errorObject = [[MVMCoreErrorObject alloc] initWithTitle:@"font can not load" message:[NSString stringWithFormat:@"missing font name is %@", fontName] code:ErrorCodeFontNotFound domain:ErrorDomainNative location:@"MFStyler"];
|
||||
[MVMCoreLoggingHandler addErrorToLog:errorObject];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user