Skip to content

Custom fonts won't load on tvOS apps - Unrecognized font family #18025

Closed
@natestone

Description

@natestone

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

Environment:
OS: macOS High Sierra 10.13.2
Node: 8.9.4
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.2 Build version 9C40b
Android Studio: Not Found

Packages: (wanted => installed)
react: 16.2.0 => 16.2.0
react-native: 0.53.2 => 0.53.2

Steps to Reproduce

  1. Create new project using `react-native init AwesomeProject
  2. Create folder: resources/fonts
  3. Add rnpm settings to package.json to link fonts:
  "rnpm": {
    "assets": [
      "resources/fonts"
    ]
  },
  1. Download and add a custom font to resources/fonts (I used BioRhymeExpanded-Regular.ttf in this example - available at https://fonts.google.com/specimen/BioRhyme+Expanded
  2. run react-native link
  3. Modify App.js to utilize new font (Lines 48-53):
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
    fontFamily: 'BioRhymeExpanded-Regular'
  },
  1. Open XCode and run on iOS Simulator and on tvOS simulator

Expected Behavior

We should see the "Welcome to React Native" heading rendered using the new font in both iOS and tvOS apps.

Actual Behavior

We get Unrecognized font family 'BioRhymeExpanded-Regular' when running tvOS (on either AppleTV 4k or AppleTV 4k at 1080p). iOS apps display the correct/expected output.

Working iOS
ios_working

Busted tvOS
tvos_busted

Essentially, tvOS apps are not loading custom fonts. Additionally, noticed that font files did not have tvOS targets, but correcting this had no effect (even after clean, shutdown and restart of packager, and rebuild).

Reproducible Demo

https://gist.github.com/natestone/69b04c8725ef39893c3c5d1a7ca9f7f7

Metadata

Metadata

Assignees

No one assigned

    Labels

    Platform: tvOStvOS applications.StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions