Skip to content

Instantly share code, notes, and snippets.

@Akhrameev
Forked from nuthatch/iOS 7 dynamic font mappings
Created November 15, 2017 07:37
Show Gist options
  • Save Akhrameev/ac07adb2c75142cbf7f699c4fabaca5c to your computer and use it in GitHub Desktop.
Save Akhrameev/ac07adb2c75142cbf7f699c4fabaca5c to your computer and use it in GitHub Desktop.
What is UIFontTextStyleHeadline *really*? Dump out preferredFontForTextStyle for UIFontTextStyleHeadline, UIFontTextStyleSubheadline, UIFontTextStyleBody, UIFontTextStyleFootnote, UIFontTextStyleCaption1, UIFontTextStyleCaption2 to examine the font name, weight, and point size.
+ (void)describePreferredFonts
{
static NSArray *textStyles;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
textStyles = @[UIFontTextStyleHeadline,
UIFontTextStyleSubheadline,
UIFontTextStyleBody,
UIFontTextStyleFootnote,
UIFontTextStyleCaption1,
UIFontTextStyleCaption2];
});
NSLog(@"\n%@", [self preferredContentSizeDescription]);
for (NSString *textStyle in textStyles)
{
UIFont *font = [UIFont preferredFontForTextStyle:textStyle];
NSLog(@"\n%@\n%@ %@", textStyle, font.fontName, font);
}
}
Extra Small
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 14.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 14.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 11.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 11.00pt
Small
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 15.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 13.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 15.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 11.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 11.00pt
Medium
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 16.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 14.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 16.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 11.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 11.00pt
Large
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 17.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 15.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 17.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 13.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 11.00pt
Extra Large
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 18.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 16.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 18.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 14.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 13.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 12.00pt
Extra Extra Large
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 19.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 17.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 19.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 15.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 14.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 13.00pt
Extra Extra Extra Large
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: bold; font-style: normal; font-size: 20.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 18.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 20.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 16.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 15.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-M3"; font-weight: normal; font-style: normal; font-size: 14.00pt
"Bold Text" enabled
Extra Small
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-Bold"; font-weight: bold; font-style: normal; font-size: 14.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 14.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 11.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 11.00pt
Small
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-Bold"; font-weight: bold; font-style: normal; font-size: 15.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 13.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 15.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 11.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 11.00pt
Medium
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-Bold"; font-weight: bold; font-style: normal; font-size: 16.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 14.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 16.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 11.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 11.00pt
Large
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-Bold"; font-weight: bold; font-style: normal; font-size: 17.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 15.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 17.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 13.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 12.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 11.00pt
Extra Large
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-Bold"; font-weight: bold; font-style: normal; font-size: 18.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 16.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 18.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 14.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 13.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 12.00pt
Extra Extra Large
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-Bold"; font-weight: bold; font-style: normal; font-size: 19.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 17.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 19.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 15.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 14.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 13.00pt
Extra Extra Extra Large
UIFontTextStyleHeadline
font-family: ".HelveticaNeueInterface-Bold"; font-weight: bold; font-style: normal; font-size: 20.00pt
UIFontTextStyleSubhead
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 18.00pt
UIFontTextStyleBody
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 20.00pt
UIFontTextStyleFootnote
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 16.00pt
UIFontTextStyleCaption1
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 15.00pt
UIFontTextStyleCaption2
font-family: ".HelveticaNeueInterface-MediumP4"; font-weight: normal; font-style: normal; font-size: 14.00pt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment