Skip to content

Log unrecognized font family on Android - #58751

Open
mosab-nasrallah wants to merge 3 commits into
react:mainfrom
mosab-nasrallah:android-log-unrecognized-font-family
Open

mosab-nasrallah wants to merge 3 commits into
react:mainfrom
mosab-nasrallah:android-log-unrecognized-font-family

Conversation

@mosab-nasrallah

@mosab-nasrallah mosab-nasrallah commented Sep 29, 2026 •

Copy link
Copy Markdown

Summary:

On Android, a fontFamily that can't be resolved silently falls back to the default system font. iOS logs Unrecognized font family '<name>' in the same case (RCTFont.mm). This adds the same log on Android, only when Typeface.create falls back to the default typeface, so valid system families like monospace don't log.

Fixes #58750

Changelog:

[ANDROID] [ADDED] - Log unrecognized font families, matching iOS

Test Plan:

Ran this branch's ReactFontManager.kt in a test app on an API 35 emulator and checked logcat:

  • 'FontFamilyThatDoesNotExist' logs Unrecognized font family 'FontFamilyThatDoesNotExist' (once per style)
  • 'monospace', 'serif', 'sans-serif', 'sans-serif-medium', 'cursive', fonts in assets/fonts/ and fonts added with addCustomFont log nothing
  • Every font family name declared on the device (34 names, all 4 styles) logs nothing

Repro: RNTesterPlayground.js

@meta-cla

meta-cla Bot commented Sep 29, 2026

Copy link
Copy Markdown

Hi @mosab-nasrallah!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 30, 2026
@meta-cla

meta-cla Bot commented Sep 30, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Sep 30, 2026

@javache javache left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this warning accurate enough? What if you're using a different system font name and Typeface.create is able to resolve it?

@mosab-nasrallah

Copy link
Copy Markdown
Author

Is this warning accurate enough? What if you're using a different system font name and Typeface.create is able to resolve it?

You're right, it wasn't accurate. It now only logs when Typeface.create falls back to the default typeface (Typeface.defaultFromStyle(style)), and it skips sans-serif, since that is the default family. I also switched to the same message as iOS. I checked every system font family name on an API 35 emulator, and none of them trigger the log.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Unrecognized fontFamily silently falls back to the system font (no log, unlike iOS)

2 participants