Skip to content
This repository was archived by the owner on Dec 11, 2025. It is now read-only.

v80.0.0

Choose a tag to compare

@romoore romoore released this 26 Mar 16:36
· 3357 commits to stable since this release

80.0.0

This major release introduces Dynamic Type support for Typography Schemes as well as
UIFontMetrics-like support for Dynamic Type for Material Typography. It also includes snapshot tests
for additional components and less-restrictive badging for Tabs.

Breaking changes

MDCTypographyScheming has a new non-optional API, mdc_adjustsFontForContentSizeCategory that is
YES if the returned fonts should use the new Dynamic Type APIs available from Material Typography.
Existing implementations may wish to migrate (at least initially) by returning NO as a read-only
value until support can be added.

- (void)mdc_adjustsFontForContentSizeCategory {
  return NO;
}
public var mdc_adjustsFontForContentSizeCategory: Bool {
  return false;
}

New features

Improved Dynamic Type Support

The Typography and TypographyScheme components have been updated for improved Dynamic Type support.
Most clients will make use of this support through MDCTypographyScheme, though it is possible
to create scalable fonts manually via MDCFontScaler within Typography. The new scaling curves have
been updated for last year's refresh of Material Design typography and font values.

Objective-C

// Typography Scheme is the most typical way to receive scalable fonts.
MDCTypographyScheme *typographyScheme = [[MDCTypographyScheme alloc] initWithDefaults:MDCTypographySchemeDefaultsMaterial201902];
UIFont *scaledBody1Font = [typographyScheme.body1 mdc_scaledFontForCurrentSizeCategory];

// If Typography Schemes aren't used, it's possible to create the fonts manually.
// Initial set-up to apply scaling curves to a base UIFont.
UIFont *baseFont = [UIFont systemFontOfSize:18.0];
MDCFontScaler *body2Scaler = [[MDCFontScaler alloc] initForMaterialTextStyle:MDCTextStyleBody2];
UIFont *scalableFont = [body2Scaler scaledFontWithFont:baseFont];

// Now UIFonts appropriate for Dynamic Type size categories can be created anywhere.
UIFont *baseFontScaledToDefault = [scalableFont mdc_scaledFontAtDefaultSize];
UIFont *baseFontScaledForExtraLarge = [scalableFont mdc_scaledFontForSizeCategory:UIContentSizeCategoryExtraLarge];
UIFont *baseFontScaledForCurrentSizeCategory = [scalableFont mdc_scaledFontForCurrentSizeCategory];

Swift

// Typography Scheme is the most typical way to receive scalable fonts.
let typographyScheme = MDCTypographyScheme(defaults: .material201902)
let scaledBody1Font = typographyScheme.body1.mdc_scaledFontForCurrentSizeCategory()

// If Typography Schemes aren't used, it's possible to create the fonts manually.
// Initial set-up to apply scaling curves to a base UIFont.
let baseFont = UIFont.systemFont(ofSize: 18)
let body2Scaler = MDCFontScaler(forMaterialTextStyle: .body2)
let scalableFont = body2Scaler.scaledFont(with: baseFont)

// Now UIFonts appropriate for Dynamic Type size categories can be created anywhere.
let baseFontScaledToDefault = scalableFont.mdc_scaledFontAtDefaultSize()
let baseFontScaledForExtraLarge = scalableFont.mdc_scaledFont(forSizeCategory: .extraLarge)
let baseFontScaledForCurrentSizeCategory = scalableFont.mdc_scaledFontForCurrentSizeCategory()

API changes

Typography

MDCTextStyleButton

new constant: MDCTextStyleButton

MDCTextStyleCaption

new constant: MDCTextStyleCaption

MDCTextStyleSubtitle2

new constant: MDCTextStyleSubtitle2

MDCTextStyleSubtitle1

new constant: MDCTextStyleSubtitle1

MDCTextStyleBody1

new constant: MDCTextStyleBody1

UIFont(MaterialScalable)

new method: -mdc_scaledFontForCurrentSizeCategory in UIFont(MaterialScalable)

new method: -mdc_scaledFontAtDefaultSize in UIFont(MaterialScalable)

new method: -mdc_scaledFontForSizeCategory: in UIFont(MaterialScalable)

new category: UIFont(MaterialScalable)

new property: mdc_scalingCurve in UIFont(MaterialScalable)

MDCFontScaler

new class method: +scalerForMaterialTextStyle: in MDCFontScaler

new method: -scaledValueForValue: in MDCFontScaler

new class: MDCFontScaler

new method: -init in MDCFontScaler

new method: -initForMaterialTextStyle: in MDCFontScaler

new method: -scaledFontWithFont: in MDCFontScaler

MDCTextStyleHeadline4

new constant: MDCTextStyleHeadline4

MDCTextStyleHeadline3

new constant: MDCTextStyleHeadline3

MDCTextStyleHeadline2

new constant: MDCTextStyleHeadline2

MDCTextStyleHeadline6

new constant: MDCTextStyleHeadline6

MDCTextStyleBody2

new constant: MDCTextStyleBody2

MDCTextStyle

new typedef: MDCTextStyle

MDCTextStyleOverline

new constant: MDCTextStyleOverline

MDCTextStyleHeadline1

new constant: MDCTextStyleHeadline1

MDCTextStyleHeadline5

new constant: MDCTextStyleHeadline5

TypographyScheme

MDCTypographySchemeDefaults

new enum value: MDCTypographySchemeDefaultsMaterial201902 in MDCTypographySchemeDefaults

MDCTypographyScheme

new property: mdc_adjustsFontForContentSizeCategory in MDCTypographyScheme

MDCTypographyScheming

new property: mdc_adjustsFontForContentSizeCategory in MDCTypographyScheming

Component changes

Changes

ActivityIndicator

AppBar

Buttons

HeaderStackView

Ripple

ShapeLibrary

Shapes

Tabs

Typography

schemes/Typography