Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RCTFont maps UltraBold font to UIFontWeightBold font weight #23512

Closed
dat-giggedin opened this issue Feb 18, 2019 · 4 comments
Closed

RCTFont maps UltraBold font to UIFontWeightBold font weight #23512

dat-giggedin opened this issue Feb 18, 2019 · 4 comments
Labels
Bug Component: Text Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.

Comments

@dat-giggedin
Copy link

dat-giggedin commented Feb 18, 2019

🐛 Bug Report

Cannot display correct GillSans-Bold font. It uses GillSans-UltraBold instead
screen shot 2019-02-18 at 10 15 06 pm

To Reproduce

Add text to the screen <Text style={{fontFamily: 'GillSans-Bold'}}></Text>

Expected Behavior

Display correct font
screen shot 2019-02-18 at 10 11 33 pm

Code Example

<Text style={{fontFamily: 'GillSans-Bold'}}></Text>

Environment

React Native Environment Info:
    System:
      OS: macOS 10.14.3
      CPU: (8) x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
      Memory: 1.18 GB / 16.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 11.6.0 - /usr/local/bin/node
      Yarn: 1.13.0 - /usr/local/bin/yarn
      npm: 6.7.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        API Levels: 23, 25, 26, 28
        Build Tools: 28.0.3
        System Images: android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.3 AI-182.5107.16.33.5199772
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.6.3 => 16.6.3 
      react-native: 0.58.4 => 0.58.4 
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7

Because in RCTFont.mm, it uses UIFontWeight variants to get the fonts which has matching suffix (...Bold). It takes GillSans-UltraBold as its match and skip GillSans-Bold. Could you consider using UIFontWeightTrait and removing UIFontWeight variants checking?

@react-native-bot

This comment has been minimized.

@dat-giggedin dat-giggedin changed the title weightOfFont cannot regconize GillSans-UltraBold and GillSans-Bold Cannot regconize GillSans-UltraBold and GillSans-Bold Feb 18, 2019
@dat-giggedin dat-giggedin changed the title Cannot regconize GillSans-UltraBold and GillSans-Bold Cannot regconize GillSans-Bold Feb 18, 2019
@dat-giggedin dat-giggedin changed the title Cannot regconize GillSans-Bold Cannot regconize GillSans-Bold on iOS Feb 18, 2019
@hramos
Copy link
Contributor

hramos commented Feb 19, 2019

cc @mmmulani / @shergin

@hramos hramos changed the title Cannot regconize GillSans-Bold on iOS RCTFont maps UltraBold font to UIFontWeightBold font weight Feb 19, 2019
@mmmulani
Copy link
Contributor

does {fontFamily:'GillSans', fontWeight:'bold'} work? we use UIFontWeightTraits here: https://github.com/facebook/react-native/blob/master/React/Views/RCTFont.mm#L39

@dat-giggedin
Copy link
Author

dat-giggedin commented Mar 2, 2019

no, it didn’t. And yes, you use UIFontWeightTraits but it never reach to those code because the for loop map map UltraBold to Bold trait and return. I had to comment for loop in that function to make it work

M-i-k-e-l pushed a commit to M-i-k-e-l/react-native that referenced this issue Mar 10, 2020
Summary:
Add `ultrabold` map of font weight, if not, `ultrabold` would map to `bold`.
Fixes facebook#23512.

## Changelog

[iOS] [Fixed] - Add ultrabold pairs for font weight
Pull Request resolved: facebook#24948

Differential Revision: D15575568

Pulled By: cpojer

fbshipit-source-id: 5d1d6a033c166d91a330526ba8996ac0416f3887
@facebook facebook locked as resolved and limited conversation to collaborators May 31, 2020
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label May 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Component: Text Platform: iOS iOS applications. Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants