Skip to content

Commit

Permalink
[Typography] Add warning about custom fonts and Dynamic Type (#1224)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianegordon authored and randallli committed Feb 27, 2017
1 parent 3f2968b commit 9bea221
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/Typography/src/UIFont+MaterialTypography.m
Expand Up @@ -13,11 +13,19 @@

#import "UIFont+MaterialTypography.h"

#import "MDCTypography.h"
#import "UIFontDescriptor+MaterialTypography.h"

@implementation UIFont (MaterialTypography)

+ (UIFont *)mdc_preferredFontForMaterialTextStyle:(MDCFontTextStyle)style {
// Due to the way iOS handles missing glyphs in fonts, we do not support using a custom font
// loader with Dynamic Type.
id<MDCTypographyFontLoading>fontLoader = [MDCTypography fontLoader];
if (![fontLoader isKindOfClass:[MDCSystemFontLoader class]]) {
NSLog(@"MaterialTypography : Custom font loaders are not compatible with Dynamic Type.");
}

UIFontDescriptor *fontDescriptor =
[UIFontDescriptor mdc_preferredFontDescriptorForMaterialTextStyle:style];

Expand Down

0 comments on commit 9bea221

Please sign in to comment.