Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Bugfix: Font Family resolving in Release Builds #57

Conversation

jreehuis
Copy link
Contributor

Issue

MdcTheme does not pick up a font family which is specified in the Android Resource XML when using the release build type of the App.

MdcTheme expects the font file path in the APK to be res/font*<filename>. Optimizations to the App APK in release build types changes them to be res/[A-Z]{2}.<fileending>.
As the font family does not gets recognized in this situation the theme uses the current font family of MaterialTheme.

Fix

This PR changes the exptected APK font file path to res/*<filename>.

How to Test

The issue can be reproduced when building the sample app with the release build type from commit ba80854 . The Headline 3 does not get styled with Dancing Script as font family here.

Building the sample app with the releasebuild type from the PR head commit will style the headline 3 with the Dancing Script font family.

@google-cla
Copy link

google-cla bot commented Mar 18, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@jreehuis jreehuis force-pushed the bugfix/font_family_resolving_in_release_builds branch from 43f2e86 to 313887b Compare March 18, 2021 13:43
@google-cla
Copy link

google-cla bot commented Mar 18, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@jreehuis
Copy link
Contributor Author

@googlebot I signed it!

@ricknout
Copy link
Contributor

Thanks for the contribution! In addition to the sample, would it be possible to also add a font family to resources used by MdcThemeTest?

cc @chrisbanes as this might need to also be done in Accompanist AppCompat Theme Adapter

@jreehuis
Copy link
Contributor Author

@ricknout Good point to actually test the XML font family parsing aswell. I adjusted the existing tests accordingly.

@chrisbanes chrisbanes merged commit 6928cc6 into material-components:develop Mar 19, 2021
@jreehuis jreehuis deleted the bugfix/font_family_resolving_in_release_builds branch March 19, 2021 07:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants